Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: Heroes 5 Modding: Map Scripting
Thread: Heroes 5 Modding: Map Scripting This thread is 4 pages long: 1 2 3 4 · NEXT»
VokialBG
VokialBG


Honorable
Legendary Hero
First in line
posted February 05, 2008 12:29 PM
Edited by VokialBG at 12:48, 05 Feb 2008.

Heroes 5 Modding: Map Scripting

This thread is for discussing the Map Scripting in Heroes 5.

What belong to this threads: Small guides and examples, not long enough for separate thread; Theoretical possibilities in H5 Modding; Work in progress; Generally discussion about the Map Scripting;

Modding Thread Group:
3D Attempts and Theories|Sounds and Music|Map Scripting|Texture Editing|Texts and Interface|XDB Modding
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Disturbed-Gnu
Disturbed-Gnu


Supreme Hero
Pro Bacon Vodka Brewer
posted February 05, 2008 03:56 PM

Quote:
This thread is for discussing the Map Scripting in Heroes 5.

What belong to this threads: Small guides and examples, not long enough for separate thread; Theoretical possibilities in H5 Modding; Work in progress; Generally discussion about the Map Scripting;

Modding Thread Group:
3D Attempts and Theories|Sounds and Music|Map Scripting|Texture Editing|Texts and Interface|XDB Modding


I love to make maps full of scripts and fun ideas, and make them fun for every one, but i can't do it in Heroes 5 editor!

It was very easy to do in heroes 3, but i qess that is because you didn't have many options to deal with

And I loved Heroes 4 map editor, and all the script options you had there, it was a little bit difficult, but possible to learn, and i made some very cool maps..

But but, i can't do it in H5," The quest hut for an example! In Heroes 4 you had "Greater than or equals" and "Number" or a required artifact for trading and all that, how can i do such things in H5?

Sorry for my bad english, but what can i do?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
sfidanza
sfidanza


Promising
Supreme Hero
posted February 05, 2008 08:30 PM

There are two issues here:
- H5 scripting really requires learning lua, which is a real programming language. It's not a problem by itself, since it really opens many ;ore possibilities, but it's harder to learn. The real problem is that there are no assistant/wizards that could produce bits of code automatically for classic things like quest huts.

- Adding scripts through the editor is a pain. This should have been much easier. And even if you get the editing window, there is still no debugger. You have to test in game. At least, you can reload dynamically a script from the console, so you don't have to restart the game with every change. But all in all, it's easier to add and edit the script manually, with an external code editor.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
ulfara
ulfara


Adventuring Hero
Rhaaaaaaaaaa
posted February 21, 2008 07:46 PM

I know how to script in Heroes 5, but I don't know how to create a objective, I tried "SetObjectiveProgress", "SetObjectiveState",
"SetObjectiveVisible". I created the message for the objective in  "SaveFilenames". Should i do it somewhere else. If yes, then why? .

Could anyone help me?/

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Uncle_Zhuge
Uncle_Zhuge

Tavern Dweller
posted January 17, 2009 06:12 AM

I was reading through some of the game manuals installed with the game and I realized that there is one manual about scripting. I tried dabbling with one of them and it doesn't work at all. Its about adding creatures to your or enemy side during combat. (Kind of like the last scenario for the Academy Campaign, the one where you fight the Demon Sovereign.) The command given by the manual was as follow:

AddCreature (side, type, number, x = -1, y = -1);

So I tried typing in the following command into the map script:

AddCreature (ATTACKER, 106, 100, x = -1, y = -1);

When I typed this command in the scripting command, the map editor says that the function AddCreature is not defined. I believe the command given by the manual could have been incorrect. If anyone can help me in this, I will gladly appreciate it.

By the way, many of the commands don't work if you just simply type that one line according to the manual given.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted January 17, 2009 07:23 AM
Edited by Warmonger at 07:24, 17 Jan 2009.

Quote:
So I tried typing in the following command into the map script:

Try rhinking first. How is the game supposed to know which specific combat do you have in mind?

You have to put that line in the combat script of the specific fight. To do that, either choose the script in properties of the single stack or add it by map properties bar and refer to it with StartCombat function.

Also, this thread appears dead since some years.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Disturbed-Gnu
Disturbed-Gnu


Supreme Hero
Pro Bacon Vodka Brewer
posted January 17, 2009 11:35 AM

LUA scripting shouldn't be a problem if you own Garry's Mod 10 and like making weapons.
^^
Thats sadly a lie! I can't make anything work in heroes!! But i made tons of stuff to Gmod9 & 10

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Asheera
Asheera


Honorable
Undefeatable Hero
Elite Assassin
posted January 17, 2009 01:20 PM

