in my map i have many zerglings. I want to periodically order a random amount of lings to move to their own position with random offset:
Unit - Order (Random Living unit from (Zergling units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most (Random integer between 0 and 15))) to ( Move targeting ((Position of (Triggering unit)) offset by ((Random real between -3.0 and 3.0), (Random real between -3.0 and 3.0)))) (Replace Existing Orders)
Now the the problem is that this event is periodical and there is no triggering unit, so this action doesn´t work. Instead of "triggering unit" i would need "ordered unit", but this function does not exist. So i need to create this function but i have absolutely no clue how to do this...?
Please let me know if you have an idea to create such a function or maybe know how to avoid the whole problem
Greetz Hueschel
Thanks for the fast reply. It helped much! My solution is now:
Actions
General - For each integer Integer from 0 to (Random integer between 0 and 30) with increment 1, do (Actions)
Actions
Unit Group - Add (Random Living unit from (Zergling units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) to Group
Unit Group - Pick each unit in Group and do (Actions)
Actions
Unit - Order (Picked unit) to ( Move targeting ((Position of (Picked unit)) offset by ((Random real between -3.0 and 3.0), (Random real between -3.0 and 3.0)))) (Replace Existing Orders)
Get a random number of lings, save it to a local variable
Get all zerglings in the region/ unit group you want, add them to a unit group
Pick each unit in the new unit group and order them to move targeting a point with offset. Offsets should be calculated via an equation or 2 depending on the amount of units that were picked.
Not perfect, but should do as you want it to do.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello,
in my map i have many zerglings. I want to periodically order a random amount of lings to move to their own position with random offset:
Unit - Order (Random Living unit from (Zergling units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most (Random integer between 0 and 15))) to ( Move targeting ((Position of (Triggering unit)) offset by ((Random real between -3.0 and 3.0), (Random real between -3.0 and 3.0)))) (Replace Existing Orders)
Now the the problem is that this event is periodical and there is no triggering unit, so this action doesn´t work. Instead of "triggering unit" i would need "ordered unit", but this function does not exist. So i need to create this function but i have absolutely no clue how to do this...?
Please let me know if you have an idea to create such a function or maybe know how to avoid the whole problem Greetz Hueschel
What about using a unit group loop? Something like this: (pseudocode)
The variable might not be needed, but it helps
@Kueken531: Go
Thanks for the fast reply. It helped much! My solution is now:
Actions General - For each integer Integer from 0 to (Random integer between 0 and 30) with increment 1, do (Actions)
Actions
Unit Group - Add (Random Living unit from (Zergling units in (Entire map) owned by player 5 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) to Group Unit Group - Pick each unit in Group and do (Actions)
Actions
Unit - Order (Picked unit) to ( Move targeting ((Position of (Picked unit)) offset by ((Random real between -3.0 and 3.0), (Random real between -3.0 and 3.0)))) (Replace Existing Orders)
Unit Group - Remove all units from Group
tutorial section is not for questions., moved
Not perfect, but should do as you want it to do.