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

Periodic Event as all One Trigger?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
If I have a few different periodic events, such as every second deal some damage to all units in unit group, check for units with this buff and give them invulnerability, check for units with some other buff and add them to a unit group, should all of these actions be qued up in the same trigger? Or is it better to have separate Event every 1 seconds for each? For example my trigger look like this right now:

  • BuffChecks
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set BrambleUnitsMap = (Units in (Playable map area))
      • Unit Group - Pick every unit in BrambleUnitsMap and do (Actions)
      • Custom script: call DestroyGroup(udg_BrambleUnitsMap)
      • Set InvulnerableUnitsMap = (Units in (Playable map area))
      • Unit Group - Pick every unit in InvulnerableUnitsMap and do (Actions)
      • Custom script: call DestroyGroup(udg_InvulnerableUnitsMap)
      • Unit Group - Pick every unit in BeingDigestedUnitsMap and do (Actions)
And realizing that both Brambles and Invulnerable do the same pick with their own conditions, would it be better to condense it down further so it just pick all units, and then beck it If Unit has Buff Brambles Do This, Else If Unit has Invulnerable, Do this?
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Its a far than better idea, but it might become dangereous, since the trigger will need to execute too much data at once, and which will be then executed again after 1 second.

So imagine yourself doing 4 things at the same time and repeat them every 1 second.

In my opinion, better separate them.
 
Level 8
Joined
Apr 30, 2009
Messages
338
I used separate periodics because then I can shut some off if there are no units currently in the group the trigger is manipulating.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Yeah that sounds logical to me but I have no idea if the engine handles triggers in a logical way. It seemed redundant or wasteful to have three triggers that all activate every second, wouldn't that cause more strain on it or something when you could just activate one trigger every second instead of three?

EDIT: That's a good point tml616, I never considered that I could have it off when it doesn't need to be firing.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Yes but if you have many of the "action" lines not doing anything because no units have that specific buff, it is also wasteful.

Here is an example from my map where I turn off the periodic trigger whenever there is no unit affected by "Lethal Poison." If I had all periodic actions in one trigger, there would be no way to turn off these lines and the actions would be wasted.

  • Lethal Poison 01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ASN-6 Lethal Poison
    • Actions
      • Set temp_real = (1.00 x ((Max life of (Target unit of ability being cast)) - (Life of (Target unit of ability being cast))))
      • Set temp_point = (Position of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in G_LethalPoison) Equal to False
        • Then - Actions
          • Unit - Create 1 D.ASN-3 Lethal Poison for (Owner of (Triggering unit)) at temp_point facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
          • Hashtable - Save (11.00 - (Real((Level of (Ability being cast) for (Triggering unit))))) as (Key duration) of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Hashtable - Save (temp_real / (Load (Key duration) of (Key (Target unit of ability being cast)) from H_LethalPoison)) as (Key damage) of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Undead\Curse\CurseTarget.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 1 of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Special Effect - Create a special effect attached to the hand, left of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 2 of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Special Effect - Create a special effect attached to the hand, right of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 3 of (Key (Target unit of ability being cast)) in H_LethalPoison
          • Unit Group - Add (Target unit of ability being cast) to G_LethalPoison
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Lethal Poison 02 <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on Lethal Poison 02 <gen>
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • temp_real Greater than ((Load (Key damage) of (Key (Target unit of ability being cast)) from H_LethalPoison) x (Load (Key duration) of (Key (Target unit of ability being cast)) from H_LethalPoison))
            • Then - Actions
              • Unit - Remove ~Lethal Poison (Assassin) buff from (Target unit of ability being cast)
              • For each (Integer A) from 1 to 3, do (Actions)
                • Loop - Actions
                  • Special Effect - Destroy (Load (Integer A) of (Key (Target unit of ability being cast)) in H_LethalPoison)
              • Unit - Create 1 D.ASN-3 Lethal Poison for (Owner of (Triggering unit)) at temp_point facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
              • Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in (Last created hashtable)
              • Hashtable - Save (11.00 - (Real((Level of (Ability being cast) for (Triggering unit))))) as (Key duration) of (Key (Target unit of ability being cast)) in H_LethalPoison
              • Hashtable - Save (temp_real / (Load (Key duration) of (Key (Target unit of ability being cast)) from H_LethalPoison)) as (Key damage) of (Key (Target unit of ability being cast)) in H_LethalPoison
              • Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Target unit of ability being cast)) in H_LethalPoison
              • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Undead\Curse\CurseTarget.mdl
              • Hashtable - Save Handle Of(Last created special effect) as 1 of (Key (Target unit of ability being cast)) in H_LethalPoison
              • Special Effect - Create a special effect attached to the hand, left of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
              • Hashtable - Save Handle Of(Last created special effect) as 2 of (Key (Target unit of ability being cast)) in H_LethalPoison
              • Special Effect - Create a special effect attached to the hand, right of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
              • Hashtable - Save Handle Of(Last created special effect) as 3 of (Key (Target unit of ability being cast)) in H_LethalPoison
            • Else - Actions
              • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: |cffff0000That targ...
      • Custom script: call RemoveLocation(udg_temp_point)
  • Lethal Poison 02
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in G_LethalPoison) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in G_LethalPoison and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_LethalPoison) Greater than or equal to 0.00
                • Then - Actions
                  • Unit - Cause (Load (Key caster) of (Key (Picked unit)) in H_LethalPoison) to damage (Picked unit), dealing ((Load (Key damage) of (Key (Picked unit)) from H_LethalPoison) x R_FRAME_OVERTIME) damage of attack type Hero and damage type Poison
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_LethalPoison) - R_FRAME_OVERTIME) as (Key duration) of (Key (Picked unit)) in H_LethalPoison
                • Else - Actions
                  • Unit - Remove ~Lethal Poison (Assassin) buff from (Picked unit)
                  • For each (Integer A) from 1 to 3, do (Actions)
                    • Loop - Actions
                      • Special Effect - Destroy (Load (Integer A) of (Key (Picked unit)) in H_LethalPoison)
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_LethalPoison
                  • Unit Group - Remove (Picked unit) from G_LethalPoison
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Lethal Poison 02
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in G_LethalPoison and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Key duration) of (Key (Picked unit)) from H_LethalPoison) Greater than or equal to 0.00
            • Then - Actions
              • Unit - Cause (Load (Key caster) of (Key (Picked unit)) in H_LethalPoison) to damage (Picked unit), dealing ((Load (Key damage) of (Key (Picked unit)) from H_LethalPoison) x R_FRAME_OVERTIME) damage of attack type Hero and damage type Poison
              • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_LethalPoison) - R_FRAME_OVERTIME) as (Key duration) of (Key (Picked unit)) in H_LethalPoison
            • Else - Actions
              • Unit - Remove ~Lethal Poison (Assassin) buff from (Picked unit)
              • For each (Integer A) from 1 to 3, do (Actions)
                • Loop - Actions
                  • Special Effect - Destroy (Load (Integer A) of (Key (Picked unit)) in H_LethalPoison)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_LethalPoison
              • Unit Group - Remove (Picked unit) from G_LethalPoison
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in G_LethalPoison) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Else - Actions
You should do the "turn off check" after you remove the unit from the unit group. The duration is 11 seconds, if only one unit casts it the check is done 55 times if it is at the beginning of the trigger, but only once if it's where I set it to.
 
Status
Not open for further replies.
Top