Quote:
When I typed this command in the scripting command, the map editor says that the function AddCreature is not defined. I believe the command given by the manual could have been incorrect. If anyone can help me in this, I will gladly appreciate it.
The Map Editor error-checking is flawed, don't trust it Just test in game and see if it works

Also you wrote it wrongly. You wrote:

AddCreature (ATTACKER, 106, 100, x = -1, y = -1);

And it should be:

AddCreature (ATTACKER, 106, 100);

OR

AddCreature (ATTACKER, 106, 100, -1, -1);

OR

AddCreature (ATTACKER, 106, 100, x, y);

In the last case, you should provide the X and Y coordinates, of course. What it says in the manual with "x=-1" means that it's not necessary to supply an X and Y value, they will have a default value of -1.
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Uncle_Zhuge
Uncle_Zhuge

Tavern Dweller
posted January 18, 2009 03:18 PM

Quote:
Quote:
So I tried typing in the following command into the map script:

Try rhinking first. How is the game supposed to know which specific combat do you have in mind?

You have to put that line in the combat script of the specific fight. To do that, either choose the script in properties of the single stack or add it by map properties bar and refer to it with StartCombat function.

Also, this thread appears dead since some years.

Ok, so I tried adding a few more parameters to the script. It still doesn't work. This is what I tried:

function Start ( heroname );
if heroname == "Biara" then
AddCreature (ATTACKER, 106, 130, -1, -1);

The function that you said "StartCombat" appears to only allow me to add creatures to the defending player. I want to be able to add to the attacker and the defending player as well.

Grrr, triggers in Heroes 5 is so tough. X_X

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted January 18, 2009 03:27 PM
Edited by Warmonger at 15:29, 18 Jan 2009.

Quote:
The function that you said "StartCombat" appears to only allow me to add creatures to the defending player

Fiist of all it allows you to run combat script, which is something different than map script and stored in a separate file you have to create.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Uncle_Zhuge
Uncle_Zhuge

Tavern Dweller
posted January 18, 2009 03:34 PM

Quote:
Quote:
The function that you said "StartCombat" appears to only allow me to add creatures to the defending player

Fiist of all it allows you to run combat script, which is something different than map script and stored in a separate file you have to create.

Wow... So there is a map script and a combat script to code?? This thing is even tougher than I thought.

Maybe someone can just help me out with this trigger by telling me what to type. I am just getting headaches figuring out what to type...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted January 18, 2009 03:41 PM
Edited by Warmonger at 15:42, 18 Jan 2009.

1.Click a creature or a static hero you want to fight against.
2.Find "combat script" property.
3.Click "new"
4.Voila! You can edit it.

For the reference check data\data.pak\scripts diectory or original campaign maps.

This script will trigger automatically when the army is attacked.

With StartCombat function you may trigger any other scipt, for example in a building or timed event. Unfortunatelly I din't use it yet so you have to try it on your own.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Uncle_Zhuge
Uncle_Zhuge

Tavern Dweller
posted January 18, 2009 09:01 PM

Alright, so I found the data for the Sovereign fight. But when I did what you said, it still doesn't work. I tried configuring, copying and pasting and nothing works. This is what I did:

1. Put Biara (Player 1) as hero for player 1.
2. Put Ghost (Player 2) as hero for player 2.
3. Edit Biara's Combat Script and insert the following inside:


function Prepare()
   EnableCinematicCamera(nil);
   sleep(15);
end

function Start()
   EnableAutoFinish(nil);
   sleep(20);
   AddCreature(DEFENDER, 28, 2, 12, 3);
   sleep(20);
   AddCreature(DEFENDER, 28, 2, 12, 12);
   sleep(20);
   AddCreature(DEFENDER, 28, 2, 12, 8);
   sleep(20);


   AddCreature(DEFENDER, 23, 35, 13, 5);
   sleep(20);
   AddCreature(DEFENDER, 22, 25, 13, 10);
   sleep(20);
   EnableCinematicCamera(not nil);
end

Yet when I start the game, I tried making Player 1 attack player 2, doesn't work. I let Player 2 attack Player 1 and it still doesn't work. I changed the AddCreature to the original SummonCreature that is used in the script for the Sovereign fight and it still doesn't work. No creatures were summoned whatsoever.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Asheera
Asheera


Honorable
Undefeatable Hero
Elite Assassin
posted January 18, 2009 09:20 PM

If you have the console you can check what error it gives.

Try writing 1 instead of "DEFENDER"

Like:

AddCreature(1, 28, 2, 12, 3)
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Uncle_Zhuge
Uncle_Zhuge

Tavern Dweller
posted January 19, 2009 05:27 AM

