• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Random Question

Status
Not open for further replies.
Level 3
Joined
Aug 12, 2008
Messages
34
Just a random question... if I have a trigger lookin' like this;
  • Unit - Order Footman 0042 <gen> to Undead Crypt Lord - Impale (Position of (Random unit from (Units within 1500.00 of (Position of Footman 0042 <gen>) matching (((Matching unit) belongs to an enemy of Player 3 (Teal)) Equal to True))))
  • Unit - Create 1 Point Marker for Player 3 (Teal) at (Position of (Picked unit)) facing (Position of Footman<gen>)
  • Set PointMARK = (Last created unit)
What would the randomly picked unit be targeted as, if it should be stored as a variable? I have tried to place the dummy at a triggering unit, picked, matching and target of ability being cast, while none is working. Any suggestions? :)

(Btw, the point marker is a dummy which indicates where the Footman should be targeting his impale, as it gives the other units time to get away [impale has 3 sec. casting time]).

~Razorwind~
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Create a point variable and a unit variable. The bj_wantDestroyGroup destroys the created group so a leak does not occur. The random unit is stored in un variable.

  • Untitled Trigger 004
    • Events
    • Conditions
    • Actions
      • Set poin = (Position of Knight 0032 <gen>)
      • Custom script: set bj_wantDestroyGroup = true
      • Set un = (Random unit from (Units within 512.00 of poin matching...
      • --do actions here--
      • Custom script: call RemoveLocation(udg_poin)
 
Your trigger leaks and no, you can not refer to that random unit with any reference, except you add it to unit group and afterwards use action Pick all units in (...) or store given unit in variable.

Things that leak.

Your trigger:
  • Actions
    • Set temppoint1 = (Position of Footman 0042 <gen>)
    • Custom script: set bj_wantDestroyGroup = true
    • Set tempunit = (Random unit from (Units within 1500.00 of temppoint1 matching (((Matching unit) belongs to an enemy of Player 3 (Teal)) Equal to True)))))
    • Set temppoint2 = (Position of tempunit)
    • Unit - Order Footman 0042 <gen> to Undead Crypt Lord - Impale temppoint2
    • Unit - Create 1 Point Marker for Player 3 (Teal) at temppoint1 facing temppoint2
    • Set PointMARK = (Last created unit)
    • Custom script: call RemoveLocation(udg_temppoint1)
    • Custom script: call RemoveLocation(udg_temppoint2)
EDIT: I saw that, Maker your trigger leaks :D
 
Level 3
Joined
Aug 12, 2008
Messages
34
Ah, I see - didn't think about that - thanks to both of you :)

And btw, this wasn't the whole trigger, just a part of it. Thank you for reminding me of it tho. :D
 
Status
Not open for further replies.
Top