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

Defending trigger

Status
Not open for further replies.
Level 4
Joined
Jul 22, 2012
Messages
72
I need help, I am trying to get (2) units to spawn at a region to defend it when It is attacked, and I would like them to Spawn Every (10 secs?) or so.
If you could give any help on that I'd appreciate it very much = ).
btw I am useing Standard system world editor.
 
Last edited:
Level 3
Joined
May 22, 2012
Messages
50
That's an easy one...


  • Example
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 TestUnit for Player 1 (Red) at (Center of (Region)) facing Default building facing degrees
      • Unit - Create 1 TestUnit for Player 1 (Red) at (Center of (Region)) facing Default building facing degrees
 
Or this:

  • Example
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • Set TempLoc = (Center of YourRegion)
      • Unit - Create 2 TestUnit for (YourPlayer) at TempLoc facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempLoc)
This one doesn't leak.

edit
The units created will automatically attack units in range.

edit
It depends on their acquisition range though. (Which you can edit in the Object editor)
 
Level 4
Joined
Jul 22, 2012
Messages
72
Well They spawn but only one time. now, I want them to spawn every (seconds) when a enemy unit is in region. And they spawn 10 secs in game not when I enter.
 
Last edited:
Level 3
Joined
May 22, 2012
Messages
50
Oops.... Um, just change the event... There's one that says "Time - Periodic Event" Just change it to that, and your all set!
 
Oh, sorry about that.

  • Spawn
    • Events
      • Timer - Every 10.00 seconds of game time.
    • Conditions
    • Actions
      • Set TempLoc = (Center of YourRegion)
      • Unit - Create 2 TestUnit for (YourPlayer) at TempLoc facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempLoc)
Spawn should be initially off.

  • OnEnter
    • Events
      • A unit enters region
    • Conditions
      • (Owner of triggering unit) not equal to Neutral hostile
    • Actions
      • Set count = (count + 1)
      • Trigger - Turn on Spawn <gen>
      • If count == 1 then
        • Trigger - Execute Spawn <gen>
  • OnLeave
    • Events
      • A unit leaves region
    • Conditions
      • (Owner of triggering unit) not equal to Neutral hostile
    • Actions
      • Set count = count - 1
      • If count == 0 then
        • Trigger - Turn off Spawn <gen>
Something like this should work.
 
Level 3
Joined
May 22, 2012
Messages
50
Oh, sorry about that.

  • Spawn
    • Events
      • Timer - Every 10.00 seconds of game time.
    • Conditions
    • Actions
      • Set TempLoc = (Center of YourRegion)
      • Unit - Create 2 TestUnit for (YourPlayer) at TempLoc facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempLoc)
Spawn should be initially off.

  • OnEnter
    • Events
      • A unit enters region
    • Conditions
      • (Owner of triggering unit) not equal to Neutral hostile
    • Actions
      • Set count = (count + 1)
      • Trigger - Turn on Spawn <gen>
      • If count == 1 then
        • Trigger - Execute Spawn <gen>
  • OnLeave
    • Events
      • A unit leaves region
    • Conditions
      • (Owner of triggering unit) not equal to Neutral hostile
    • Actions
      • Set count = count - 1
      • If count == 0 then
        • Trigger - Turn off Spawn <gen>
Something like this should work.

Ooh look at that, cool! So that will be make it so you can make spawners, but not spawn too many? I've been trying to figure THAT out :D YOU SIR, helped out TWO people, in ONE post! Talk about, two birds and one stone.
 
Status
Not open for further replies.
Top