• 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.

[General] Buildable Traps

Status
Not open for further replies.
Level 3
Joined
Jan 4, 2009
Messages
45
Hello. I am trying to make buildable traps. I have a worker called security master, who can build circle of power, which is invisible, and when an enemy unit steps on it it should trigger the trap. But I don't know how to make it work. I need help.
 
Level 7
Joined
Jan 29, 2010
Messages
213
make a trap with damage.
  • trap
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Unit - Create 1 "dummy unit" for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Default building facing degrees
      • Unit - Order (Last created unit) to "ability" (Attacked unit)
      • Unit - Remove (Last created unit) from the game
      • Unit - Remove (Attacking unit) from the game
This trigger goes on trap attacking range.
 
I would prefer much differend thing. Btw D0W3R, your triger leaks location.
Things that leaks

@Wolwy5 Trap triggers when enemy approaches it yes? Basically is means that unit is really close to the trap.

When you build a trap, add it to TrapGroup.
  • get trap
    • Events
      • Unit - A unit finishes construction
    • Conditions
      • (Unit-type of (Constructed unit)) Equals to <trap-unit here>
    • Actions
      • Unit Group - Add (Constructed unit) to TrapGroup
      • Trigger - Turn on loop <gen>
Loop trigger:
  • loop
    • Events
      • Time - Every 0.2 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TrapGroup and do Actions
        • Loop - Actions
          • Set tempu = (Picked unit)
          • Set p = (Position of tempu)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 25 of p matching (<condtions here, like if (Matching unit) isn't Building type, if it's alive and ofcourse if it's enemy ;) >)
            • Loop - Actions
              • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
                • If - Conditions
                  • (Picked unit) Not equal to No unit
                  • (tempu is in TrapGroup) Equal to True
                • Then - Actions
                  • // stuff here refered to traping target
                  • Unit - Kill tempu
                  • Unit Group - Remove tempu from TrapGroup
                  • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
                    • If - Conditions
                      • (TrapGroup is Empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
          • Custom script: call RemoveLocation(udg_p)
 
Status
Not open for further replies.
Top