0% found this document useful (0 votes)
39 views

scripting2.01

The document is a guide for scripting in Heroes of Might and Magic V, specifically for the expansions Hammers of Fate and Tribes of the East. It covers various aspects of scripting, including syntax, variables, functions, triggers, and debugging, aimed at enhancing the gameplay experience through custom scripts. Additionally, it provides a table of contents outlining the structure and key topics of the guide.

Uploaded by

TuanHung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

scripting2.01

The document is a guide for scripting in Heroes of Might and Magic V, specifically for the expansions Hammers of Fate and Tribes of the East. It covers various aspects of scripting, including syntax, variables, functions, triggers, and debugging, aimed at enhancing the gameplay experience through custom scripts. Additionally, it provides a table of contents outlining the structure and key topics of the guide.

Uploaded by

TuanHung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Hero IDs

SCRIPT FILE LAYOUT


SYNTAX
VARIABLES
FUNCTIONS
TRIGGERS
DEBUGGING
HERO IDs
OTHER IDs

The Basics of Heroes V Scripting


Version 2.01 – for Heroes V, Hammers of Fate and Tribes of the East

1
Version 1.0 © Celestial Heavens, 2007
Version 2.0 © Celestial Heavens, 2008
Version 2.01 © Celestial Heavens, 2008

Version 1.0 of The Heroes V Scripting Guide, for Heroes 5


was written for Celestial Heavens by Pitsu

Proofreading and constructive criticism


by Grumpy Old Wizard, Gaidal Cain and Robenhagen

Version 2.0 of The Heroes V Scripting Guide


for the Tribes of the East expansion
is an update of Version 1.0 by rdeford, Mage of Soquim

Proofreading and constructive criticism by Pitsu and Robenhagen

Layout: Robenhagen

If you have feedback, questions or comments, please contact us at:


[email protected]
or post at the relevant topic on The Heroes Round Table:
http://www.celestialheavens.com/forums/viewforum.php?f=8
Foreword

Scripting your maps is a way to make them more interesting, describe all the individual script functions, since they already
and personal. Also, scripting allows you to control the course of are quite well covered in official materials. But, it does cover the
the game to a much greater extent than you can with even the details of SCRIPT writing: the syntax, how to build a custom
most creative terrain building. The Heroes of Might and Magic function and set triggers properly. However, even with this guide
Editor (game patch 1.3 or later, or either the HOF or ToTE and the official editor documentation at hand, be ready to expe-
expansions required) allows you to add scripting to your maps. rience a little frustration when doing you first scripts ☺. Luckily,
However, even though the game folder contains documentation there are online forums where other people can help you during
for the using the Editor and describes the commands and script the darkest hours. I must admit that, without people asking for
functions required to create scripts, it is easy to get lost when help and without other mapmakers demonstrating their neat so-
opening the script editing window and seeing the blank white lutions, this little guide could not have been written. My thanks
page. Just what are you supposed to write there, and is there a to all the regulars of Round Table Mapmaking guild!
special format or syntax for doing it?
This humble guide is meant as a supplementary material Wishing you good luck with scripts,
for the official editor documentation. For example, it does not Pitsu
OTHER IDs HERO IDs DEBUGGING TRIGGERS FUNCTIONS VARIABLES SYNTAX SCRIPT FILE LAYOUT Hero IDs

4
Table of Contents

1. Script file layout ................................................ 4

2. Syntax ....................................................... 5
2.1. Empty lines, semicolons, and the number of spaces . . . . . . . . . . . . . . . . . . 5
2.2. Case sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3. Quotation marks and their use 5
2.3.1. Use No Quotes When . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3.2. Use Quotes When . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3.3. Example script for quotes usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4. How to create and refer to text files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4.1. Displaying variables within message text . . . . . . . . . . . . . . . . . . . . . 6
2.5. How to refer to map objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6. How to refer to heroes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.7. Meaning of some symbols and special commands . . . . . . . . . . . . . . . . . . . 7

3. Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1. Variable types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.1. Local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.2. Global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.3. Game variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1. Defining functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2. IF .. THEN, WHILE.. DO etc. blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3. How many “end;”s does there have to be? . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4. Function fname() or function fname(parameter) . . . . . . . . . . . . . . . . . . . . 11
4.5. Special functionName(heroName) functions . . . . . . . . . . . . . . . . . . . . . . . 12
4.6. Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5. Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.1. Instant triggering of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.2. Binding functions to map events and objects . . . . . . . . . . . . . . . . . . . . . . 14
5.3. Triggering fname(parameter) type of functions . . . . . . . . . . . . . . . . . . . . . 15
5.4. Removing a trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6. Hints for debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1. Enabling the console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2. Using the print() command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.3. My script does not run! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.4. My script runs but doesn’t do what I want . . . . . . . . . . . . . . . . . . . . . . . . . 17

7. Internal hero ID names needed for scripts . . . . . . . . . . . . . . . . . . . 18

8. Other IDs Needed For Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20


8.1. Logical constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.2. Player IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.3. Player states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.4. Floor names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.5. Kinds of resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.6. Kinds of treasures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.7. Date type IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.8. Advmap predefided names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.9. Advmap object types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.10. Hero stat`s IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.11. Objective state`s IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.12. Artifact sets IDs (for basic artifact sets). . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8.13. Artifact type IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8.14. Skill type IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.14.1. Basic Skills. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.14.2. Class skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15. Perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.1. Knight perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.2. Demonlord perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.3. Necromancer perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.4. Ranger perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.5. Wizard perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.15.6. Warlock perks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2
8.16. Feats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.16.1. Knight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.16.2. Demon Lord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.16.3. Necromancer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.4. Ranger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.5. Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.6. Warlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.7. Runemage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.8. Runmage & Barbarian (cross-class) . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.16.9. Barbarian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.17. Town type IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.18. Town buildings IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.19. Monster mood IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.20. Monster courage IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.21. Borderguard key colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.22. Trigger type IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.23. Saved combat results types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.24. Custom abilities IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.25. Custom abilities modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.26. Moon weeks (for GetCurrentMoonWeek adventure script function) . . . . . 25
8.27. Animation Action Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.28. Disabled interactive objects modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.29. Region Auto Action modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.30. Region Auto Action enable variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.31. Heroes Roles Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.32. Players Teams constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.33. Game difficulty IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.34. Creature IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.35. War machines IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8.36. Spell IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3
Script file layout
1. Script file layout
SCRIPT FILE LAYOUT

When you create a new map and open its script file (View/Map Commands – a command is simply a complete, executable
Properties/Script tab, and click Edit Script) you see only a blank scripting statement of some kind. Most of the time com-
white sheet. When you open a heavily scripted map script file mands are user-defined or pre-defined H5 script functions,
you see quite an extensive amount of text. Is there any particu- but they can be any executable block of scripting statements
lar layout to follow? The answer is no; the various elements in consisting of any combination of Lua programming state-
the script do not have to appear in any particular order, though ments and functions.
there is a command syntax that must be adhered to. Once defined in a script, functions become commands
Depending on the style of the script writer, a script file can that can be used within the definitions of other functions
have the following things in a chaotic array or an orderly ar- in the script, or simply placed in the script outside any of its
rangement: functions.
SYNTAX

• Functions – user-defined groups of pre-defined H5 script All commands in your script that are NOT part of any
functions, commands, and Lua programming state- of the functions in your script are triggered when the map
ments. They make up the main part of the script file. is started and the script file is read the first time. In other
Basically, you must create one or more functions for words, they are executed by the game on dawn of day 1, week
each custom action or object behavior that you desire 1, month 1 before any action can be taken by the player. For
in your map. The scripts for lightly customized maps example, you may wish to show a message box that displays a
VARIABLES

may require only one or two functions, while the scripts prolog to the player before he or she begins playing.
for highly customized maps require many functions. • Comments – Comments start with double minus (double
Often it is best to split a complex function into several hyphen) -- and end with a line break. Comments are ignored
smaller functions just to have a better overview of the dif- by the game and are meant for script writer only. For ex-
ferent parts. ample, if you are afraid of forgetting the meaning of a func-
• Trigger –a specialized pre-defined defined H5 script func- tion in your script, simply add a comment to it. Also, placing
FUNCTIONS

tion that determines when a function in your script is run double minus in front of a block of statements in your script is
during the course of the game. As a general rule, you’ll find a simple way to test how your script runs without that block.
you will need to tie a particular function to a specific action For example, you may wish to see if a particular command is
taken by the player while playing the map. For example, you causing the bug you are hunting for.
may wish to display a warning message to the player when a
hero first enters a certain area on your map.
TRIGGERS
DEBUGGING
HERO IDs

Layout Example
OTHER IDs

Note the text color code shown in the example. This code helps a programming language. When it is red, it is a properly spelled
bit to avoid spelling and other mistakes. When it is green (com- pre-defined H5 script function. Text between a pair quotation
ment), you can write anything, it is ignored by the game. When marks (parameter names) is orange. The rest is black.
it is blue, it is a number or has a certain meaning for the Lua

4
Syntax
2. Syntax

SCRIPT FILE LAYOUT