Ok, I think I know why none of the commands work. Apparently I have been playing the map in multiplayer and it disables all combat script commands. X_X I tried it in single player and it worked.

By the way, is there any way to do this same thing for multiplayer games as well?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Asheera
Asheera


Honorable
Undefeatable Hero
Elite Assassin
posted January 19, 2009 02:12 PM

In Multiplayer all scripts are disabled except the Map Script. That's most probably a flaw in their design (since pre-TotE all scripts were disabled in multi, and they enabled the Map Script but forgot about the others)

I have a theory (never tested so not sure if it works) for an alternative to do it manually. You have to disable the normal interaction with the monster, then set a trigger to take action when you interact with the monster and use combat starting functions when that event triggers. All of this in the Map Script (that works in the multiplayer mode as well)

Example:

function Combat1(hero, monster)
  -- start combat and do other custom combat things here
end

function Combat2(hero, monster)
  -- likewise
end

-- and so on until last custom monster combat function


for i = 1, numMonsters do
  SetObjectEnabled("Monster"..i, nil)

  Trigger(OBJECT_TOUCH_TRIGGER, "Monster"..i, "Combat"..i)
end


In that example numMonsters is obviously the number of monster objects on the map, and they must be named like "Monster1", "Monster2", and they should be consecutively.
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
alduen
alduen

Tavern Dweller
posted June 20, 2009 06:20 AM

I need some help with a script function for hero teleporting. I have a map which has "dungeon crawls" in it. so I'm attempting to use other object other than the typical gateways or stairwells to move heroes to other points on the map.

I've tried on-touch and a small 2 square zone mark by the object to teleport and it doesn't seem to work out. I'd also like to add a conformation msg to the function "would you like to enter yes/no" if possible.

I know some C+ but the specific commands for heroes elude me on this, if they are even possible.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
mirthless_one
mirthless_one

Tavern Dweller
posted June 21, 2009 07:01 PM
Edited by mirthless_one at 19:11, 21 Jun 2009.

Quote:
In Multiplayer all scripts are disabled except the Map Script. That's most probably a flaw in their design (since pre-TotE all scripts were disabled in multi, and they enabled the Map Script but forgot about the others)

I have a theory (never tested so not sure if it works) for an alternative to do it manually. You have to disable the normal interaction with the monster, then set a trigger to take action when you interact with the monster and use combat starting functions when that event triggers. All of this in the Map Script (that works in the multiplayer mode as well)

Example:

function Combat1(hero, monster)
  -- start combat and do other custom combat things here
end

function Combat2(hero, monster)
  -- likewise
end

-- and so on until last custom monster combat function


for i = 1, numMonsters do
  SetObjectEnabled("Monster"..i, nil)

  Trigger(OBJECT_TOUCH_TRIGGER, "Monster"..i, "Combat"..i)
end


In that example numMonsters is obviously the number of monster objects on the map, and they must be named like "Monster1", "Monster2", and they should be consecutively.


Unfortunately, you idea does not seem to work.
I've contacted Nival developer and he said that they disabled combat scripts in multiplayer on purpose, because they coudn't overcome desync problems.

Somewhere (can't remember where) i heard a guy mentioned a way to make game treat multiplayer game as a single player thou allowing all script types execution, but it might just be a hoax.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Mirthless
Mirthless

Tavern Dweller
posted July 07, 2009 10:51 PM
Edited by Mirthless at 22:52, 07 Jul 2009.

Hi, wanted to ask if someone tried to use HERO_TOUCH_TRIGGER introduced in 3,1 ToTe patch in multiplayer game.
For me it causes disconects or game crashes often enought to make script unusable in real game.
(Script does the following: Trigger catches the moment when two heroes meet, modifies heroes parameters and finally starts standart interaction.).
What do you think. How could i better synchronize it in multiplayer or probably avoid using it for described task?


And the other thing. Has someone been able to remove huge slowdown on big maps when using AddObjectCreatures/AddHeroCreatures commands?

Any reply would be greatly appreciated.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Seiat
Seiat


Hired Hero
posted July 08, 2009 11:33 PM
Edited by Seiat at 02:05, 09 Jul 2009.

I'm just starting out on map scripting for heroes 5... reminds me of Dungeon Keeper scripting, but more features and no real pointers X.X

Does anyone have any idea how I can implement special effects (like haste/weakness/etc.) to either the hero creatures or the enemy creatures when a battle begins? I've tried a couple things but it didn't work. Any suggestions?
P.S. if you suggest I quit map scripting you will be subject to evil nasty spam in ur e-mail


Better yet, does anyone know how to change a map from Single player to Multi player so I don't have to mess around with scripting? lolz

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 4 pages long: 1 2 3 4 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0551 seconds