Definition of animation variable:
v_<unit_variable.tag>, where unit_variable - any variable(you can also use user defined variables) of the current unit, tag - variable's tag(Value,Max,Increase,Enable,Percent).
Example: v_HitPoints.Value
Percent returns the proportion between Value and Max in range 0..100
t_<unit_variable.tag> - same as previous, but refers to unit's current goal unit(target in attack animation, mine in resource etc.). If goal doesn't exist, returns 0.
p_<playernum.property[.argument]> - where playernum - player's number(you can use "this" to refer the unit's player), property - player's property(see the GetPlayerData function for more information), optional <argument> - specifies the property's argument(need for resources and unit-types)
Examples: p_1.TotalUnitLimit p_this.Resources.gold
r_<value> - returns the random value between 0 and <value>
Though if vaiable couldn't be reconized, game will try to convert it into integer constant(0 will be returned if convertation fails).
[+]New actions in animations:
(modified) "spawn-missile <missile-type> <startx> <starty> <destx> <desty> <flags>" - spawns <missile-type> relative to the current unit adding <startx> and <starty> to position. <destx> and <desty> specify the missile's destination point. Could be used as more configurable replacement to the standard "attack" action. <flags> used to configure the action, you should specify it separated by points:
"damage" - missile will generate damage, values are taken from the action unit.
"totarget" - missile will ignore <destx> and <desty> and will fly to unit's current goal.
"pixel" - missile will use pixel coordinates instead of tile coordinates, useful for more accurate missile placing.
"reltarget" - the source of missile will be the unit's current target, so all parameters will be calculated depending of target's parameters, not source's(even the "totarget" will shot the missile back to source unit). Through the damage parameters are always taken from the source unit.
"ranged" - missile will check the current max and min attack ranges from the unit("reltarget" inverses logic)
"spawn-unit <unit-type> <offx> <offy> <range> <player>" - spawn <unit-type> relative to the current unit adding <offx> and <offy> to position. <range> specifies the maximum distatnce from the source unit.
Example: "spawn-unit unit-something 2 1 v_AttackRange.Value this"
"if-var <lvalue> <rvalue> <condition> <state>" - jump animation frame to label <state>, if <lvalue> is <condition> to <rvalue>
Possible conditions are:
1 - greater or equal
2 - greater
3 - less or equal
4 - less
5 - equal
6 - not equal
Example: this code will show different animation frames depending of unit's current health:
Still = {"if-var v_HitPoints.Percent 50 3 damaged50",
"frame 0", "wait 1", "frame 0", "wait 1","goto end",
"label damaged50",
"frame 1", "wait 1", "frame 1", "wait 1",
"label end"}
"set-var <var> <mod> <value>" - sets the current unit's <var> variable. <mod> specifies, how should be <value> applied to <var>:
1 - <value> will be added to <var>'s current value.
2 - <value> will be subtracted from <var>'s current value.
3 - <var>'s current value will be multiplied to <value>.
4 - <var>'s current value will be divided to <value>.
5 - <var>'s current value will be divided to <value> and remainder will be taken as value.
Warning: if <value> = 0 in 4 and 5, the game will bomb out with a error.
"set-player-var <player> <var> <value> <mod>[ <argument>]" - sets the <player>'s <var>. The <value> and <mod> are used same as in set-var. Optional <argument> - specifies the <var>'s argument(need for resources and unit-types)
"die[ <deathtype>]" - causes unit to die. If <deathtype> is set, unit will play his extra death animation depending on <deathtype>, if he has one.
[-]Health states in animations are removed, should use "if-var" animation to do this.
Patch frpm Cybermind
[+]New missile class, "missile-class-clip-to-target", this missile will remains clipped to target unit and will play it's animation once, then target will take the damage.
[+]Added CorrectSphashDamage flag in missiles for splash damages, you can use it to prevent damaging other units, which terrain type didn't match the missile's target's unit's terrain type (e.g. don't damage flyers if missile is targeted to land unit)
Patch from Cybermind
This will use the unit's Direction field to show different wall connections.
The unit should be a building and have NumDirections = 16 and Flip = false.
The wall unit didn't count in GetNumOpponents. When it attacked, AI didn't fight back and no warnings are shown.
NOTE: need to modify triggers, so they won't count the wall units when calculating player's remaining units. Not needed for those games which don't use this feature.
Wall mapping:
Frame 0 - wall without connections.
Frame 1 - wall with north connection.
Frame 2 - wall with west connection.
Frame 3 - wall with north and west connections.
Frame 4 - wall with south connection.
Frame 5 - wall with south and north connections.
Frame 6 - wall with south and west connections.
Frame 7 - wall with south, north and west connections.
Frame 8 - wall with east connection.
Frame 9 - wall with east and north connections.
Frame 10 - wall with east and west connections.
Frame 11 - wall with east, north and west connections.
Frame 12 - wall with east and south connections.
Frame 13 - wall with east, south and north connections.
Frame 14 - wall with east, south and west connections.
Frame 15 - wall with all connections.
patch from Cybermind.