Have a problem in scripting
I've got the problem in writing script. I want to spawn group of knights, when the players troop reach position X, and then, to attack player with them. But, I don't know how to do it. This one isn't validated '[Error] (9:56): Type mismatch'. When i delete 'Knights :=' near Actions, is validated, but they don't attack. Also, they don't spawn correctly. When < 93, they spawn immediately (but my troop are below 93 on the Map editor!), when >93, they don't spawn at all. No idea what to do.
- Code:
var Knights: Integer; var Scout: Integer; procedure OnMissionStart; begin Scout := Actions.GiveGroup(0, 21, 51, 108, 0, 3, 3); if States.UnitPositionY(Scout) < 93 then Knights := Actions.GroupOrderAttackUnit(Knights, Scout); if States.UnitPositionY(Scout) < 94 then Knights := Actions.GiveGroup(1, 24, 58, 90, 6, 9, 3); end;
1. Could someone explain me more about var and integer - what they are and what they are using for?
2. How to attribute UnitID to unit, which I placed on the map in KAM Remake Map Editor (and do the same for buildings)?
3. How to order specific group attack not unit, but the whole player's army?