[Trigger] How to pick last created units

Status
Not open for further replies.
Level 8
Joined
Sep 24, 2007
Messages
303
Create 9 footman at poz etc etc

In next step, I need to pick all 9 last created units. How to do this? "Last created unit" picks only 1. I would need to store them in a group or something.

Picking units in region is not an option.
 
use a loop. it will also help with lag since triggers that create many units at the same time, at the same point seem to lag.
  • For each (Integer A) from 1 to 9, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Footman for SOME_PLAYER at SOME_POINT facing Default building facing degrees
      • Unit Group - Add (Last created unit) to SOME_UNIT_GROUP
then later you can do:
  • Unit Group - Pick every unit in SOME_UNIT_GROUP and do (Actions)
    • Loop - Actions
      • Do stuff
 
no no and no!

use last created group to get 9 footmans! btw you must destroy that last created group so first set in in a var!

  • Footman
    • Events
    • Conditions
    • Actions
      • Unit - Create 9 Footman for Player 1 (Red) at (TempPoint) facing Default building facing degrees
      • Set Footmans = (Last created unit group)
      • -------- do something with them --------
      • Custom script: call DestroyGroup(udg_Footmans)
thats how u should do it!

Greets!
~Dark Dragon
 
Status
Not open for further replies.
Back
Top