I have checked this out a bit, and most of it seems fairly straightforward. However, there are a few aspects I am a bit unsure about.
1. Is there a quick way to learn the scripting language syntax? This would be of great help. I am no newbie to programming (in fact, I study computer science at university, and I have made a heavily scripted map for Heroes IV), but this language hardly seems well-documented. While there is an Acrobat file documenting various functions, it seems unclear how to place them in a syntax. It also seems unclear how to arrange a script in such a way that a triggering event on the map (town changing owner, hero entering region, hero/monster defeated etc.) causes other things to happen.
2. Are object scripts handled on the objects themselves or in the map script.
3. How are victory and defeat conditions (such as whether a player who has no town for a consecutive 7 days will automatically lose) managed? Is there a way to deactivate the standard victory conditions? I suspect this may somehow be done via scripting, but how.
4. Can campaigns with carryover hero(es) be made in this game? If so, how?
Any help would be greatly appreciated.
A few questions about the Heroes V map editor...
- Mace the Councillor
- Peasant
- Posts: 57
- Joined: 06 Jan 2006
- Location: Sweden
As far as I know there is no manual for that.Mace the Councillor wrote: 1. Is there a quick way to learn the scripting language syntax?
Which "object scripts" you mean? Most of them can be defined in main map script. But combat, for example, goes into a separate file.2. Are object scripts handled on the objects themselves or in the map script.
You can deactivate the standart win and lose (Game properties tree, under objectives). With scripts you can make any conditions to give a victory or loss.3. How are victory and defeat conditions (such as whether a player who has no town for a consecutive 7 days will automatically lose) managed? Is there a way to deactivate the standard victory conditions? I suspect this may somehow be done via scripting, but how.
Campaign editor is officially not there (if not with HoF). Some once showed a screen of map linking tool (re-enabled by a editor modification) but dunno its functionality.4. Can campaigns with carryover hero(es) be made in this game? If so, how?
And finally, scripts only work on singleplayer maps.
Avatar image credit: N Lüdimois
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
Re: A few questions about the Heroes V map editor...
Go through the mapmaker guide--the practical guide (tutorial) and the theoretical guide.Mace the Councillor wrote:I have checked this out a bit, and most of it seems fairly straightforward. However, there are a few aspects I am a bit unsure about.
1. Is there a quick way to learn the scripting language syntax? This would be of great help. I am no newbie to programming (in fact, I study computer science at university, and I have made a heavily scripted map for Heroes IV), but this language hardly seems well-documented. While there is an Acrobat file documenting various functions, it seems unclear how to place them in a syntax. It also seems unclear how to arrange a script in such a way that a triggering event on the map (town changing owner, hero entering region, hero/monster defeated etc.) causes other things to happen.
Look here for LUA scripting:
http://www.lua.org/manual/5.1/manual.html#2.4.5
http://lua-users.org/wiki/
http://www.wowwiki.com/Lua_functions
Look at maps that have a lot of scripting. My map "Seize The Throne" has over 1100 lines of script. It is heavily commented. Find it here
Most scripts will be handled in the map script. Some things like a simple quest hut can be handled on the object.Mace the Councillor wrote:2. Are object scripts handled on the objects themselves or in the map script.
viewtopic.php?t=4058
See "Seize The Throne" scripting for examples of scripting in the map script that deals with objects being touched (like dwellings, fairy rings, and a statue.)
Under the map properties tree you will find "objectives." I believe that you can alter the win/loss conditions there. You can also do it throught scripting. In "Seize The Throne" the player loses if he loses his starting heroe. I used scripting to program that.Mace the Councillor wrote:3. How are victory and defeat conditions (such as whether a player who has no town for a consecutive 7 days will automatically lose) managed? Is there a way to deactivate the standard victory conditions? I suspect this may somehow be done via scripting, but how.
It was not possible to make campaigns with the editor in version 1.3 I have not yet played around with the editor since HOF was released, so I don't know if it is possible now.Mace the Councillor wrote:4. Can campaigns with carryover hero(es) be made in this game? If so, how?
GOW
Mod note: please make sure to place long URL:s in URL tags, so as to not disrupt the layout of the forums and cause them to stretch beyond all limits. Thank you. GC
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
- Mace the Councillor
- Peasant
- Posts: 57
- Joined: 06 Jan 2006
- Location: Sweden
Thanks for the reply!
GOW, thanks for your reply, too!
I have downloaded your map and will check its scripts. I may have to play it first though, as maps get kind of spoiled if one looks at them in the editor, and besides, it is easier to understand scripts after one sees what they do in the game.
Towns, garrisons, heroes, monsters, dwellings and mines, I meant. Checking again, I can see that all except for heroes and mines have their own separate script tabs, but can objects without script tabs be scripted?Pitsu wrote:Which "object scripts" you mean? Most of them can be defined in main map script. But combat, for example, goes into a separate file.
3. How are victory and defeat conditions (such as whether a player who has no town for a consecutive 7 days will automatically lose) managed? Is there a way to deactivate the standard victory conditions? I suspect this may somehow be done via scripting, but how.
Thanks, I found it!Pitsu wrote:You can deactivate the standart win and lose (Game properties tree, under objectives). With scripts you can make any conditions to give a victory or loss.
Is this a feature that can be downloaded, and if so, where?Pitsu wrote:Campaign editor is officially not there (if not with HoF). Some once showed a screen of map linking tool (re-enabled by a editor modification) but dunno its functionality.
Thanks! I didn't know that.Pitsu wrote:And finally, scripts only work on singleplayer maps.
GOW, thanks for your reply, too!
I have downloaded your map and will check its scripts. I may have to play it first though, as maps get kind of spoiled if one looks at them in the editor, and besides, it is easier to understand scripts after one sees what they do in the game.
My advice to learn with the scripts is to start making a map, a test map, and start using some basic scripts. To start adding them just open the map properties window, go to the script tab and start editing. This is some basic knowledge about how scripts work:
- Every line of code you add is executed inmediately when the map begins, except for functions (they have to be called).
- Triggers allow you to execute code when some conditions are met. The conditions are automatically checked by the script system, (I guess every trigger has a thread asociated with it that makes that work for you). That's one of the first things you have to look at the list of script functions in the editor manual.
- You can use more than one thread, (there is a specific script for that). With another thread you can do things like repetitive checks (is it the computer turn?, if not sleep(1) and ask again), whithout interfering with your main execution thread. As far as I know, triggers affect all the threads, (you can't set a new day trigger for a thread, and one different for another).
- As far as I know, variables don't have to be declared and are global by default. Just like var1 = 6;
- .. is used to concatenate strings. == is the equals check, ~= is not equal, (the relational are the ussual <, >, >=...), = is used to asign values to variables.
- A string use " or ', ("string1", 'string2').
If you have problems with the basic language, take a look at this reference manual.
- Every line of code you add is executed inmediately when the map begins, except for functions (they have to be called).
- Triggers allow you to execute code when some conditions are met. The conditions are automatically checked by the script system, (I guess every trigger has a thread asociated with it that makes that work for you). That's one of the first things you have to look at the list of script functions in the editor manual.
- You can use more than one thread, (there is a specific script for that). With another thread you can do things like repetitive checks (is it the computer turn?, if not sleep(1) and ask again), whithout interfering with your main execution thread. As far as I know, triggers affect all the threads, (you can't set a new day trigger for a thread, and one different for another).
- As far as I know, variables don't have to be declared and are global by default. Just like var1 = 6;
- .. is used to concatenate strings. == is the equals check, ~= is not equal, (the relational are the ussual <, >, >=...), = is used to asign values to variables.
- A string use " or ', ("string1", 'string2').
If you have problems with the basic language, take a look at this reference manual.
Every object has a name field in the object properties tree. You can use that name in your scripts, so yes, every object is subject to be used by a script.Mace the Councillor wrote:Checking again, I can see that all except for heroes and mines have their own separate script tabs, but can objects without script tabs be scripted?
No, you can't download any campaign editor but I guess it will be enabled in next patches.Mace the Councillor wrote:Is this a feature that can be downloaded, and if so, where?
- Mace the Councillor
- Peasant
- Posts: 57
- Joined: 06 Jan 2006
- Location: Sweden
Thanks to you too, Vitirr!
After taking a look at the scripts GOW's Seize the Throne map (I gave up playing it first because, unfortunately, it lagged too much on my computer), I figured most of this out myself. However, I tried to make a script for an ambush, where a hero gets attacked for entering a region. It didn't work. "Ambush" is a region, and a function that is supposed to start a fight. It says "Function Ambush not defined, line 3." (line 3 is the one "function Ambush(heroname)") when I click the Check-button. If anyone can help me tell what I did wrong, I'd very strongly appreciate it.
Neither does the line (which is not inside a function, by the way)...
...start the fight I was hoping it would when the map opened in the game. "Oddrema" is the "Script name" found under the Settings tab in the hero's properties window.
After taking a look at the scripts GOW's Seize the Throne map (I gave up playing it first because, unfortunately, it lagged too much on my computer), I figured most of this out myself. However, I tried to make a script for an ambush, where a hero gets attacked for entering a region. It didn't work. "Ambush" is a region, and a function that is supposed to start a fight. It says "Function Ambush not defined, line 3." (line 3 is the one "function Ambush(heroname)") when I click the Check-button. If anyone can help me tell what I did wrong, I'd very strongly appreciate it.
Code: Select all
function Ambush(heroname)
StartCombat(heroname, 1, 2, 10)
end;
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,"Ambush","Ambush");
Code: Select all
StartCombat("Oddrema",1,2,10)
I haven't still used the start combat script so I don't know if you have used it properly, (don't you have to use nil for enemy hero if you want fight only neutrals for example?). The function not defined error is normal. It will say that for all your defined functions.
So if it doesn't work it must be something you did wrong with the start combat script.
So if it doesn't work it must be something you did wrong with the start combat script.
- Mace the Councillor
- Peasant
- Posts: 57
- Joined: 06 Jan 2006
- Location: Sweden
- Mace the Councillor
- Peasant
- Posts: 57
- Joined: 06 Jan 2006
- Location: Sweden
use this code for what you want to do.Mace the Councillor wrote:Thanks to you too, Vitirr!
After taking a look at the scripts GOW's Seize the Throne map (I gave up playing it first because, unfortunately, it lagged too much on my computer), I figured most of this out myself. However, I tried to make a script for an ambush, where a hero gets attacked for entering a region. It didn't work. "Ambush" is a region, and a function that is supposed to start a fight. It says "Function Ambush not defined, line 3." (line 3 is the one "function Ambush(heroname)") when I click the Check-button. If anyone can help me tell what I did wrong, I'd very strongly appreciate it.
Neither does the line (which is not inside a function, by the way)...Code: Select all
function Ambush(heroname) StartCombat(heroname, 1, 2, 10) end; Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,"Ambush","Ambush");
...start the fight I was hoping it would when the map opened in the game. "Oddrema" is the "Script name" found under the Settings tab in the hero's properties window.Code: Select all
StartCombat("Oddrema",1,2,10)
at the top put
Code: Select all
name=GetPlayerHeroes(1);
check_assassins=0
check_ambush=0
function s_2() -- further down in your code put this function
while 1 do
if IsPlayerHeroesInRegion(PLAYER_1,"assassins") and check_assassins==0 then
BlockGame();
StartCombat( name[0], nil, 2, 113, 43 , 113, 55, nil, nil); -- here we have mob type 113 and there are 43 of them and mob type 113 and 55 of them
check_assassins=1
LevelUpHero("Ingvar"); -- from here you can give hero stats creatures etc..
--ChangeHeroStat("Ingvar", 0, 6000); -- decided he was not worthy of more experence
ChangeHeroStat("Ingvar", 1, 6); -- upgraded attack to help next fight
ChangeHeroStat("Ingvar", 2, 7); -- upgraded defence to prevent loseing next fight
UnblockGame();
MessageBox ("Maps/SingleMissions/Ashers World one/training3.txt"); this code from my Ashers World series..
break;
else sleep(1) need this incase the code breaks for any reason.
end;
end;
end;
Who is online
Users browsing this forum: No registered users and 1 guest