• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,240
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)
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
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