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

[Trigger] Make only 5 units on a .10 periodic trigger.

Status
Not open for further replies.
Level 6
Joined
Apr 23, 2009
Messages
94
  • Melee Initialization
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
My trigger has this basis for creating the units in it. But i can't seem to limit the amount of units created, for instance:

The trigger is turned on, and only turns off once a certain unit has died. But it SHOULD create 1 unit for every enemy unit within a 350 range, a max of 5 units total. I can get it to create 1 or 2 or 3 or 4 or 5.. but once the trigger periodically goes again, it creates said units AGAIN.

Is there a way to make it create the units only once, or check if there is a difference in units, and create as much units as needed? Having something else turn the trigger off isn't an option. This is really frustrating, and it's really hot where i live! :cry:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Jepaa
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in RespawnGroup) Less than 5
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (blah blah) facing Default building facing (270.0) degrees
          • Unit Group - Add (Last created unit) to RespawnGroup
        • Else - Actions
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in RespawnGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from RespawnGroup
For the first trigger, you can also create an unit group that contains all hostile units withing range of certain point, and use the number of units in that group as a condition to limit the number of units created.
 
Level 9
Joined
May 30, 2008
Messages
430
  • Melee Initialization
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
My trigger has this basis for creating the units in it. But i can't seem to limit the amount of units created, for instance:

The trigger is turned on, and only turns off once a certain unit has died. But it SHOULD create 1 unit for every enemy unit within a 350 range, a max of 5 units total. I can get it to create 1 or 2 or 3 or 4 or 5.. but once the trigger periodically goes again, it creates said units AGAIN.

Is there a way to make it create the units only once, or check if there is a difference in units, and create as much units as needed? Having something else turn the trigger off isn't an option. This is really frustrating, and it's really hot where i live! :cry:

Before you begin using timers learn to use the other events.
Use A unit die
Owner of the dying unit is player 1 (red) equal to true
Unit - Create 1 :razz: at position of dying unit
 
Level 11
Joined
Dec 8, 2006
Messages
334
  • Jepaa
    • Events
      • Time - Every 0.10 sec of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in RespawnGroup) Less than 5
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (blah blah) facing Default building facing (270.0) degrees
          • Unit Group - Add (Last created unit) to RespawnGroup
        • Else - Actions
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in RespawnGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from RespawnGroup

Too much cpu consuming
Do it like this

  • Jepaa
    • Events
      • Time - Every 0.10 sec of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (IntegerVariable) Less than 5
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (blah blah) facing Default building facing (270.0) degrees
          • Set Integer Variable = ((Integer Variable) +1)
          • Unit Group - Add (Last created unit) to RespawnGroup
        • Else - Actions
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in RespawnGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from RespawnGroup
      • Set Integer Variable = ((Integer Variable) -1)
[/quote]
 
Level 6
Joined
Apr 23, 2009
Messages
94
Before you begin using timers learn to use the other events.
Use A unit die
Owner of the dying unit is player 1 (red) equal to true
Unit - Create 1 :razz: at position of dying unit

I'm sorry i used such a simple trigger to depict my problem, but rediculing me for it wasn't neccessary.

I know how to use "the other events", please only answer the question, and don't assume i have no knowledge of related content. Thanks.
 
Status
Not open for further replies.
Top