2.1. Empty lines, semicolons, Example
and the number of spaces function blabla()
Each end; has to have a semicolon, and, although it is not a MessageBox("Maps/SingleMissions/test/
must, I recommend that you place a semicolon at the end of each blah.txt");
line except the ones that start with function, if, else, end;
while, for, or repeat. function day2()
You could write all the script in one row without any new if GetDate(DAY)== 2 then
lines, but for better tracking, you are advised to make a separate blabla(); -- no quotes around blabla.
line for every individual command. And, for the sake of your end;
sanity, indenting lines and groups of lines to improve readability end;

SYNTAX
and make relationships clear is an excellent habit to get into.
(The Layout Example uses an excellent, systematic approach to
indenting and the use of spaces. Go forth and do ye likewise.) • Typing the names of local and global variables, which are
Breaking a long line of text into one or more lines, or adding always without quotes.
half a page of empty lines between two functions does not affect
the script’s functionality. NOTE: “Game variables,” which are accessible via SetGame

VARIABLES
Var() and GetGameVar(), are different.

2.2. Case sensitivity Example

Commands as well as variable names and map object names all function transform(townname) -- townname with-
are case sensitive. Spelling and capitalization mistakes are one of out quotes since it is a variable.

FUNCTIONS
the most common errors when a script does not run. local towntype =5; -- defining a local variable
called towntype. No quotes any-
where.
2.3. Quotation marks and their use TransformTown(townname, towntype); -- town-
name and towntype are both variables. The
Proper using of quotation marks with function names, variable value of the first is defined when the function
names, and map object names is quite confusing, but it follows a is called up (see examples below), the value of
system nevertheless. (You may need to read the function and pa- the second was set to 5 right before.

TRIGGERS
rameter descriptions in the official documentation before fully end;
understanding the samples presented here.) Also, note that there
are two types of quotes that can be used " and '. Generally it does
not matter which kind of quotation marks you use as long as the 2.3.2. Use Quotes When
starting and ending marks of each pair are the same. A specific • The name of a function, adventure map object, scenario ob-
usage example for using both types of quotes in the same line is jective etc. is a parameter for a command. In other words, use

DEBUGGING
given later on in this guide under “Triggering fname(parameter) quotes for everything that is inside parenthesis and is a name
type of functions”. of a function, message text file, hero, adventure map object, or
scenario objective.
2.3.1. Use No Quotes When
• Declaring a function: Example

Example: function blabla()


if GetDate(DAY)== 2 then
HERO IDs

function blabla() -- blabla is without quotes. MessageBox("Maps/SingleMissions/


MessageBox("Maps/SingleMissions/test/ test/blah.txt"); -- quotes required for the
blah.txt"); text file name.
end; end;
end;
Trigger(NEW_DAY_TRIGGER, "blabla"); -- quotes
• Typing numbers and the pre-defined H5 “all capital letters” required for function blabla name
OTHER IDs

parameters (like NEW_DAY_ TRIGGER or PLAYER_1 ).

• The function name acts as a command. Namely, each func- • Calling up or saving game variables. (See official documenta-
tion that you write can be called up in the same way as the tion for examples.)
pre-defined H5 script functions.

5
Syntax
2.3.3. Example script for quotes usage 11. Click OK.
SCRIPT FILE LAYOUT

Suppose you have a map with towns that have the script names A blank text entry window appears.
town1 and town2. (In order to refer to an object on your map 12. Type your message text.
from within your script, you must give the object a script name 13. Click OK and then Yes to save.
in its properties window.) Then further suppose that you desire
to change town1 to an Academy upon capture. As script code To refer to a text file you must provide the full path starting
goes, this example is unnecessarily long, but it shows quotes us- from Maps directory. (This full path appears in the SaveFilena-
age quite well: meFileRef value field after you’ve created the file as described
earlier.)
function transform(townname) -- townname with-
out quotes since it is a variable Example
TransformTown(townname, TOWN_ACADEMY); Displaying a message to the player:
-- townname is a variable name and
SYNTAX

TOWN_ACADEMY is one of MessageBox("Maps/SingleMissions/MyMap/


those all-capitals game variables. textfilename.txt");
end; -- MyMap is the name of your map.
function town1capture() -- textfilename.txt is a map resource text file name you
transform("town1"); -- transform, which is the created (lavaWarning.txt, for example).
name of another function,
VARIABLES

acts as a command. It uses


parameter town1, which is the TIP: You can copy the full path in the SaveFilenameFileRef
name of one of the towns. value field and then paste it into the script when you wish to
end; refer to the file.
Trigger(OBJECT_CAPTURE_TRIGGER, "town1",
"town1capture"); -- town1 and town1capture are 2.4.1. Displaying variables within message text
FUNCTIONS

names of map object and function, CAUTION: The Descriptions given in official HoF editor
respectively. They are parameters for manuals for MessageBox() and QuestionBox() for com-
Trigger command and not variables, plex messages are misleading and erroneous. Additionally, you
thus must have quotes. cannot display variables in any 1.x game version prior to the
Hammers Of Fate expansion.

2.4. How to create and refer to text files To display the value of a numeric variable within a complex message
1. Create a resource text file for the complex message using
TRIGGERS

It is very hard for beginners to get the references to external text <value= variablename> at places where the value of the
files correct. Yet, you must learn to do it because each individual numeric variable should be displayed.
piece of text that appears during the course of playing your map
must come from a text file that you have added to the map’s Example
resources during the creation of the map. For example, you will
have to refer to a resource file that contains the text for each mes- Filename: Pillage.txt
DEBUGGING

sage box or a question box you wish the player to see. Text in file: The enemy has pillaged
<value=goldamount> gold from
To create a resource text file local villages.
1. Open the Map Properties Tree.
2. Select Resources and expand its list if necessary.
3. Select SavesFilenames. 2. In the script, the MessageBox() command for the above
4. Right click and select the Add command. example would look like:
5. Expand the SaveFilenames list if necessary.
HERO IDs

A new file placeholder appears at the end of the list. Format


6. Expand the new file placeholder if necessary.
7. Click in the value field for the Name property and type MessageBox( { "path/to/textfile";
descriptive name. variablename = value}, "optional_call-
For example: lavaWarning. back_function" );
8. Click in the SaveFilenameFileRef value field, but do not
type anything.
OTHER IDs

9. Click the New button. Example


The Create New Object dialog box appears.
10. Type a file name for the new text file. MessageBox( { "Maps/SingleMissions/MyMap/
TIP: Use the same name as you used for the Name Pillage.txt "; goldamount = 526 });
property.

6
Syntax
3. In the game the complex message displayed to the player 3. Find the Name property and click in its value field.

SCRIPT FILE LAYOUT


would look like: Two buttons, “…” and “New” appear.
4. Type a unique (to this map) name for the object.
“The enemy has pillaged 526 gold from local villages.”
TIP: Give the object a descriptive name that is easy to recog-
nize and use. For example, rockBarrier, BlackForest, or first-
To display a text variable within a complex message bridge. Notice that capitals can make long names easier to read,
1. Create a separate resource file for the text variable you wish but you do have to remember that all the names you create are
to display in the complex message. case sensitive when you use them in the script.

Example Once you’ve completed these steps for an object, you can use its
scripting name to refer to the object.
Filename: JonnyBlackeye.txt

SYNTAX
Text in file: Jonny Blackeye CAUTION: Giving the same, identical name to two or more
objects, will not cause an error message right away, but the script
will eventually crash when run.
2. Create a resource text file for the complex message, using
<value=variablename> at places where variables should be
displayed. 2.6. How to refer to heroes

VARIABLES
Example Referring to heroes must be done by their internal H5 ID. You
can give them a scripting name as described earlier, but scripts
Filename: Pillage.txt do not recognize those names, nor do scripts recognize the
Text in file: <value=name> has pillaged standard game names.
<value=goldamount> gold from

FUNCTIONS
local villages. To find a hero’s internal ID
1. Open the Map Properties Tree
2. Select the hero on the map (may be a temporary placement
3. In the script, the MessageBox() command for the above of the hero).
example would look like: The hero’s property list appears in the Map Properties
Tree
Example 3. Find the Shared property and click in its value field.
Two buttons, “…” and “New” appear.

TRIGGERS
MessageBox( { "Maps/SingleMissions/ 4. Click on the “…” button.
MyMap/Pillage.txt "; name = "Maps/ The Browse Object Link screen appears. A specific hero
SingleMissions/MyMap/JonnyBlackeye.txt", will be selected in the left window, and list of that hero’s
goldamount = 526 }); Properties will appear in the right window.
5. Find the InternalName property in the right window, and
make note of the value, for it is the internal H5 ID for the

DEBUGGING
Notice that commas separate the elements in the variable list hero.
inside the {}. 6. Close the Browse Object Link screen without making any
changes to the values.
4. In the game the message displayed to the player it would
look like: If this procedure seems too complicated for you, then simply
refer to the “Internal hero ID names needed for scripts” section
“Jonny Blackeye has pillaged 526 gold from local villages.” towards the end of this guide.
HERO IDs

2.5. How to refer to map objects 2.7. Meaning of some symbols


To refer to map objects other than heroes, you must give each
and special commands
object a unique scripting name. The Lua programming language that is used in conjunction
with the H5 script functions to create your scripts uses several
To give an object a scripting name symbols and provides a few special commands:
OTHER IDs

1. Open the Map Properties Tree.


2. Select the object on the map.
The object’s property list appears in the Map Properties
Tree.

7
Syntax
Symbol or Command Description
SCRIPT FILE LAYOUT

= Assignment
Assigns a value to a variable.

Example
m = 2, means that henceforth the variable m has a value of two.
== Equality
Compares a value on the left with the value on the right to see if they are equal.
(Relational operator, returns true or false.)

Example
Where: x =2 y = 3
SYNTAX

x == y would return false.


< Less than
Compares a value on the left with the value on the right to see
if the left value is less than the right value.
(Relational operator, returns true or false.)
VARIABLES

> Greater than


Compares a value on the left with the value on the right to see
if the left value is greater than the right value.
(Relational operator, returns true or false.)
<= Less than or equal
Compares a value on the left with the value on the right to see
FUNCTIONS

if the left value is less than or equal to the right value.


(Relational operator, returns true or false.)
>= Greater than or equal
Compares a value on the left with the value on the right to see
if the left value is greater than or equal to the right value.
(Relational operator, returns true or false.)
TRIGGERS

~= Not equal
Compares a value on the left with the value on the right to see if they are not equal.
(Relational operator, returns true or false.)

Example
Where: x =2 y = 3
DEBUGGING

x ~= y would return true.


and Logical AND
Between two relational comparisons, means that both tests must be true in order to proceed.

Example
Where: x =2 y = 3
(x == 2 and y == 3) would return true.
HERO IDs

or Logical OR
Between two relational comparisons, means that either of the tests can be true in order to proceed.

Example
Where: x =2 y = 3
(x == 4 or y == 3) would return true.
OTHER IDs

nil A special, unique value generally meaning “none”. A global variable has a nil value by default
before a first assignment. You can use nil as a kind of non-value, to disable a trigger by setting
its target to “nothing.”
In an equality test, only nil is equal to nil.

8
Syntax
.. String concatenation operator (two dots)

SCRIPT FILE LAYOUT


Joins two strings together. If any of its operands is a number,
the string concatenation operator converts that number to a string.

Example
Where x = 8
“Mine”..x results in the string “Mine8”
random(nTop) Arithmetic function
Returns a random number from zero to the nTop - 1.

Example
Random(6)
Returns a random in the range of 0 to 5.

SYNTAX
mod(x, y) Arithmetic function
Returns the remainder from dividing the number x by the number y.
Both arguments must be numbers (not necessarily whole).
The second argument must be not equal to zero.

VARIABLES
Example
Mod(42, 7)
Returns: 0
+ Addition
Adds the number on the left to the right

FUNCTIONS
Example
Where: x =2 y = 3
x + y results in 5
- Subtraction

Example
Where: x =2 y = 3

TRIGGERS
x - y results in -1
* Multiplication

Example
Where: x =2 y = 3

DEBUGGING
x * y results in 6
/ Division

Example
Where: x =3 y = 2
x / y results in 1.5
HERO IDs
OTHER IDs

9
Variables
3. Variables
SCRIPT FILE LAYOUT

A variable is a container in your script with a name and a value. It 3.1.2. Global variables
can have different values while the script is run. Do not confuse In actual scripting, global variables are used more than the other
variable names with function names and names of adventure types of variables. You do not have to define them prior use. The
map objects, scenario objectives, file names, etc. Variable names first time you use a variable name outside of a function and give
are used and handled differently from these other names. When it a value, you have defined a global variable. From then on, it
in doubt as to whether a name refers to a variable or not, check can be used at any place in the script file. However, for keeping
to see if there is a function with the same name, or an adventure better track of them and avoiding potential errors where you use
map object or scenario objective with a scripting name that is the a variable before giving it a value, you may wish to define them
same. If there is not, it is most likely a variable name. at the start of a script file and give them an initial value of the
correct type.
SYNTAX

3.1. Variable types Example

There are three types of variables based on their accessibility. bankAccount = 0; -- defines a numerical type global
1. Local variables are accessible only from inside a particular value named bankAccount and
function. assigns it a value of zero.
VARIABLES

2. Global variables accessible from anywhere in the script.


3. Game variables special-use global variables that are for mainHero = "Aberrar"; -- defines a string type global
transferring variables from one script file to another variable named mainHero and
(in cases when a map has more than one script file). assigns it a value of Aberrar.

You can transfer the values from one type to another.


FUNCTIONS

3.1.3. Game variables


Example Game variables are required for transporting variable values
between script files. For example if you have a separate combat
local m = GetGameVar("temp.gamevar1"); script file along with the general map script, and you want to use
the value of a variable in the main script in the combat script,
then you would have to define and use a game variable.
Assigns the value of a game variable to a local variable.
Example
TRIGGERS

3.1.1. Local variables


Local variables are defined with the Lua local programming Main script:
statement. They work only within the function where they are
defined, and you can use the same local variable name in several SetGameVar("variablename",value)
different functions. There are specific cases when it is best to
use local variables, but you can usually get by with just global
DEBUGGING

variables. Combat script:

Example xValue = GetGameVar("variablename")

function day2()
local day =2; -- defines a local variable with value 2
if GetDate(DAY)== day then -- comparison
returns true on day two.
HERO IDs

blabla();
end;
end;

function day3() -- another function in the same script


file
if GetDate(DAY)== day then -- error, since
OTHER IDs

variable “day” does not exist


in this function.
blabla();
end;
end;

10
Functions
4. Functions

SCRIPT FILE LAYOUT


4.1. Defining functions 4.2. if … then, while … do etc. blocks
Functions are the main part of a script file. Each function is The basic most common types of code blocks are briefly de-
essentially a group of H5 script functions and user-defined func- scribed below. However, Lua, the language that Heroes 5 uses, is
tions with Lua programming statements to determine the order more powerful than this brief description indicates. In order to
in which those H5 script functions are executed. learn the other possibilities of these and other Lua commands,
The pre-defined H5 script commands that are available for refer to the Lua manual found at (http://www.lua.org/pil/).
your use are defined in the HOMM5_A2_Script_Functions.pdf,
which is located in: Program Files\Ubisoft\Heroes if boolean_test then
of Might and Magic V - Tribes of the East\ commands;
Editor Documentation. end;

SYNTAX
You will use these pre-defined commands and Lua program- if boolean test then
ming statements to define your own functions. You will likely commands;
have to define many functions if your map is to be customized else
to any great degree. commands;
end;
Simpler user-defined functions look like this: while boolean test do

VARIABLES
commands;
function function_name() end;
commands_of_your_choice; for variable name = start_value, end_value do
end; commands;
end;
repeat

FUNCTIONS
More complicated user-defined functions can have different commands;
blocks. For example: until boolean test

function function_name()
commands_that_run_always_when_the_ 4.3. How many “end;”s
function_is_triggered;
if boolean_test then
does there have to be?
commands_that_run_only_if_boolean_ An “end;” is required for each “block” that is started with:

TRIGGERS
test_returns_true;
end; · function
again_commands_that_run_always_when_the_ · if … then
function_is_triggered; · if … then … else
end; · while … do
· for … do

DEBUGGING
And, you can have blocks within other blocks: Everything that is between an above listed command and its
respective end; statement forms a block, and all the commands
function function_name() in that block are run or none of them are run. See the examples
commands_that_run_always_when_the_ under the general description of functions.
function_is_triggered; One block that does not require “end” is:
if boolean_test then
commands_that_run_only_if_boolean_ repeat
HERO IDs

test_returns_true; commands;
if boolean_test2 then until boolean test;
commands_that_run_only_if_
boolean_test_and_boolean_ test2_
BOTH_return_true; 4.4. Function fname() or
end;
function fname(parameter)
OTHER IDs

end;
end; Imagine a situation where you have several objects which trigger
similar functions. For example, suppose your map had several
NOTE: The map Editor’s Check Map and Check commands towns that are converted to another town type upon capture.
give you an ERROR “function xxx not defined” for each user- You could write a specific function for each town, but you could
defined function. This error is meant only to confuse and scare also write a general function and specify the town that has to be
you. Ignore it. changed in the trigger for that function.

11
Functions
To write such a general function, you define variables in pa- 4.5. Special functionName(heroName)
functions
SCRIPT FILE LAYOUT

renthesis after the function name. You can have more than one
such variable there, separated by commas, if needed.
Heroes have a special relationship with functionName
Example (parameter) type of functions. Namely, one does not need
The general function looks like this: to specify the specific hero to which a generic function applies.
The ID of the currently selected hero who triggered the script is
function transform(townname) used as the value for what ever parameter name is used inside the
TransformTown(townname, TOWN_ACADEMY); parenthesis when the function is defined.
end;
Examples

When calling transform() you must specify a value for function blockHero(heroName) -- the script will
SYNTAX

the “townname” parameter, which is used like a local variable use the ID of the current hero as the
within the transform() function. Lets say the town script value of the heroName parameter.
names are town1 and town2. if HasArtefact(heroName, 2 ) then -- tests
When you trigger this function by calling: whether current hero (whose ID is in the
heroName variable) has artefact number 2
transform("town1"); SetRegionBlocked("passage",not nil,
VARIABLES

PLAYER_3);
end;
The townname parameter in the TransformTown() func- end;
tion is given value “town1” and the general function trans
form() is understood as:
The parameter can have any name you wish. Just remember that
FUNCTIONS

function transform() you must use that same name as the name of the variable within
TransformTown("town1", TOWN_ACADEMY); the commands in the function.
end;
function blockHero(xxx) -- the script will use the
ID of the current hero as the value of the xxx parameter.
When you trigger this function by calling: if HasArtefact(xxx, 2 ) then -- tests wheth-
er current hero (whose ID is in the
transform("town2"); xxx variable) has artefact number 2.
TRIGGERS

SetRegionBlocked("passage",not nil,
PLAYER_3);
The very same general function transform() would be end;
understood as: end;

function transform()
DEBUGGING

TransformTown("town2", TOWN_ACADEMY); This example function can be called up without specifying the
end; hero name like with this command:

blockHero();
In the following example of bad scripting, the “townname”
variable is not used for anything. It is defined, but the function
always converts town2. Thus, it is more appropriate to define or
the function as transform() than it is to define the function
HERO IDs

as transform(townname). Trigger(REGION_ENTER_AND_STOP_TRIGGER,
"area1"," blockHero " );
Bad scripting example

function transform(townname) See also the “Triggering fname(parameter) type of functions”


TransformTown("town2", TOWN_ACADEMY); section.
OTHER IDs

end;

12
Functions
4.6. Threads time specified by its parameter, the sleep() command al-

SCRIPT FILE LAYOUT


Threads are similar to continuous events in Heroes IV. They can lows the game engine to do other processes such as move heroes,
kick in at any time and they happily use your CPU resources. A operate eye candy, detect object contacts, display UI screens,
thread, once triggered, can run forever and in parallel to other run other script functions in parallel to the thread, etc. Conse-
functions. To be used as a successful thread a function must quently, the sleep() command must be in the thread loop or
have the following structure: the thread will cause the game to slow down and lag, sometimes
to the point where it is not playable. The higher the number the
function funcname() more time you give for other processes. A value of 10 is works
while boolean test do well most of the time, but any value between 5 and 20 is reason-
commands; able in my opinion. However, there may be special cases where
sleep(10); other values may be required, and you will have to try a few
end; experiments to see what works best.
end; Triggering threads goes via startThread(function

SYNTAX
name) command.

As long as the boolean test (e.g., x == y) returns true, commands CAUTION: Triggering threads in ways other than start
are run. Most often you need the opposite: commands are held Thread() blocks access to other script functions as long as the
back until a certain requirement is fulfilled. For that require- (infinite) thread runs.
ment use the following:

VARIABLES
Example script
You want a script that gives the player an instant win when he
function funcname() accumulates 100.000 gold.
while boolean test do
if boolean test2 then function checkGold()
commands; while 1 do

FUNCTIONS
end; if GetPlayerResources(PLAYER_1, 6)
sleep(10); >= 100000 then
end; win();
end; end;
sleep(10);
end;
If you have problems defining the first boolean test which deter- end;
mines how long the thread lives, give it eternal life with “while 1 startThread(checkGold); -- Note exception to rule:

TRIGGERS
do”. Official maps use this statement quite often. It is startThread(fname) NOT startThread("name")
Why is the sleep(10) command necessary? During the

DEBUGGING
HERO IDs
OTHER IDs

13
Triggers
5. Triggers
SCRIPT FILE LAYOUT

Another very important part of a script is to set triggers so that


each function is run when you wish it run. While you can call Trigger(NEW_DAY_TRIGGER, "dawn");
a function up instantly by using its name as a command in the
script or in the definition of another function, it is just as likely
that you will wish to define the conditions when the func- When the Trigger() command is not a part of a function
tion has to run. For example, you wish to trigger the display definition, the function specified in Trigger() command’s
of a informational message to the player when a hero enters a last parameter is bound to the trigger when the map is first
certain region on the map. The text that follows discusses the opened for playing. When the Trigger() command is part
techniques for handling both these situations. of a function definition, the link between the function specified
in the Trigger() command’s last parameter and the trigger
SYNTAX

is created when the defined function runs.


5.1. Instant triggering of functions Only one function can be bound to each object and event
combination. For example you cannot trigger two functions
A function can be called up within another function as a com- simultaneously by defining:
mand within the function definition, or it can be placed in the
script outside any functions and be used as a map starting event. Trigger(OBJECT_CAPTURE_TRIGGER, "town1",
VARIABLES

In either case, you simply type the function name. "function1");

Example Trigger(OBJECT_CAPTURE_TRIGGER, "town1",


"function2");
function blabla()
MessageBox("Maps/SingleMissions/test/
FUNCTIONS

blah.txt"); or
end;
Trigger(NEW_DAY_TRIGGER, "day1");
function day2()
if GetDate(DAY)== 2 then Trigger(NEW_DAY_TRIGGER, "day2");
blabla(); -- here function blabla is triggered
and the messagebox is shown at day 2.
end; In both cases only the latter Trigger command would work,
TRIGGERS

end; since it overwrites the first. Luckily you can do an intermediate


function that triggers as many other functions as you wish.

5.2. Binding functions Example


to map events and objects Trigger(NEW_DAY_TRIGGER, "days");
DEBUGGING

Suppose you require a function to run when a certain event oc- function days()
curs on your map. How do you tie the function to the event? day1();
That is what you have the Trigger() command for. The day2();
Trigger() command is thoroughly described in the official end;
editor document Script_Functions.pdf, and you should consult function day1();
that document before you actually use the Trigger() com- commands;
mand in your script. Briefly, the generalized syntax for the end;
Trigger() command looks like this: function day2();
HERO IDs

commands;
Trigger(EVENT _TYPE, "object to which the end;
event is bound", "function name that is to
be triggered");
Of course different objects can have the same type triggers
without problems and the same object can have different type of
Examples triggers without problems.
OTHER IDs

Trigger(OBJECT_TOUCH_TRIGGER,
"festivalArena", "offerFestival");

Trigger(REGION_ENTER_AND_STOP_TRIGGER,
"monolithOneRgn", "openMonoliths");

14
Triggers
5.3. Triggering fname(parameter) 5.4. Removing a trigger
type of functions

SCRIPT FILE LAYOUT


To remove a trigger use “nil” instead of a function name as the
last parameter in the Trigger() command.
What if the function being triggered has a parameter that you
need to specify? As explained above, in cases where the param- Example command
eter refers to currently selected hero, specification is actually not
needed and therefore there is no complication. In other cases, Trigger(EVENT _TYPE, "object to which the
you could avoid using parameters within the Trigger() event is bound", nil);
command’s parameters (long way), or you could use different
sets of quotation marks within the Trigger() command’s
parameters. Example script
At day 7 a town called town1 turns into academy and thereafter
Example of the long way the trigger is removed:

SYNTAX
Trigger(NEW_DAY_TRIGGER, "transform1"); Trigger(NEW_DAY_TRIGGER, "transform");

function transform1(); function transform()


transform("town1"); if GetDate(DAY) == 7 then
end; TransformTown("town1", 2);

VARIABLES
Trigger(NEW_DAY_TRIGGER, nil);
function transform(townname) end;
TransformTown(townname, 5); end;
end;

FUNCTIONS
Example of the short way

Trigger(NEW_DAY_TRIGGER, "transform
('town1')"); -- NOTE: Different types of quota-
tion marks are used. Check that
"transform1('town1')" is entirely
orange colored in your editor!

TRIGGERS
function transform(townname)
TransformTown(townname, 5);
end;

DEBUGGING
HERO IDs
OTHER IDs

15
Debugging
6. Hints for debugging
SCRIPT FILE LAYOUT

6.1. Enabling the console 6.2. Using the print() command


It is extremely unlikely that you will be able to successfully write With console activated, you can use the print() command
a working script without being able to see what errors you have to aid you in debugging your script. It prints the specified text
made in writing it. Unfortunately, the H5 Editor’s Check Map or the value of a variable into the console window. You can put
command does not actually find pertinent errors and, worse yet, it pretty much anywhere between other commands to see if
reports errors that do not exist. the script runs that far, or to display your own script tracking
However, each time you launch the H5 game and open your information.
map for playing by using the Create command on the main
menu, the game compiles your scrip and checks for errors in the Example
process. If it finds an error in your script, it will display an error
SYNTAX

message on the developer’s console. If the error is bad enough, print('works to here'); -- shows works to here in
the script will be ignored when the map opens for play. This type the console window.
of error is the main reason why new mapmakers complain “my
script doesn’t run” or “nothing happens” when I test my map. print(test1); -- shows the value of the test1 variable
Unfortunately, the developer’s console is disabled during the in the console window.
installation process for the game, so you cannot see it while you
VARIABLES

play the game, nor can you use it to debug your script. But, there print("x1 = ", x1) -- shows x1 = followed by the
is a way to enable it. value of the x1 variable in the console window.
For the Tribes of The East expansion, follow these steps:

1. Go into the Program Files\Ubisoft\Heroes of 6.3. My script does not run!


Might and Magic V - Tribes of the East\
FUNCTIONS

profiles directory. If your script does not run when you try to play your map, follow
2. Find the autoexec_a2.cfg file and open it for editing these steps:
with a text editing program such as Notepad or WordPad. 1. Make sure that the map is SingleMission not MultiPlayer
3. Add this line of text setvar dev_console_password (open the map’s *.h5m file with zip or rar archiver and see
= schwinge-des-todes as the last line in the file. the names of subdirectories).
4. Go into the My Documents/My Games/Heroes of 2. Enable console and read the error messages that are dis-
Might and Magic V - Tribes of the East/ played there. Make notes on a piece of scratch paper so you
Profiles directory. You will see some folders, each with can remember what they are.
TRIGGERS

the name of a game profile you created to play the game 3. Get out of the game and open your map with the Editor.
with. If you don’t see any folders with profile names, launch 4. Look into your script and see if you can find the problems
the game and create a new profile with a name such as Tester. indicated in the error messages. Typically, an error message
5. Decide which profile you are going to use for testing your will tell you what line the error is on, or identify the last line
script and open its folder. the compiler worked on, and tell you what it expected to
6. Find the input_a2.cfg file and open it for editing with a find versus what it did find. Examine your code carefully in
DEBUGGING

text editing program such as Notepad or WordPad. light of this information, and decide what changes you wish
7. Add the string bind show_console '`' right after the to make before trying to compile it again. For example, you
line saying bind enter_pressed 'NUM_ENTER'. could do any or all of the following:
a. Check your spelling and capitalization. Even the most
If you are using the Hammers of Fate expansion, you need to trivial spelling or capitalization error can stop the com-
edit autoexec_a1.cfg and cfg input_a1.cfg. piler in its tracks.
If you are using just Heroes V, you need to edit b. Check your use of quotes.
autoexec.cfg and input.cfg. c. Check that there are enough end;-s. A common problem
HERO IDs

is that the program does not understand properly where


Once you’ve enabled the console, go ahead and launch the game. a function ends and therefore ignores all or part of the
Make sure you have selected the profile for which you modified script file. It is a very good idea to use the TAB key to
the input_a2.cfg file and then use the Create command indent commands within each block of code. That way,
on the main menu to start playing your map. Once the game has for example, you will get a dotted line leading down-
compiled your script and opened your map for playing, you should wards from each if to the corresponding end; for that if.
be able to enter the console by pressing ` (the key above TAB). All the scripting examples in this guide use indenting in
OTHER IDs

If the console screen does not appear, go back over the steps this manner. You are advised to do likewise.
and check your work. Even the most trivial typing error, capital- d. Check that you didn’t use = where you should have used
ization error, or missing space will prevent enabling the console. ==.
In addition to error messages for faulty scripts, the console
shows you many things about the game, most of which are too
obscure or cryptic to be of much use.

16
Debugging
e. Reread each error message carefully, and try to under- a. Double-check triggers. Maybe a trigger is accidentally set

SCRIPT FILE LAYOUT


stand what it is trying to tell you. Compare what you to run under different conditions than you wish.
have done in your script to the documentation. Look b. Trace through the sequence of commands in the func-
through the Celestial Heavens’ Mapmaking Guild tion and examine the logic to verify that it actually does
Forum to see if anyone has found an answer to your what you desire. Make notes to track changing variable
problem. And, finally, post a description of your problem values, arithmetic results, comparison results, etc.
on the forum to see if someone can help you resolve it. c. Embed print() commands within the function to
5. Make changes to your script and repeat these steps until you display interim results on the console, or just to verify
no longer have any reported errors. that the correct function is being called and is working.
2. Devise a test and set up temporary conditions in the script
that will test only that function, then launch the game and
6.4. My script runs play your map while you verify the function’s operation. Use
embedded print() commands as required.
but doesn’t do what I want

SYNTAX
3. Make changes to the function and test it again. Repeat as
Once your script compiles without errors, it is entirely possible necessary.
that it still won’t do what you wanted or expected. In this case, 4. If all else fails, discard the function and rewrite it using a
proceed as follows: different approach.
1. Study the results you do see in the game and then go into
your script and look at the function that is supposed to be

VARIABLES
generating those results.

FUNCTIONS
TRIGGERS
DEBUGGING
HERO IDs
OTHER IDs

17
Hero IDs
7. Internal hero ID names
needed for scripts
SCRIPT FILE LAYOUT

Referring to heroes in your scripts must be done by their internal Bold Italic indicates names from the Tribes of the East expan-
H5 ID names. You can give them a scripting name as described sion pack.
earlier, but scripts do not recognize scripting names, nor do
scripts recognize the standard game names as seen by the player (The information in this table comes from Curios cheat guide
in an tuncustomized map. http://www.heroesofmightandmagic.com/heroes5/heroes5_
Here is a list of the standard game names (in bold) versus the cheats_names.shtml)
internal hero ID names:

Standard Game Name Internal Hero ID Standard Game Name Internal Hero ID
SYNTAX

Agrael Agrael Havez Havez


Alaron Ildar Helmar Ottar
Alastor Efion Inga Una
Andreas RedHeavenHero01 Ingvar Ingvar
VARIABLES

Anwen Metlirn Irina Ving


Biara Biara Isabel Isabell
Brand Brand Jezebeth Oddrema
Cyrus Cyrus Jhora Sufi
Deirdre Nemor Karli Skeggy
FUNCTIONS

Deleb Deleb Kaspar Gles


Dirael Diraya Kilghan Hero9
Dougal Orrin King Tolghar
Duncan Duncan Klaus Sarge
Ebba Bersy Kragh Hero1
Ellaine Nathaniel Kujin Kujin
TRIGGERS

Erasial Erasial Kunyak Hero4


Ergar Ergar Kythra Menel
Erling Egil Laszlo Laszlo
Eruina Eruina Laszlo Mardigo
Faiz Faiz Lethos Dalom
DEBUGGING

Findan Heam Lorenzo RedHeavenHero02


Freyda Axel Lucretia Tamika
Freyda Freyda Maahir Maahir
Galib Tan Maeve Maeve
Garuna Hero3 Marbas Marder
Giar Giar Markal Berein
HERO IDs

Gilraen Gillion Naadir Muscip


Giovanni Giovanni Narxes Razzak
Glen Glen Nathir Nur
Godric Godric Nebiros Jazaz
Gorshak Hero4 Nicolai Nicolai
OTHER IDs

Gotai Gottai Nur Astral


Grawl Calid Nymus Nymus
Grok Grok Ornella Ornella
Guarg Guarg Orson Straker
Haggash Hero7 Ossir Ossir

18
Hero IDs
Standard Game Name Internal Hero ID Standard Game Name Internal Hero ID

SCRIPT FILE LAYOUT


Quroq Quroq Thralsai Thralsai
Raelag Raelag Urghat Hero2
Raven Effig Valeria RedHeavenHero03
Razzak Isher Vayshan Ohtarig
Rolf Rolf Vinrael Elleshar
Rutger Brem Vittorio Christian
Segref Segref Vladimir Pelt
Shadya Kelodin Wulfstan Wulfstan
Shak’Karukat Hero6 Wyngaal Linaas

SYNTAX
Sinitar Inagost Ylaya Shadwyn
Sorgal Ferigl Ylthin Itil
Svea Vegeyr Yrbeth Almegir
Talanar Nadaur Yrwanna Urunir

VARIABLES
Telsek Hero8 Zehir Zehir
Temkhan Timerkhan Zoltan Aberrar

FUNCTIONS
TRIGGERS
DEBUGGING
HERO IDs
OTHER IDs

19
Other IDs
8. Other IDs Needed For Scripts
SCRIPT FILE LAYOUT

Many of the H5 script functions require IDs for parameter val- 8.6. Kinds of treasures
ues to make them work properly. This section covers all the IDs TREASURE_CRYSTAL = 0
you will need to write your scripts. TREASURE_GEMS = 1
NOTE: Each expansion to the original H5 game brought TREASURE_GOLD = 2
new heroes, artifacts, and other objects. This list has notes indi- TREASURE_MERCURY = 3
cating which IDs belong to each expansion where required. TREASURE_ORE = 4
NOTE: For some reason, the official documentation for the TREASURE_SULFUR= 5
Editor was not updated for the new creature, town, and artifact TREASURE_WOOD = 6
IDs added by the Tribes of the East expansion. You must use this TREASURE_CAMPFIRE = 8
section for reference instead of the official documentation. TREASURE_CHEST = 9
SYNTAX

TREASURE_SEA_CHEST = 10
TREASURE_FLOATSAM = 11
TREASURE_SHIPWRECK = 13
8.1. Logical constants
true = not nil
false = nil
VARIABLES

8.7. Date type IDs


DAY = 0
WEEK = 1
8.2. Player IDs MONTH = 2
PLAYER_NONE = 0 DAY_OF_WEEK = 3
PLAYER_1 = 1 ABSOLUTE_DAY = DAY
FUNCTIONS

PLAYER_2 = 2
PLAYER_3 = 3
PLAYER_4 = 4
PLAYER_5 = 5 8.8. Advmap predefided names
PLAYER_6 = 6 OBJECT_GRAIL = 'grail'
PLAYER_7 = 7
PLAYER_8 = 8
TRIGGERS

8.9. Advmap object types


OBJECT_HERO = 0
8.3. Player states
PLAYER_NOT_IN_GAME = 0
PLAYER_ACTIVE = 1
PLAYER_WON = 2 8.10. Hero stat’s IDs
DEBUGGING

PLAYER_LOST = 3 STAT_EXPERIENCE = 0
STAT_ATTACK = 1
STAT_DEFENCE = 2
STAT_SPELL_POWER = 3
8.4. Floor names STAT_KNOWLEDGE = 4
GROUND = 0 STAT_LUCK = 5
UNDERGROUND = 1 STAT_MORALE = 6
STAT_MOVE_POINTS = 7
HERO IDs

STAT_MANA_POINTS = 8

8.5. Kinds of resources


WOOD= 0
ORE = 1 8.11. Objective state’s IDs
MERCURY = 2 OBJECTIVE_SCENARIO_INFO = 0
OTHER IDs

CRYSTAL = 3 OBJECTIVE_UNKNOWN = 1
SULFUR = 4 OBJECTIVE_ACTIVE = 2
GEM = 5 OBJECTIVE_COMPLETED = 3
GOLD= 6 OBJECTIVE_FAILED = 4

20
Other IDs
8.12. Artifact sets IDs ARTIFACT_STAFF_OF_MAGI = 45
(for basic artifact sets)

SCRIPT FILE LAYOUT


ARTIFACT_CROWN_OF_MAGI = 46
ARTIFACT_SET_DRAGONISH = 0 ARTIFACT_RING_OF_MAGI = 47
ARTIFACT_SET_DWARVEN = 1 ARTIFACT_DWARVEN_MITHRAL_CUIRASS = 48
ARTIFACT_SET_LIONS = 2 ARTIFACT_DWARVEN_MITHRAL_GREAVES = 49
ARTIFACT_SET_MAGIS = 3 ARTIFACT_DWARVEN_MITHRAL_HELMET = 50
ARTIFACT_SET_NECROMANCERS = 4 ARTIFACT_DWARVEN_MITHRAL_SHIELD = 51
ARTIFACT_SET_EDUCATIONAL = 5 ARTIFACT_SCROLL_OF_SPELL_X = 52
ARTIFACT_SET_HUNTERS = 6 ARTIFACT_GRAAL = 53
ARTIFACT_SET_OGRES = 7 ARTIFACT_BOOTS_OF_LEVITATION = 54
ARTIFACT_SET_RUNIC = 8 ARTIFACT_SKULL_HELMET = 55
ARTIFACT_SET_DEMONIC = 9 ARTIFACT_VALORIOUS_ARMOR = 56
ARTIFACT_BOOTS_OF_SWIFTNESS = 57

SYNTAX
ARTIFACT_MOONBLADE = 58
ARTIFACT_RING_OF_CELERITY = 59
8.13. Artifact type IDs ARTIFACT_BAND_OF_CONJURER = 60
ARTIFACT_SWORD_OF_RUINS = 1 ARTIFACT_EARTHSLIDERS = 61
ARTIFACT_GREAT_AXE_OF_GIANT_SLAYING = 2 ARTIFACT_RIGID_MANTLE = 62
ARTIFACT_WAND_OF_X = 3 ARTIFACT_JINXING_BAND = 63

VARIABLES
ARTIFACT_UNICORN_HORN_BOW = 4 ARTIFACT_BONESTUDDED_LEATHER = 64
ARTIFACT_TITANS_TRIDENT = 5 ARTIFACT_WISPERING_RING = 65
ARTIFACT_STAFF_OF_VEXINGS = 6 ARTIFACT_HELM_OF_CHAOS = 66
ARTIFACT_SHACKLES_OF_WAR = 7 ARTIFACT_TWISTING_NEITHER = 67
ARTIFACT_FOUR_LEAF_CLOVER = 8 ARTIFACT_SANDALS_OF_THE_SAINT = 68
ARTIFACT_ICEBERG_SHIELD = 9 ARTIFACT_SHAWL_OF_GREAT_LICH = 69

FUNCTIONS
ARTIFACT_GOLDEN_SEXTANT = 10 ARTIFACT_RING_OF_DEATH = 70
ARTIFACT_CROWN_OF_COURAGE = 11 ARTIFACT_NECROMANCER_PENDANT = 71
ARTIFACT_CROWN_OF_MANY_EYES = 12 ARTIFACT_FREIDA = 72
ARTIFACT_PLATE_MAIL_OF_STABILITY = 13 ARTIFACT_RING_OF_THE_SHADOWBRAND = 73
ARTIFACT_BREASTPLATE_OF_PETRIFIED_WOOD = 14 ARTIFACT_OGRE_CLUB = 74
ARTIFACT_PEDANT_OF_MASTERY = 15 ARTIFACT_OGRE_SHIELD = 75
ARTIFACT_NECKLACE_OF_BRAVERY = 16 ARTIFACT_TOME_OF_DESTRUCTION = 76
ARTIFACT_WEREWOLF_CLAW_NECKLACE = 17 ARTIFACT_TOME_OF_LIGHT_MAGIC = 77

TRIGGERS
ARTIFACT_EVERCOLD_ICICLE = 18 ARTIFACT_TOME_OF_DARK_MAGIC = 78
ARTIFACT_NECKLACE_OF_POWER = 19 ARTIFACT_TOME_OF_SUMMONING_MAGIC = 79
ARTIFACT_RING_OF_LIGHTING_PROTECTION = 20 ARTIFACT_BEGINNER_MAGIC_STICK = 80
ARTIFACT_RING_OF_LIFE = 21 ARTIFACT_RUNIC_WAR_AXE = 81
ARTIFACT_RING_OF_HASTE = 22 ARTIFACT_RUNIC_WAR_HARNESS = 82
ARTIFACT_NIGHTMARISH_RING = 23 ARTIFACT_SKULL_OF_MARKAL = 83

DEBUGGING
ARTIFACT_BOOTS_OF_SPEED = 24 ARTIFACT_BEARHIDE_WRAPS = 84
ARTIFACT_GOLDEN_HORSESHOE = 25 ARTIFACT_DWARVEN_SMITHY_HUMMER = 85
ARTIFACT_WAYFARER_BOOTS = 26 ARTIFACT_RUNE_OF_FLAME = 86
ARTIFACT_BOOTS_OF_INTERFERENCE = 27 ARTIFACT_TAROT_DECK = 87
ARTIFACT_ENDLESS_SACK_OF_GOLD = 28 ARTIFACT_CROWN_OF_LEADER = 88
ARTIFACT_ENDLESS_BAG_OF_GOLD = 29 ARTIFACT_MASK_OF_DOPPELGANGER = 89
ARTIFACT_ANGEL_WINGS = 30 ARTIFACT_EDGE_OF_BALANCE = 90
ARTIFACT_LION_HIDE_CAPE = 31 ARTIFACT_RING_OF_MACHINE_AFFINITY = 91
HERO IDs

ARTIFACT_PHOENIX_FEATHER_CAPE = 32 ARTIFACT_HORN_OF_PLENTY = 92
ARTIFACT_CLOAK_OF_MOURNING = 33 ARTIFACT_RING_OF_UNSUMMONING = 93
ARTIFACT_HELM_OF_ENLIGHTMENT = 34 ARTIFACT_BOOK_OF_POWER = 94
ARTIFACT_CHAIN_MAIL_OF_ENLIGHTMENT = 35 ARTIFACT_TREEBORN_QUIVER = 95
ARTIFACT_DRAGON_SCALE_ARMOR = 36 ARTIFACT_PRINCESS = 96
ARTIFACT_DRAGON_SCALE_SHIELD = 37 ARTIFACT_ARTIFACT_EFFECT_COUNT = 97
OTHER IDs

ARTIFACT_DRAGON_BONE_GRAVES = 38
ARTIFACT_DRAGON_WING_MANTLE = 39
ARTIFACT_DRAGON_TEETH_NECKLACE = 40
ARTIFACT_DRAGON_TALON_CROWN = 41
ARTIFACT_DRAGON_EYE_RING = 42
ARTIFACT_DRAGON_FLAME_TONGUE = 43
ARTIFACT_ROBE_OF_MAGI = 44

21
Other IDs
8.14. Skill type IDs PERK_MASTER_OF_CREATURES = 53
SCRIPT FILE LAYOUT

8.14.1. Basic Skills PERK_MASTER_OF_ANIMATION = 54


SKILL_LOGISTICS = 1
SKILL_WAR_MACHINES = 2 8.15.1. Knight perks
SKILL_LEARNING = 3 PERK_HOLY_CHARGE = 55
SKILL_LEADERSHIP = 4 PERK_PRAYER = 56
SKILL_LUCK = 5 PERK_EXPERT_TRAINER = 57
SKILL_OFFENCE = 6
SKILL_DEFENCE = 7 8.15.2. Demonlord perks
SKILL_SORCERY = 8 PERK_CONSUME_CORPSE = 58
SKILL_DESTRUCTIVE_MAGIC = 9 PERK_DEMONIC_FIRE = 59
SKILL_DARK_MAGIC = 10 PERK_DEMONIC_STRIKE = 60
SKILL_LIGHT_MAGIC = 11
8.15.3. Necromancer perks
SYNTAX

SKILL_SUMMONING_MAGIC = 12
PERK_RAISE_ARCHERS = 61
8.14.2. Class skills PERK_NO_REST_FOR_THE_WICKED = 62
SKILL_TRAINING = 13 PERK_DEATH_SCREAM = 63
SKILL_GATING = 14
SKILL_NECROMANCY = 15 8.15.4. Ranger perks
VARIABLES

SKILL_AVENGER = 16 PERK_MULTISHOT = 64
SKILL_ARTIFICIER = 17 PERK_SNIPE_DEAD = 65
SKILL_INVOCATION = 18 PERK_IMBUE_ARROW = 66

8.15.5. Wizard perks


PERK_MAGIC_BOND = 67
8.15. Perks
FUNCTIONS

PERK_MELT_ARTIFACT = 68
PERK_PATHFINDING = 19 PERK_MAGIC_MIRROR = 69
PERK_SCOUTING = 20
PERK_NAVIGATION = 21 8.15.6. Warlock perks
PERK_FIRST_AID = 22 PERK_EMPOWERED_SPELLS = 70
PERK_BALLISTA = 23 PERK_DARK_RITUAL = 71
PERK_CATAPULT = 24 PERK_ELEMENTAL_VISION = 72
PERK_INTELLIGENCE = 25
TRIGGERS

PERK_SCHOLAR = 26
PERK_EAGLE_EYE = 27
PERK_RECRUITMENT = 28 8.16. Feats
PERK_ESTATES = 29 8.16.1. Knight
PERK_DIPLOMACY = 30 KNIGHT_FEAT_ROAD_HOME = 73
PERK_RESISTANCE = 31 KNIGHT_FEAT_TRIPLE_BALLISTA = 74
DEBUGGING

PERK_LUCKY_STRIKE = 32 KNIGHT_FEAT_ENCOURAGE = 75
PERK_FORTUNATE_ADVENTURER = 33 KNIGHT_FEAT_RETRIBUTION = 76
PERK_TACTICS = 34 KNIGHT_FEAT_HOLD_GROUND = 77
PERK_ARCHERY = 35 KNIGHT_FEAT_GUARDIAN_ANGEL = 78
PERK_FRENZY = 36 KNIGHT_FEAT_STUDENT_AWARD = 79
PERK_PROTECTION = 37 KNIGHT_FEAT_GRAIL_VISION = 80
PERK_EVASION = 38 KNIGHT_FEAT_CASTER_CERTIFICATE = 81
PERK_TOUGHNESS = 39 KNIGHT_FEAT_ANCIENT_SMITHY = 82
HERO IDs

PERK_MYSTICISM = 40 KNIGHT_FEAT_PARIAH = 83
PERK_WISDOM = 41 KNIGHT_FEAT_ELEMENTAL_BALANCE = 84
PERK_ARCANE_TRAINING = 42 KNIGHT_FEAT_ABSOLUTE_CHARGE = 85
PERK_MASTER_OF_ICE = 43
PERK_MASTER_OF_FIRE = 44 8.16.2. Demon Lord
PERK_MASTER_OF_LIGHTNINGS = 45 DEMON_FEAT_QUICK_GATING = 86
OTHER IDs

PERK_MASTER_OF_CURSES = 46 DEMON_FEAT_MASTER_OF_SECRETS = 87
PERK_MASTER_OF_MIND = 47 DEMON_FEAT_TRIPLE_CATAPULT = 88
PERK_MASTER_OF_SICKNESS = 48 DEMON_FEAT_GATING_MASTERY = 89
PERK_MASTER_OF_BLESSING = 49 DEMON_FEAT_CRITICAL_GATING = 90
PERK_MASTER_OF_ABJURATION = 50 DEMON_FEAT_CRITICAL_STRIKE = 91
PERK_MASTER_OF_WRATH = 51 DEMON_FEAT_DEMONIC_RETALIATION = 92
PERK_MASTER_OF_QUAKES = 52 DEMON_FEAT_EXPLODING_CORPSES = 93

22
Other IDs
DEMON_FEAT_DEMONIC_FLAME = 94 WARLOCK_FEAT_SECRETS_OF_DESTRUCTION = 146

SCRIPT FILE LAYOUT


DEMON_FEAT_WEAKENING_STRIKE = 95 WARLOCK_FEAT_PAYBACK = 147
DEMON_FEAT_FIRE_PROTECTION = 96 WARLOCK_FEAT_ELITE_CASTERS = 148
DEMON_FEAT_FIRE_AFFINITY = 97 WARLOCK_FEAT_ELEMENTAL_OVERKILL = 149
DEMON_FEAT_ABSOLUTE_GATING = 98 WARLOCK_FEAT_ABSOLUTE_CHAINS = 150

8.16.3. Necromancer 8.16.7. Runemage


NECROMANCER_FEAT_DEATH_TREAD = 99 HERO_SKILL_RUNELORE = 151
NECROMANCER_FEAT_LAST_AID = 100 HERO_SKILL_REFRESH_RUNE = 152
NECROMANCER_FEAT_LORD_OF_UNDEAD = 101 HERO_SKILL_STRONG_RUNE = 153
NECROMANCER_FEAT_HERALD_OF_DEATH = 102 HERO_SKILL_FINE_RUNE = 154
NECROMANCER_FEAT_DEAD_LUCK = 103 HERO_SKILL_QUICKNESS_OF_MIND = 155
NECROMANCER_FEAT_CHILLING_STEEL = 104 HERO_SKILL_RUNIC_MACHINES = 156

SYNTAX
NECROMANCER_FEAT_CHILLING_BONES = 105 HERO_SKILL_TAP_RUNES = 157
NECROMANCER_FEAT_SPELLPROOF_BONES = 106 HERO_SKILL_RUNIC_ATTUNEMENT = 158
NECROMANCER_FEAT_DEADLY_COLD = 107 HERO_SKILL_DWARVEN_LUCK = 159
NECROMANCER_FEAT_SPIRIT_LINK = 108 HERO_SKILL_OFFENSIVE_FORMATION = 160
NECROMANCER_FEAT_TWILIGHT = 109 HERO_SKILL_DEFENSIVE_FORMATION = 161
NECROMANCER_FEAT_HAUNT_MINE = 110 HERO_SKILL_DISTRACT = 162

VARIABLES
NECROMANCER_FEAT_ABSOLUTE_FEAR = 111 HERO_SKILL_SET_AFIRE = 163
HERO_SKILL_SHRUG_DARKNESS = 164
8.16.4. Ranger HERO_SKILL_ETERNAL_LIGHT = 165
RANGER_FEAT_DISGUISE_AND_RECKON = 112 HERO_SKILL_RUNIC_ARMOR = 166
RANGER_FEAT_IMBUE_BALLISTA = 113 HERO_SKILL_ABSOLUTE_PROTECTION = 167
RANGER_FEAT_CUNNING_OF_THE_WOODS = 114

FUNCTIONS
RANGER_FEAT_FOREST_GUARD_EMBLEM = 115 8.16.8. Runmage & Barbarian cross-class
RANGER_FEAT_ELVEN_LUCK = 116 HERO_SKILL_SNATCH = 168
RANGER_FEAT_FOREST_RAGE = 117 HERO_SKILL_MENTORING = 169
RANGER_FEAT_LAST_STAND = 118 HERO_SKILL_EMPATHY = 170
RANGER_FEAT_INSIGHTS = 119 HERO_SKILL_PREPARATION = 171
RANGER_FEAT_SUN_FIRE = 120
RANGER_FEAT_SOIL_BURN = 121 8.16.9. Barbarian
RANGER_FEAT_STORM_WIND = 122 HERO_SKILL_DEMONIC_RAGE = 172

TRIGGERS
RANGER_FEAT_FOG_VEIL = 123 HERO_SKILL_MIGHT_OVER_MAGIC = 173
RANGER_FEAT_ABSOLUTE_LUCK = 124 HERO_SKILL_MEMORY_OF_OUR_BLOOD = 174
HERO_SKILL_POWERFULL_BLOW = 175
8.16.5. Wizard HERO_SKILL_ABSOLUTE_RAGE = 176
WIZARD_FEAT_MARCH_OF_THE_MACHINES = 125 HERO_SKILL_PATH_OF_WAR = 177
WIZARD_FEAT_REMOTE_CONTROL = 126 HERO_SKILL_BATTLE_ELATION = 178

DEBUGGING
WIZARD_FEAT_ACADEMY_AWARD = 127 HERO_SKILL_LUCK_OF_THE_BARBARIAN = 179
WIZARD_FEAT_ARTIFICIAL_GLORY = 128 HERO_SKILL_STUNNING_BLOW = 180
WIZARD_FEAT_SPOILS_OF_WAR = 129 HERO_SKILL_DEFEND_US_ALL = 181
WIZARD_FEAT_WILDFIRE = 130 HERO_SKILL_GOBLIN_SUPPORT = 182
WIZARD_FEAT_SEAL_OF_PROTECTION = 131 HERO_SKILL_BARBARIAN_LEARNING = 183
WIZARD_FEAT_COUNTERSPELL = 132 HERO_SKILL_POWER_OF_BLOOD = 184
WIZARD_FEAT_MAGIC_CUSHION = 133 HERO_SKILL_WARCRY_LEARNING = 185
WIZARD_FEAT_SUPRESS_DARK = 134 HERO_SKILL_BODYBUILDING = 186
HERO IDs

WIZARD_FEAT_SUPRESS_LIGHT = 135 HERO_SKILL_VOICE = 187


WIZARD_FEAT_UNSUMMON = 136 HERO_SKILL_VOICE_TRAINING = 188
WIZARD_FEAT_ABSOLUTE_WIZARDY = 137 HERO_SKILL_MIGHTY_VOICE = 189
HERO_SKILL_VOICE_OF_RAGE = 190
8.16.6. Warlock HERO_SKILL_SHATTER_DESTRUCTIVE_MAGIC = 191
WARLOCK_FEAT_TELEPORT_ASSAULT = 138 HERO_SKILL_CORRUPT_DESTRUCTIVE = 192
OTHER IDs

WARLOCK_FEAT_SHAKE_GROUND = 139 HERO_SKILL_WEAKEN_DESTRUCTIVE = 193


WARLOCK_FEAT_DARK_REVELATION = 140 HERO_SKILL_DETAIN_DESTRUCTIVE = 194
WARLOCK_FEAT_FAST_AND_FURIOUS = 141 HERO_SKILL_SHATTER_DARK_MAGIC = 195
WARLOCK_FEAT_LUCKY_SPELLS = 142 HERO_SKILL_CORRUPT_DARK = 196
WARLOCK_FEAT_POWER_OF_HASTE = 143 HERO_SKILL_WEAKEN_DARK = 197
WARLOCK_FEAT_POWER_OF_STONE = 144 HERO_SKILL_DETAIN_DARK = 198
WARLOCK_FEAT_CHAOTIC_SPELLS = 145 HERO_SKILL_SHATTER_LIGHT_MAGIC = 199

23
Other IDs
HERO_SKILL_CORRUPT_LIGHT = 200 TOWN_BUILDING_SPECIAL_7 = 23
SCRIPT FILE LAYOUT

HERO_SKILL_WEAKEN_LIGHT = 201 TOWN_BUILDING_SPECIAL_8 = 24


HERO_SKILL_DETAIN_LIGHT = 202 TOWN_BUILDING_SPECIAL_9 = 25
HERO_SKILL_SHATTER_SUMMONING_MAGIC = 203
HERO_SKILL_CORRUPT_SUMMONING = 204 TOWN_BUILDING_HAVEN_TRAINING_GROUNDS =
HERO_SKILL_WEAKEN_SUMMONING = 205 TOWN_BUILDING_SPECIAL_1
HERO_SKILL_DETAIN_SUMMONING = 206 TOWN_BUILDING_HAVEN_MONUMENT_TO_FALLEN_
HERO_SKILL_DEATH_TO_NONEXISTENT = 207 HEROES = TOWN_BUILDING_SPECIAL_2
HERO_SKILL_BARBARIAN_ANCIENT_SMITHY = 208 TOWN_BUILDING_HAVEN_HOSPITAL = TOWN_
HERO_SKILL_BARBARIAN_WEAKENING_STRIKE = 209 BUILDING_SPECIAL_3
HERO_SKILL_BARBARIAN_SOIL_BURN = 210 TOWN_BUILDING_HAVEN_STABLE = TOWN_
HERO_SKILL_BARBARIAN_FOG_VEIL = 211 BUILDING_SPECIAL_4
HERO_SKILL_BARBARIAN_INTELLIGENCE = 212 TOWN_BUILDING_HAVEN_FARMS = TOWN_
SYNTAX

HERO_SKILL_BARBARIAN_MYSTICISM = 213 BUILDING_SPECIAL_5


HERO_SKILL_BARBARIAN_ELITE_CASTERS = 214 TOWN_BUILDING_INFERNO_INFERNAL_LOOM =
HERO_SKILL_BARBARIAN_STORM_WIND = 215 TOWN_BUILDING_SPECIAL_1
TOWN_BUILDING_INFERNO_ORDER_OF_FIRE =
TOWN_BUILDING_SPECIAL_3
TOWN_BUILDING_INFERNO_HALLS_OF_HORROR =
VARIABLES

8.17. Town type IDs TOWN_BUILDING_SPECIAL_4


CAUTION: These values are for the TotE expansion only. If TOWN_BUILDING_INFERNO_SACRIFICIAL_PIT =
you are using H5 or HOF, you should check the documentation TOWN_BUILDING_SPECIAL_5
that came with each of those games. TOWN_BUILDING_DUNGEON_ALTAR_OF_ELEMENTS =
TOWN_BUILDING_SPECIAL_1
Tribes of the East values TOWN_BUILDING_DUNGEON_RITUAL_PIT = TOWN_
FUNCTIONS

TOWN_HEAVEN = 0 BUILDING_SPECIAL_3
TOWN_PRESERVE = 1 TOWN_BUILDING_DUNGEON_TRADE_GUILD = TOWN_
TOWN_ACADEMY = 2 BUILDING_SPECIAL_4
TOWN_DUNGEON = 3 TOWN_BUILDING_DUNGEON_TREASURE_DIG_SITE =
TOWN_NECROMANCY = 4 TOWN_BUILDING_SPECIAL_5
TOWN_INFERNO = 5 TOWN_BUILDING_DUNGEON_HALL_OF_INTRIGUE =
TOWN_FORTRESS = 6 TOWN_BUILDING_SPECIAL_6
TOWN_STRONGHOLD = 7 TOWN_BUILDING_ACADEMY_LIBRARY = TOWN_
TRIGGERS

BUILDING_SPECIAL_1
TOWN_BUILDING_ACADEMY_ARCANE_FORGE = TOWN_
BUILDING_SPECIAL_2
8.18. Town buildings IDs TOWN_BUILDING_ACADEMY_ARTIFACT_MERCHANT =
TOWN_BUILDING_TOWN_HALL = 0 TOWN_BUILDING_SPECIAL_3
TOWN_BUILDING_FORT = 1 TOWN_BUILDING_ACADEMY_TREASURE_CAVE =
DEBUGGING

TOWN_BUILDING_MARKETPLACE = 2 TOWN_BUILDING_SPECIAL_4
TOWN_BUILDING_SHIPYARD = 3 TOWN_BUILDING_ACADEMY_ELEMENTAL_ENCLAVE =
TOWN_BUILDING_TAVERN = 4 TOWN_BUILDING_SPECIAL_5
TOWN_BUILDING_BLACKSMITH = 5 TOWN_BUILDING_PRESERVE_AVENGERS_
TOWN_BUILDING_MAGIC_GUILD = 6 BROTHERHOOD = TOWN_BUILDING_SPECIAL_0
TOWN_BUILDING_DWELLING_1 = 7 TOWN_BUILDING_PRESERVE_MYSTIC_POND = TOWN_
TOWN_BUILDING_DWELLING_2 = 8 BUILDING_SPECIAL_2
TOWN_BUILDING_DWELLING_3 = 9 TOWN_BUILDING_PRESERVE_SPARKLING_FONTAINS
HERO IDs

TOWN_BUILDING_DWELLING_4 = 10 = TOWN_BUILDING_SPECIAL_3
TOWN_BUILDING_DWELLING_5 = 11 TOWN_BUILDING_PRESERVE_BLOOMING_GROVE =
TOWN_BUILDING_DWELLING_6 = 12 TOWN_BUILDING_SPECIAL_4
TOWN_BUILDING_DWELLING_7 = 13 TOWN_BUILDING_PRESERVE_TREANT_SAMPLING =
TOWN_BUILDING_GRAIL = 14 TOWN_BUILDING_SPECIAL_5
TOWN_BUILDING_WONDER = 15 TOWN_BUILDING_NECROMANCY_AMPLIFIER = TOWN_
OTHER IDs

TOWN_BUILDING_SPECIAL_0 = 16 BUILDING_SPECIAL_1
TOWN_BUILDING_SPECIAL_1 = 17 TOWN_BUILDING_NECROMANCY_UNHOLY_TEMPLE =
TOWN_BUILDING_SPECIAL_2 = 18 TOWN_BUILDING_SPECIAL_2
TOWN_BUILDING_SPECIAL_3 = 19 TOWN_BUILDING_NECROMANCY_UNEARHED_GRAVES =
TOWN_BUILDING_SPECIAL_4 = 20 TOWN_BUILDING_SPECIAL_3
TOWN_BUILDING_SPECIAL_5 = 21 TOWN_BUILDING_NECROMANCY_DRAGON_TOMBSTONE
TOWN_BUILDING_SPECIAL_6 = 22 = TOWN_BUILDING_SPECIAL_4

24
Other IDs
TOWN_BUILDING_NECROMANCY_SHROUD_OF_ REGION_ENTER_WITHOUT_STOP_TRIGGER = 7

SCRIPT FILE LAYOUT


DARKNESS = TOWN_BUILDING_SPECIAL_5 HERO_LEVELUP_TRIGGER = 8
TOWN_BUILDING_FORTRESS_RUNIC_SHRINE = WAR_FOG_ENTER_TRIGGER = 9
TOWN_BUILDING_SPECIAL_1; COMBAT_RESULTS_TRIGGER = 11
TOWN_BUILDING_FORTRESS_ARENA = TOWN_ CUSTOM_ABILITY_TRIGGER = 12
BUILDING_SPECIAL_2; REGION_EXIT_TRIGGER = 13
TOWN_BUILDING_FORTRESS_GUARDPOST = TOWN_
BUILDING_SPECIAL_3;
TOWN_BUILDING_FORTRESS_RUNIC_STONEWORKS =
TOWN_BUILDING_SPECIAL_4; 8.23. Saved combat results types
TOWN_BUILDING_FORTRESS_RUNIC_ACADEMY = COMBAT_RESULT_NONE = 0
TOWN_BUILDING_SPECIAL_5; COMBAT_RESULT_WIN = 1
TOWN_BUILDING_STRONGHOLD_HALL_OF_TRIAL = COMBAT_RESULT_RETREAT = 2

SYNTAX
TOWN_BUILDING_SPECIAL_1 COMBAT_RESULT_SURRENDER = 3
TOWN_BUILDING_STRONGHOLD_GARBAGE_PILE =
TOWN_BUILDING_SPECIAL_2
TOWN_BUILDING_STRONGHOLD_TRAVELLERS_
SHELTER = TOWN_BUILDING_SPECIAL_3 8.24. Custom abilities IDs
TOWN_BUILDING_STRONGHOLD_PILE_OF_OUR_FOES CUSTOM_ABILITY_1 = 1

VARIABLES
= TOWN_BUILDING_SPECIAL_4 CUSTOM_ABILITY_2 = 2
TOWN_BUILDING_STRONGHOLD_SLAVE_MARKET = CUSTOM_ABILITY_3 = 3
TOWN_BUILDING_SPECIAL_5 CUSTOM_ABILITY_4 = 4

8.19. Monster mood IDs 8.25. Custom abilities modes

FUNCTIONS
MONSTER_MOOD_FRIENDLY = 0 CUSTOM_ABILITY_NOT_PRESENT = -1
MONSTER_MOOD_AGGRESSIVE = 1 CUSTOM_ABILITY_DISABLED = 0
MONSTER_MOOD_HOSTILE = 2 CUSTOM_ABILITY_ENABLED = 1
MONSTER_MOOD_WILD = 3

8.26. Moon weeks (for GetCurrentMoon


Week adventure script function)

TRIGGERS
8.20. Monster courage IDs WEEK_OF_NOTHING = 0
MONSTER_COURAGE_ALWAYS_JOIN = 0 WEEK_OF_TOAD = 1
MONSTER_COURAGE_ALWAYS_FIGHT = 1 WEEK_OF_SALAMANDER = 2
MONSTER_COURAGE_CAN_FLEE_JOIN = 2 WEEK_OF_BEETLE = 3
WEEK_OF_WYVERN = 4
WEEK_OF_DRAGONFLY = 5

DEBUGGING
WEEK_OF_FOX = 6
8.21. Borderguard key colors WEEK_OF_SHAMAN = 7
RED_KEY = 1 WEEK_OF_RABBIT = 8
BLUE_KEY = 2 WEEK_OF_SQUIRREL = 9
GREEN_KEY = 3 WEEK_OF_CATERPILLAR = 10
YELLOW_KEY = 4 WEEK_OF_HAMSTER = 11
ORANGE_KEY = 5 WEEK_OF_PIGEON = 12
TEAL_KEY = 6 WEEK_OF_RAGE = 13
HERO IDs

PURPLE_KEY = 7 WEEK_OF_EAGLE = 14
TAN_KEY = 8 WEEK_OF_BEE = 15
WEEK_OF_WASP = 16
WEEK_OF_SWAN = 17
WEEK_OF_BUTTERFLY = 18
8.22. Trigger type IDs WEEK_OF_THANE = 19
OTHER IDs

NEW_DAY_TRIGGER = 0 WEEK_OF_ANTILOPE = 20
PLAYER_ADD_HERO_TRIGGER = 1 WEEK_OF_ORC = 21
PLAYER_REMOVE_HERO_TRIGGER = 2 WEEK_OF_RAVEN = 22
OBJECTIVE_STATE_CHANGE_TRIGGER = 3 WEEK_OF_BADGER = 23
OBJECT_TOUCH_TRIGGER = 4 WEEK_OF_FLAMINGO = 24
OBJECT_CAPTURE_TRIGGER = 5 WEEK_OF_TORTOISE = 25
REGION_ENTER_AND_STOP_TRIGGER = 6 WEEK_OF_LYNX = 26

25
Other IDs
WEEK_OF_PENGUIN = 27 WEEK_OF_GRIFFIN = 87
SCRIPT FILE LAYOUT

WEEK_OF_FALCON = 28 WEEK_OF_PRIEST = 88
WEEK_OF_HEDGEHOG = 29 WEEK_OF_CAVALIER = 89
WEEK_OF_SPARROW = 30 WEEK_OF_ANGEL = 90
WEEK_OF_SWALLOW = 31 WEEK_OF_GREMLIN = 91
WEEK_OF_LION = 32 WEEK_OF_GARGOYLE = 92
WEEK_OF_SPEARS = 33 WEEK_OF_GOLEM = 93
WEEK_OF_BEAR = 34 WEEK_OF_MAGI = 94
WEEK_OF_CHIEFTAIN = 35 WEEK_OF_GENIE = 95
WEEK_OF_CENTAUR = 36 WEEK_OF_RAKSHASA = 96
WEEK_OF_GOBLIN = 37 WEEK_OF_GIANT = 97
WEEK_OF_DEER = 38 WEEK_OF_PIXIE = 98
WEEK_OF_OWL = 39 WEEK_OF_WARDANCER = 99
SYNTAX

WEEK_OF_DEFENDER = 40 WEEK_OF_WOODELF = 100


WEEK_OF_WYRM = 41 WEEK_OF_DRUID = 101
WEEK_OF_TIGER = 42 WEEK_OF_UNICORN = 102
WEEK_OF_PLAGUE = 43 WEEK_OF_TREANT = 103
WEEK_OF_DISEASE = 44 WEEK_OF_GREENDRAGON = 104
WEEK_OF_FEVER = 45 WEEK_OF_IMP = 105
VARIABLES

WEEK_OF_FLAME = 46 WEEK_OF_DEMON = 106


WEEK_OF_WINDS = 47 WEEK_OF_HELLHOUND = 107
WEEK_OF_FOLLY = 48 WEEK_OF_SUCCUBUS = 108
WEEK_OF_HONOR = 49 WEEK_OF_NIGHTMARE = 109
WEEK_OF_DIPLOMACY = 50 WEEK_OF_BALOR = 110
WEEK_OF_FORGERY = 51 WEEK_OF_DEVIL = 111
FUNCTIONS

WEEK_OF_TRADE = 52 WEEK_OF_ASSASSIN = 112


WEEK_OF_MEDITATION = 53 WEEK_OF_WITCH = 113
WEEK_OF_LIFE = 54 WEEK_OF_MINOTAUR = 114
WEEK_OF_CONJUNCTION = 55 WEEK_OF_RIDER = 115
WEEK_OF_JEWELS = 56 WEEK_OF_HYDRA = 116
WEEK_OF_ALCHEMY = 57 WEEK_OF_MATRON = 117
WEEK_OF_GOLD = 58 WEEK_OF_DRAGON = 118
WEEK_OF_FESTIVALS = 59 WEEK_OF_SKELETON = 119
TRIGGERS

WEEK_OF_HARVEST = 60 WEEK_OF_WALKINGDEAD = 120


WEEK_OF_IDLENESS = 61 WEEK_OF_WIGHT = 121
WEEK_OF_MAGIC = 62 WEEK_OF_VAMPIRE = 122
WEEK_OF_FEEBLENESS = 63 WEEK_OF_LICH = 123
WEEK_OF_SORROW = 64 WEEK_OF_GHOST = 124
WEEK_OF_CHAOS = 65 WEEK_OF_BONEDRAGON = 125
DEBUGGING

WEEK_OF_CALM = 66
WEEK_OF_HOPE = 67
WEEK_OF_WATER = 68
WEEK_OF_FIRE = 69 8.27. Animation Action Types
WEEK_OF_EARTH = 70 INVISIBLE = 0
WEEK_OF_AIR = 71 IDLE = 1
WEEK_OF_FIRENICE = 72 ONESHOT_STILL = 2
WEEK_OF_MIGHT = 73 ONESHOT = 3
HERO IDs

WEEK_OF_BALANCE = 74 MOVE = 4
WEEK_OF_MIGHTNMAGIC = 75 NON_ESSENTIAL = 5
WEEK_OF_INFIRMITY = 76
WEEK_OF_LIGHT = 77
WEEK_OF_EVOCATION = 78
WEEK_OF_ABJURATION = 79 8.28. Disabled interactive objects modes
OTHER IDs

WEEK_OF_ALTERATION = 80 DISABLED_DEFAULT = 0
WEEK_OF_CONJURATION = 81 DISABLED_ATTACK = 1
WEEK_OF_ETHER = 82 DISABLED_INTERACT = 2
WEEK_OF_TOUGHNESS = 83 DISABLED_BLOCKED = 3
WEEK_OF_PEASANT = 84
WEEK_OF_ARCHER = 85
WEEK_OF_FOOTMAN = 86

26
Other IDs
8.29. Region Auto Action modes CREATURE_ARCHANGEL = 14

SCRIPT FILE LAYOUT


REGION_AUTOACTION_ON_ENTER = 1 CREATURE_FAMILIAR = 15
REGION_AUTOACTION_ON_EXIT = 2 CREATURE_IMP = 16
CREATURE_DEMON = 17
CREATURE_HORNED_DEMON = 18
CREATURE_HELL_HOUND = 19
8.30. Region Auto Action enable variants CREATURE_CERBERI = 20
REGION_AUTOACTION_OBJECT_NO_ACTION = -1 CREATURE_SUCCUBUS = 21
REGION_AUTOACTION_OBJECT_DISABLE = 0 CREATURE_INFERNAL_SUCCUBUS = 22
REGION_AUTOACTION_OBJECT_ENABLE = 1 CREATURE_NIGHTMARE = 23
CREATURE_FRIGHTFUL_NIGHTMARE = 24
CREATURE_PIT_FIEND = 25
CREATURE_BALOR = 26
8.31. Heroes Roles Modes

SYNTAX
CREATURE_DEVIL = 27
NOTE: for SetHeroRoleMode(heroName,roleMode) script CREATURE_ARCHDEVIL = 28
commmand CREATURE_SKELETON = 29
HERO_ROLE_MODE_REGULAR = 0 CREATURE_SKELETON_ARCHER = 30
HERO_ROLE_MODE_FREEMAN = 1 -- always CREATURE_WALKING_DEAD = 31
Freelancer CREATURE_ZOMBIE = 32

VARIABLES
HERO_ROLE_MODE_HERMIT = 2 -- always CREATURE_MANES = 33
Freelancer, never interact with CREATURE_GHOST = 34
other heroes CREATURE_VAMPIRE = 35
CREATURE_VAMPIRE_LORD = 36
CREATURE_LICH = 37
CREATURE_DEMILICH = 38
8.32. Players Teams constants

FUNCTIONS
CREATURE_WIGHT = 39
PLAYERS_TEAM_1 = 1 CREATURE_WRAITH = 40
PLAYERS_TEAM_2 = 2 CREATURE_BONE_DRAGON = 41
PLAYERS_TEAM_3 = 3 CREATURE_SHADOW_DRAGON = 42
PLAYERS_TEAM_4 = 4 CREATURE_PIXIE = 43
PLAYERS_TEAM_5 = 5 CREATURE_SPRITE = 44
PLAYERS_TEAM_6 = 6 CREATURE_BLADE_JUGGLER = 45
PLAYERS_TEAM_7 = 7 CREATURE_WAR_DANCER = 46

TRIGGERS
PLAYERS_TEAM_8 = 8 CREATURE_WOOD_ELF = 47
CREATURE_GRAND_ELF = 48
CREATURE_DRUID = 49
CREATURE_DRUID_ELDER = 50
8.33. Game difficulty IDs CREATURE_UNICORN = 51
DIFFICULTY_EASY = 0 CREATURE_WAR_UNICORN = 52

DEBUGGING
DIFFICULTY_NORMAL = 1 CREATURE_TREANT = 53
DIFFICULTY_HARD = 2 CREATURE_TREANT_GUARDIAN = 54
DIFFICULTY_HEROIC = 3 CREATURE_GREEN_DRAGON = 55
CREATURE_GOLD_DRAGON = 56
CREATURE_GREMLIN = 57
CREATURE_MASTER_GREMLIN = 58
8.34. Creature IDs CREATURE_STONE_GARGOYLE = 59
CREATURE_UNKNOWN = 0 CREATURE_OBSIDIAN_GARGOYLE = 60
HERO IDs

CREATURE_PEASANT = 1 CREATURE_IRON_GOLEM = 61
CREATURE_MILITIAMAN = 2 CREATURE_STEEL_GOLEM = 62
CREATURE_ARCHER = 3 CREATURE_MAGI = 63
CREATURE_MARKSMAN = 4 CREATURE_ARCH_MAGI = 64
CREATURE_FOOTMAN = 5 CREATURE_GENIE = 65
CREATURE_SWORDSMAN = 6 CREATURE_MASTER_GENIE = 66
OTHER IDs

CREATURE_GRIFFIN = 7 CREATURE_RAKSHASA = 67
CREATURE_ROYAL_GRIFFIN = 8 CREATURE_RAKSHASA_RUKH = 68
CREATURE_PRIEST = 9 CREATURE_GIANT = 69
CREATURE_CLERIC = 10 CREATURE_TITAN = 70
CREATURE_CAVALIER = 11 CREATURE_SCOUT = 71
CREATURE_PALADIN = 12 CREATURE_ASSASSIN = 72
CREATURE_ANGEL = 13 CREATURE_WITCH = 73

27
Other IDs
CREATURE_BLOOD_WITCH = 74 CREATURE_FIREBREATHER_HOUND = 133
SCRIPT FILE LAYOUT

CREATURE_MINOTAUR = 75 CREATURE_SUCCUBUS_SEDUCER = 134


CREATURE_MINOTAUR_KING = 76 CREATURE_HELLMARE = 135
CREATURE_RIDER = 77 CREATURE_PIT_SPAWN = 136
CREATURE_RAVAGER = 78 CREATURE_ARCH_DEMON = 137
CREATURE_HYDRA = 79 CREATURE_STALKER = 138
CREATURE_CHAOS_HYDRA = 80 CREATURE_BLOOD_WITCH_2 = 139
CREATURE_MATRON = 81 CREATURE_MINOTAUR_CAPTAIN = 140
CREATURE_MATRIARCH = 82 CREATURE_BLACK_RIDER = 141
CREATURE_DEEP_DRAGON = 83 CREATURE_ACIDIC_HYDRA = 142
CREATURE_BLACK_DRAGON = 84 CREATURE_SHADOW_MISTRESS = 143
CREATURE_FIRE_ELEMENTAL = 85 CREATURE_RED_DRAGON = 144
CREATURE_WATER_ELEMENTAL = 86 CREATURE_DRYAD = 145
SYNTAX

CREATURE_EARTH_ELEMENTAL = 87 CREATURE_BLADE_SINGER = 146


CREATURE_AIR_ELEMENTAL = 88 CREATURE_SHARP_SHOOTER = 147
CREATURE_DEATH_KNIGHT = 90 CREATURE_HIGH_DRUID = 148
CREATURE_PHOENIX = 91 CREATURE_WHITE_UNICORN = 149
CREATURE_DEFENDER = 92 CREATURE_ANGER_TREANT = 150
CREATURE_STOUT_DEFENDER = 93 CREATURE_RAINBOW_DRAGON = 151
VARIABLES

CREATURE_AXE_FIGHTER = 94 CREATURE_SKELETON_WARRIOR = 152


CREATURE_AXE_THROWER = 95 CREATURE_DISEASE_ZOMBIE = 153
CREATURE_BEAR_RIDER = 96 CREATURE_POLTERGEIST = 154
CREATURE_BLACKBEAR_RIDER = 97 CREATURE_NOSFERATU = 155
CREATURE_BROWLER = 98 CREATURE_LICH_MASTER = 156
CREATURE_BERSERKER = 99 CREATURE_BANSHEE = 157
FUNCTIONS

CREATURE_RUNE_MAGE = 100 CREATURE_HORROR_DRAGON = 158


CREATURE_FLAME_MAGE = 101 CREATURE_GREMLIN_SABOTEUR = 159
CREATURE_THANE = 102 CREATURE_MARBLE_GARGOYLE = 160
CREATURE_WARLORD = 103 CREATURE_OBSIDIAN_GOLEM = 161
CREATURE_FIRE_DRAGON = 104 CREATURE_COMBAT_MAGE = 162
CREATURE_MAGMA_DRAGON = 105 CREATURE_DJINN_VIZIER = 163
CREATURE_LANDLORD = 106 CREATURE_RAKSHASA_KSHATRI = 164
CREATURE_LONGBOWMAN = 107 CREATURE_STORM_LORD = 165
TRIGGERS

CREATURE_VINDICATOR = 108 CREATURE_STONE_DEFENDER = 166


CREATURE_BATTLE_GRIFFIN = 109 CREATURE_HARPOONER = 167
CREATURE_ZEALOT = 110 CREATURE_WHITE_BEAR_RIDER = 168
CREATURE_CHAMPION = 111 CREATURE_BATTLE_RAGER = 169
CREATURE_SERAPH = 112 CREATURE_FLAME_KEEPER = 170
CREATURE_WOLF = 113 CREATURE_THUNDER_THANE = 171
DEBUGGING

CREATURE_SNOW_APE = 114 CREATURE_LAVA_DRAGON = 172


CREATURE_MANTICORE = 115 CREATURE_GOBLIN_DEFILER = 173
CREATURE_MUMMY = 116 CREATURE_CENTAUR_MARADEUR = 174
CREATURE_ORC_WARMONGER = 175
-- Creatures added by ToTE -- CREATURE_SHAMAN_HAG = 176
CREATURE_GOBLIN = 117 CREATURE_ORCCHIEF_CHIEFTAIN = 177
CREATURE_GOBLIN_TRAPPER = 118 CREATURE_WYVERN_PAOKAI = 178
CREATURE_CENTAUR = 119 CREATURE_CYCLOP_BLOODEYED = 179
HERO IDs

CREATURE_CENTAUR_NOMAD = 120 CREATURES_COUNT = 180


CREATURE_ORC_WARRIOR = 121
CREATURE_ORC_SLAYER = 122
CREATURE_SHAMAN = 123
CREATURE_SHAMAN_WITCH = 124 8.35. War machines IDs
CREATURE_ORCCHIEF_BUTCHER = 125 WAR_MACHINE_BALLISTA = 1
OTHER IDs

CREATURE_ORCCHIEF_EXECUTIONER = 126 WAR_MACHINE_CATAPULT = 2


CREATURE_WYVERN = 127 WAR_MACHINE_FIRST_AID_TENT = 3
CREATURE_WYVERN_POISONOUS = 128 WAR_MACHINE_AMMO_CART = 4
CREATURE_CYCLOP = 129
CREATURE_CYCLOP_UNTAMED = 130
CREATURE_QUASIT = 131
CREATURE_HORNED_LEAPER = 132

28
Other IDs
8.36. Spell IDs SPELL_DEATH_SCREAM = 59;

SCRIPT FILE LAYOUT


SPELL_NONE = 0; SPELL_SNIPE_DEAD = 60;
SPELL_MAGIC_ARROW = 1; SPELL_MULTISHOT = 61;
SPELL_MAGIC_FIST = 2; SPELL_IMBUE_ARROW = 62;
SPELL_LIGHTNING_BOLT = 3; SPELL_ABILITY_MAGIC_BOND = 63;
SPELL_ICE_BOLT = 4; SPELL_ABILITY_MELT_ARTIFACT = 64;
SPELL_FIREBALL = 5; SPELL_ABILITY_COUNTERSPELL = 65;
SPELL_FROST_RING = 6; SPELL_ABILITY_UNSUMMON = 66;
SPELL_CHAIN_LIGHTNING = 7; SPELL_ABILITY_DARK_RITUAL = 67;
SPELL_METEOR_SHOWER = 8; SPELL_SKILL_OFFENCE1 = 68;
SPELL_IMPLOSION = 9; SPELL_SKILL_OFFENCE2 = 69;
SPELL_ARMAGEDDON = 10; SPELL_SKILL_OFFENCE3 = 70;
SPELL_CURSE = 11; SPELL_SKILL_ARCHERY = 71;

SYNTAX
SPELL_SLOW = 12; SPELL_SKILL_FRENZY = 72;
SPELL_DISRUPTING_RAY = 13; SPELL_SKILL_DEFENCE1 = 73;
SPELL_PLAGUE = 14; SPELL_SKILL_DEFENCE2 = 74;
SPELL_WEAKNESS = 15; SPELL_SKILL_DEFENCE3 = 75;
SPELL_ABILITY_WEAKNING_STRIKE = 16; SPELL_SKILL_PROTECTION = 76;
SPELL_FORGETFULNESS = 17; SPELL_SKILL_EVASION = 77;

VARIABLES
SPELL_BERSERK = 18; SPELL_SKILL_TOUGHNESS = 78;
SPELL_BLIND = 19; SPELL_SKILL_LUCK1 = 79;
SPELL_HYPNOTIZE = 20; SPELL_SKILL_LUCK2 = 80;
SPELL_UNHOLY_WORD = 21; SPELL_SKILL_LUCK3 = 81;
SPELL_UNHOLY_WORD_HIT_EFFECT = 22; SPELL_SKILL_RESISTANCE = 82;
SPELL_BLESS = 23; SPELL_SKILL_LUCKY_STRIKE = 83;

FUNCTIONS
SPELL_HASTE = 24; SPELL_SKILL_LEADERSHIP1 = 84;
SPELL_STONESKIN = 25; SPELL_SKILL_LEADERSHIP2 = 85;
SPELL_DISPEL = 26; SPELL_SKILL_LEADERSHIP3 = 86;
SPELL_DISPEL_FAIL = 27; SPELL_SKILL_WAR_MACHINES1 = 87;
SPELL_BLOODLUST = 28; SPELL_SKILL_WAR_MACHINES2 = 88;
SPELL_DEFLECT_ARROWS = 29; SPELL_SKILL_WAR_MACHINES3 = 89;
SPELL_DEFLECT_ARROWS_HIT_EFFECT = 30; SPELL_SKILL_FIRST_AID = 90;
SPELL_ANTI_MAGIC = 31; SPELL_SKILL_BALLISTA = 91;

TRIGGERS
SPELL_TELEPORT = 32; SPELL_SKILL_CATAPULT = 92;
SPELL_TELEPORT_FINISH_EFFECT = 33; SPELL_SKILL_DEMONIC_FIRE = 93;
SPELL_CELESTIAL_SHIELD = 34; SPELL_SKILL_ELVEN_VOLLEY = 94;
SPELL_HOLY_WORD = 35; SPELL_SKILL_MATRON_SALVO = 95;
SPELL_HOLY_WORD_HIT_EFFECT = 36; SPELL_SKILL_ANCIENT_SMITHY = 96;
SPELL_ARMAGEDDON_HIT_EFFECT = 37; SPELL_SKILL_FIRE_PROTECTION = 97;

DEBUGGING
SPELL_LAND_MINE = 38; SPELL_SPEC_JOUSTER = 98;
SPELL_WASP_SWARM = 39; SPELL_SPEC_PEASANTS = 99;
SPELL_PHANTOM = 40; SPELL_SPEC_ARCHERS = 100;
SPELL_EARTHQUAKE = 41; SPELL_SPEC_FOOTMEN = 101;
SPELL_ANIMATE_DEAD = 42; SPELL_SPEC_GRIFFINS = 102;
SPELL_SUMMON_ELEMENTALS = 43; SPELL_SPEC_ARTILLERYMAN = 103;
SPELL_EFFECT_SUMMON_ELEMENTALS_AIR = 44; SPELL_SPEC_FURIOUS = 104;
SPELL_EFFECT_SUMMON_ELEMENTALS_EARTH = 45; SPELL_SPEC_BOMBARDIER = 105;
HERO IDs

SPELL_EFFECT_SUMMON_ELEMENTALS_FIRE = 46; SPELL_SPEC_IMPREGNABLE = 106;


SPELL_EFFECT_SUMMON_ELEMENTALS_WATER = 47; SPELL_SPEC_FLAGBEARER_OF_DARKNESS = 107;
SPELL_RESURRECT = 48; SPELL_SPEC_HOUNDS = 108;
SPELL_SUMMON_BOAT = 49; SPELL_SPEC_SUCCUBUSES = 109;
SPELL_DIMENSION_DOOR = 50; SPELL_SPEC_BLADE_MASTER = 110;
SPELL_TOWN_PORTAL = 51; SPELL_SPEC_ELVES = 111;
OTHER IDs

SPELL_ENCOURAGE = 52; SPELL_SPEC_UNICORNS = 112;


SPELL_HOLY_CHARGE = 53; SPELL_SPEC_ELVEN_FURY = 113;
SPELL_PRAYER = 54; SPELL_SPEC_FOREST_GUARDIAN = 114;
SPELL_DEMONIC_STRIKE_CAST = 55; SPELL_SPEC_ZOMBIES = 115;
SPELL_DEMONIC_STRIKE = 56; SPELL_SPEC_VAMPIRES = 116;
SPELL_CONSUME_CORPSE = 57; SPELL_SPEC_EMPIRIC = 117;
SPELL_SPIRIT_LINK = 58; SPELL_SPEC_SOULHUNTER = 118;

29
Other IDs
SPELL_SPEC_MASTER_OF_ELEMENTS = 119; SPELL_EFFECT_ARMOR_CRUSHING = 179;
SCRIPT FILE LAYOUT

SPELL_SPEC_GREMLINS = 120; SPELL_ABILITY_POISONOUS_ATTACK = 180;


SPELL_SPEC_GOLEMS = 121; SPELL_LIZARD_BITE_HIT = 181;
SPELL_SPEC_MAGES = 122; SPELL_EFFECT_REGENRATION = 182;
SPELL_SPEC_PRUDENT = 123; SPELL_EFFECT_REBIRTH = 183;
SPELL_SPEC_EVASIVE = 124; SPELL_ABILITY_FROST_BREATH = 184;
SPELL_SPEC_RIDERS = 125; SPELL_EFFECT_BAD_LUCK = 185;
SPELL_SPEC_MATRON_SALVO = 126; SPELL_EFFECT_GOOD_LUCK = 186;
SPELL_SPEC_SAVAGE = 127; SPELL_EFFECT_BAD_MORALE = 187;
SPELL_SPEC_WITCHES = 128; SPELL_EFFECT_GOOD_MORALE = 188;
SPELL_SPEC_MINOTAURS = 129; SPELL_EFFECT_FIRST_AID_TENT_HEAL = 189;
SPELL_TOWN_OFFENCE_P1 = 130; SPELL_EFFECT_CLERIC_HIT = 190;
SPELL_TOWN_OFFENCE_M1 = 131; SPELL_EFFECT_COMBAT_HIT_00 = 191;
SYNTAX

SPELL_TOWN_DEFENCE_P1 = 132; SPELL_EFFECT_COMBAT_HIT_01 = 192;


SPELL_TOWN_DEFENCE_M1 = 133; SPELL_EFFECT_COMBAT_HIT_02 = 193;
SPELL_TOWN_OFFENCE_DEFENCE_P1 = 134; SPELL_EFFECT_WAR_MACHINE_HIT = 194;
SPELL_TOWN_OFFENCE_DEFENCE_M1 = 135; SPELL_EFFECT_FIRST_AID_HIT = 195;
SPELL_TOWN_OFFENCE_P2 = 136; SPELL_EFFECT_FIRE_HIT = 196;
SPELL_TOWN_OFFENCE_M2 = 137; SPELL_EFFECT_BASH_HIT = 197;
VARIABLES

SPELL_TOWN_DEFENCE_P2 = 138; SPELL_EFFECT_SUN_FIRE = 198;


SPELL_TOWN_DEFENCE_M2 = 139; SPELL_EFFECT_SOIL_BURN = 199;
SPELL_TOWN_OFFENCE_DEFENCE_P2 = 140; SPELL_EFFECT_CATAPULT_CHARGE_EXPLOSION = 200;
SPELL_TOWN_OFFENCE_DEFENCE_M2 = 141; SPELL_EFFECT_FROZEN = 201;
SPELL_TOWN_LUCK_P1 = 142; SPELL_EFFECT_FIRE_DAMAGE = 202;
SPELL_TOWN_LUCK_M1 = 143; SPELL_EFFECT_LAND_MINE_EXPLOSION = 203;
FUNCTIONS

SPELL_TOWN_MORALE_P1 = 144; SPELL_EFFECT_PHANTOM_OUT = 204;


SPELL_TOWN_MORALE_M1 = 145; SPELL_EFFECT_FIRE_SHIELD = 205;
SPELL_TOWN_ELVEN_CAPITAL = 146; SPELL_EFFECT_DIMENSION_DOOR_END = 206;
SPELL_TOWN_WALLS = 147; SPELL_SKILL_CHILLING_BONES = 207;
SPELL_TOWN_TOWERS = 148; SPELL_DEBUG_TELEPORT = 208;
SPELL_TOWN_UNHOLY_TEMPLE = 149; SPELL_ABILITY_ENRAGED = 209;
SPELL_TOWN_DARK_GUARDIAN = 150; SPELL_MASS_CURSE = 210;
SPELL_TOWN_SPARKLING_FOUNTAIN = 151; SPELL_MASS_DISRUPTING_RAY = 211;
TRIGGERS

SPELL_TOWN_DIETY_OF_FIRE = 152; SPELL_MASS_SLOW = 212;


SPELL_TOWN_INFERNAL_LOOM = 153; SPELL_MASS_FORGETFULNESS = 213;
SPELL_ABILITY_BATTLE_DIVE = 154; SPELL_MASS_PLAGUE = 214;
SPELL_ABILITY_BATTLE_DIVE_FINISH = 155; SPELL_MASS_WEAKNESS = 215;
SPELL_ABILITY_LAY_HANDS = 156; SPELL_MASS_BLESS = 216;
SPELL_ABILITY_RESURRECT_ALLIES = 157; SPELL_MASS_DISPEL = 217;
DEBUGGING

SPELL_ABILITY_SCATTER_SHOT = 158; SPELL_MASS_STONESKIN = 218;


SPELL_ABILITY_GATING = 159; SPELL_MASS_DEFLECT_ARROWS = 219;
SPELL_ABILITY_FEAR = 160; SPELL_MASS_BLOODLUST = 220;
SPELL_ABILITY_SUMMON_BALOR = 161; SPELL_MASS_HASTE = 221;
SPELL_ABILITY_EXPLOSION = 162; SPELL_ABILITY_CALL_LIGHTNING = 222;
SPELL_ABILITY_EXPLOSION_EFFECT = 163; SPELL_EMPOWERED_MAGIC_ARROW = 223;
SPELL_ABILITY_CHAIN_SHOT_END_EFFECT = 164; SPELL_EMPOWERED_MAGIC_FIST = 224;
SPELL_ABILITY_MANA_DESTROY = 165; SPELL_EMPOWERED_LIGHTNING_BOLT = 225;
HERO IDs

SPELL_ABILITY_MANA_STEAL = 166; SPELL_EMPOWERED_ICE_BOLT = 226;


SPELL_ABILITY_LIFE_DRAIN = 167; SPELL_EMPOWERED_FIREBALL = 227;
SPELL_ABILITY_MANA_DRAIN = 168; SPELL_EMPOWERED_FROST_RING = 228;
SPELL_ABILITY_DEATH_CLOUD = 169; SPELL_EMPOWERED_CHAIN_LIGHTNING = 229;
SPELL_ABILITY_HARM_TOUCH = 170; SPELL_EMPOWERED_METEOR_SHOWER = 230;
SPELL_ABILITY_MANA_FEED = 171; SPELL_EMPOWERED_IMPLOSION = 231;
OTHER IDs

SPELL_ABILITY_ENTANGLING_ROOTS = 172; SPELL_EMPOWERED_ARMAGEDDON = 232;


SPELL_ABILITY_REPAIR = 173; SPELL_EMPOWERED_STONE_SPIKES = 233;
SPELL_ABILITY_RANDOM_CAST_DARK = 174; SPELL_SUMMON_CREATURES = 234;
SPELL_ABILITY_RANDOM_CAST_DARK_LIGHT = 175; SPELL_CONJURE_PHOENIX = 235;
SPELL_ABILITY_DASH = 176; SPELL_FIREWALL = 236;
SPELL_ABILITY_DASH_EFFECT = 177; SPELL_STONE_SPIKES = 237;
SPELL_REMOTE_CONTROL = 178; SPELL_UBER_CHAIN_LIGHTNING = 238;

30
Other IDs
SPELL_DEMON_SOVEREIGN_FX = 239; SPELL_BLADE_BARRIER = 284;

SCRIPT FILE LAYOUT


SPELL_SORROW = 277; SPELL_WARCRY_RALLING_CRY = 290;
SPELL_VAMPIRISM = 278; SPELL_WARCRY_CALL_OF_BLOOD = 291;
SPELL_DEEP_FREEZE = 279; SPELL_WARCRY_WORD_OF_THE_CHIEF = 292;
SPELL_REGENERATION = 280; SPELL_WARCRY_FEAR_MY_ROAR = 293;
SPELL_DIVINE_VENGEANCE = 281; SPELL_WARCRY_BATTLECRY = 294;
SPELL_ARCANE_CRYSTAL = 282; SPELL_WARCRY_SHOUT_OF_MANY = 295;
SPELL_SUMMON_HIVE = 283;

SYNTAX
VARIABLES
FUNCTIONS
TRIGGERS
DEBUGGING
HERO IDs
OTHER IDs

31
OTHER IDs HERO IDs DEBUGGING TRIGGERS FUNCTIONS VARIABLES SYNTAX SCRIPT FILE LAYOUT Hero IDs

32
www.celestialheavens.com
Visit Celestial Heavens online

You might also like