• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Random units in region

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2012
Messages
19
I'm making a spell that spawns a spike under 2 random units in region and deal periodic damage every 2 seconds until spike dies. My problem is making spike spawn under random units, can't seem to do anything else other than specific units. I have the rest of thr spell set. Just want to figure out how to do random units
 
Level 8
Joined
Oct 26, 2008
Messages
387
Create a unit group, and then add two units in it, so the do the line below twice.


  • Unit Group - Add (Random unit from (Units in (Region))) to (UnitGroup)
Then pick every unit in that unit group and do your spike thing.

Edit also, may i suggest conditions, to stop this action if the unit is a building/dead/ally/self
 
Level 4
Joined
Sep 6, 2012
Messages
19
Unit - Bone Wraith 0112 <gen> Finishes casting an ability[/TRIGGER]

  • (Ability being cast) Equal to Bladestorm (Marrow)
  • Countdown Timer - Start Spikemarrow as a Repeating timer that will expire in 20.00 seconds
next trigger


  • Time - Spikemarrow expires
  • Unit Group - Add all units of (Random 2 units from (Units in Marrowgarfight <gen>)) to randomunits
  • If ((Unit-type of (Picked unit)) Equal to Lord Marrowgar) then do (Unit Group - Add (Random unit from (Units in Marrowgarfight <gen>)) to randomunits2) else do (If ((Picked unit) Equal to (Random unit from randomunits)) then do (Unit Group - Add (Random unit from (Units in Marrowgarfight <gen>)) to randomunits) else do (Do nothing))
  • Countdown Timer - Start Spikedamage as a Repeating timer that will expire in 2.00 seconds
  • Wait 1.00 seconds
  • Unit - Create 1 SPIKE (Level 1) for Player 12 (Brown) at (Position of (Random unit from (Random 2 units from randomunits))) facing (Position of (Triggering unit))
  • Unit - Cause (Last created unit) to damage (Random unit from (Random 2 units from randomunits)), dealing 500.00 damage of attack type Chaos and damage type Magic
  • Wait 0.50 seconds
  • Unit Group - Pick every unit in randomunits and do (Unit - Pause (Picked unit))
next trigger


  • Time - Spikedamage expires
  • Unit - Cause Bone Wraith 0112 <gen> to damage (Random unit from (Last created unit group)), dealing 400.00 damage of attack type Chaos and damage type Divine
next trigger

  • Unit - A unit Dies
  • (Triggering unit) Equal to (Random unit from (Units of type SPIKE (Level 1)))
  • Countdown Timer - Pause Spikedamage
Unit Group - Pick every unit in randomunits and do (Unit - Unpause (Picked unit))[/TRIGGER]

END




somewhere in here im getting multiples of the SPIKES at both units and in my IF/Then/Else i believe i have it set to not pick Lord Marrowgar, but it still picks him sometimes
 
Last edited:
Level 8
Joined
Oct 26, 2008
Messages
387
please add your triggers correctly. Go in your trigger, right click on the trigger name (on the panel where the *events/conditions/actions* are) and click "copy as text" then come here, paste them, and trigger tag them.
  • /trigger] thing.
 
Status
Not open for further replies.
Top