- Joined
- Jul 25, 2009
- Messages
- 3,091
Okay, this is the code, which I copied from Amig's squad system and modified to make it more efficient.
My idea was to make every unit but the leader an 'Aloc' unit that can attack and take damage, but is not selectable. I've seen it done before, so how do I do it, and if this is close why isn't it working?
My idea was to make every unit but the leader an 'Aloc' unit that can attack and take damage, but is not selectable. I've seen it done before, so how do I do it, and if this is close why isn't it working?
-
Else - Actions
- Set GPoint[1] = (Position of (Trained unit))
- Set GPoint[2] = (Rally-Point of (Triggering unit) as a point)
- Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Triggering unit)) at GPoint[1] facing (Facing of (Trained unit)) degrees
- Custom script: call UnitAddAbility(GetLastCreatedUnit(),'Aloc')
- Unit - Hide (Last created unit)
- Custom script: call UnitRemoveAbility(GetLastCreatedUnit(),'Aloc')
- Unit - Unhide (Last created unit)
- AI - Ignore (Last created unit)'s guard position
- Unit - Order (Last created unit) to Attack-Move To GPoint[2]
- Unit - Set the custom value of (Last created unit) to GNumber
- Custom script: call RemoveLocation(udg_GPoint[1])
- Custom script: call RemoveLocation(udg_GPoint[2])