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

Problem with triggers :/

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
You can check every 1 second if those 5 units are dead, if so, create a unit and destroy the trigger (if it is used once only):
  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Unit1 is dead) Equal to True
      • (Unit2 is dead) Equal to True
      • (Unit3 is dead) Equal to True
      • (Unit4 is dead) Equal to True
      • (Unit5 is dead) Equal to True
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
Or, you can store the number of dead units in a variable, and when that variable hits the number of dead units you want (in this case 5), then it creates the unit:
  • Untitled Trigger 002
    • Events
      • Unit - Unit1 Dies
      • Unit - Unit2 Dies
      • Unit - Unit3 Dies
      • Unit - Unit4 Dies
      • Unit - Unit5 Dies
    • Conditions
    • Actions
      • Set UnitsDead = (UnitsDead + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitsDead Equal to 5
        • Then - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
          • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
        • Else - Actions
If you ask me, solution 2 is better :)
 
Level 11
Joined
Jan 23, 2015
Messages
788
It destroys the trigger, it's not that important for small triggers, but triggers that affect the performance and are used only once is highly recommended to be destroyed, so the game will no longer waste memory on them, cause they are useless once already used.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,225
It destroys the trigger, it's not that important for small triggers, but triggers that affect the performance and are used only once is highly recommended to be destroyed, so the game will no longer waste memory on them, cause they are useless once already used.
Small trigger? Please elaborate as I would imagine the trigger object size being independent of the length of actions/conditions it runs. Only action block number (usually 1), condition block number (usually 1) and individual events (often 1+) can be considered to increase the size of a trigger object since they are implemented as separate objects which get destroyed with the trigger.
 
Status
Not open for further replies.
Top