• 🏆 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!

Traps every 10 seconds.

Status
Not open for further replies.
Level 10
Joined
Jan 20, 2011
Messages
492
Hey Hivers, I have a question about making random traps

I was wondering how to make a trigger, where every 10 seconds, a water splash occurs (special effect), randomly in a region (The region is about 2/3 the size of a 32/32 map), and if a unit is hit by the water splash, it deals 100 damage to the unit.

Any help would be much appreciated.
 
Last edited:
Level 23
Joined
Jan 1, 2009
Messages
1,610
  • Untitled Trigger 001
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set temp_pos = (Random point in (Playable map area))
      • Special Effect - Create a special effect at temp_pos using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in (Units within 512.00 of temp_pos) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
 
Level 14
Joined
Jul 12, 2011
Messages
1,370
You could also use this:
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • Unit - Create 1 Footman for Neutral Passive at (Random point in Region 012 <gen>) facing 270.00 degrees
    • Set TestVariable = (Last created unit)
    • Unit - Cause TestVariable to damage circular area after 0.00 seconds of radius 350.00 at (Position of TestVariable), dealing 99999.00 damage of attack type Chaos and damage type Normal
    • Wait 7.00 seconds
    • Unit - Kill TestVariable
Instead of footman create a dummy unit with the water model and replace it.
Region 12 is an example (obviously). Input the region you want in that place.
Radius 350 is also an example. Adjust the radius to you trigger needs.
TestVariable is a unit.
I hope I've helped.:goblin_good_job:
 
Level 10
Joined
Jan 20, 2011
Messages
492
@defskull, It's ok, I removed the leaks when I implemented his, so as long as I get the basic layout

  • Traps
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set TrapLoc = (Random point in Arena <gen>)
      • Special Effect - Create a special effect at TrapLoc using war3mapImported\AquaSpike.mdx
      • Special Effect - Destroy (Last created special effect)
      • Set TrapGroup = (Units within 325.00 of TrapLoc)
      • Unit Group - Pick every unit in TrapGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Not equal to Neutral Hostile
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TrapLoc)
      • Custom script: call DestroyGroup(udg_TrapGroup)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@CroMoX
Just use this to create temporary Unit Group
  • Custom script: set bj_wantDestroyGroup = true
  • ---HERE'S YOUR UNIT GROUP ACTION---
This way, you're saving 2 function call (which are setting Unit Group and destroying it), also saves you less 1 variable (no Unit Group variable).

Just remember to put that function call above Unit Group action to remove its leak without needing extra Unit Group variable.
 
Level 10
Joined
Jan 20, 2011
Messages
492
@CroMoX
Just use this to create temporary Unit Group
  • Custom script: set bj_wantDestroyGroup = true
  • ---HERE'S YOUR UNIT GROUP ACTION---
This way, you're saving 2 function call (which are setting Unit Group and destroying it), also saves you less 1 variable (no Unit Group variable).

Just remember to put that function call above Unit Group action to remove its leak without needing extra Unit Group variable.

Yeah ive seen people use that function call before, but never really wanted to use it cause im use to this way, but I shall use it to save me a variabe :)
 
Status
Not open for further replies.
Top