in wich order do triggers fire?

LightChaosma

New Member
Reaction score
60
i have 2 triggers.

a critical trigger. it uses a damage detection system, and basicly is a copy of critical strike.

when you have the buff Lightning slash active, you will satisfy the condition of the 2nd trigger. wich also uses the DDS.

the 2nd trigger adds the damage dealt back to the target. then it uses the damage thingy in the GUI to deal the damage dealt + a bit.

i want the critical trigger not to run on the initial damage when you have the buff lightning slash, but i do want it to run when the calculated damage is dealt...

i cant find a better way to explain what i want.

here is my current triggers:

Trigger:
  • critical
    • critical
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Level of Critical Hit for GDD_DamageSource) Greater than 0
    • Actions
      • Set tempUnitG[1] = (Units in (Playable map area) matching ((Matching unit) Equal to GDD_DamageSource))
      • Unit Group - Pick every unit in tempUnitG[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Random integer number between 1 and 100) Less than or equal to ((Load (Key CriticalChance) of (Key (Picked unit)) from Critical) + (5 x (Level of Critical Hit for GDD_DamageSource)))
                  • True Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
              • Set tempreal[1] = (GDD_Damage x (75.00 + (((Real((Level of Critical Hit for (Picked unit)))) - 1.00) x 25.00)))
              • Set tempreal[1] = (tempreal[1] x (1.00 + ((Load (Key CriticalDamageBonus) of (Key (Picked unit)) from (Last created hashtable)) / 100.00)))
              • Set temppoint[1] = (Position of (Picked unit))
              • Unit - Cause (Picked unit) to damage GDD_DamagedUnit, dealing tempreal[1] damage of attack type Normal and damage type Normal
              • Floating Text - Create floating text that reads ((String((Integer(tempreal[1])))) + !!) at temppoint[1] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
              • Custom script: call RemoveLocation (udg_temppoint[1])
              • Trigger - Turn on (This trigger)
            • Else - Actions


Trigger:
  • Lightning Slash
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource has buff Lightning slash ) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set temppoint[1] = (Position of GDD_DamagedUnit)
      • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
      • Set tempreal[1] = (GDD_Damage + (1000.00 x (1.00 + 1.00)))
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing tempreal[1] damage of attack type Spells and damage type Normal
      • Special Effect - Create a special effect at temppoint[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set tempreal[1] = ((Mana of GDD_DamageSource) - 5.00)
      • Unit - Set mana of GDD_DamageSource to tempreal[1]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempreal[1] Less than or equal to 0.00
        • Then - Actions
          • Unit - Remove Lightning slash buff from GDD_DamageSource
        • Else - Actions
          • Do nothing
      • Trigger - Turn on (This trigger)
      • Custom script: call RemoveLocation (udg_temppoint[1])


please dont come with the answer: why not add the extra damage in a passive skill... cause there will be triggers with the same problem where the extra damage is random
 

Slapshot136

Divide et impera
Reaction score
471
If they have the same event I think it's top-down based on the order of the trigger in the trigger editor

an easy way to keep is simple tho:
create 1 trigger with that event that runs the other 2 in the order you want,
and remove the event from the other 2
 

LightChaosma

New Member
Reaction score
60
If they have the same event I think it's top-down based on the order of the trigger in the trigger editor

an easy way to keep is simple tho:
create 1 trigger with that event that runs the other 2 in the order you want,
and remove the event from the other 2

goo idea, i'll try that tommorow, i have to go to bed now...
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
They fire at the same time.

Only 1 trigger can run at a time, so they can't fire at the same time.

It will most likly go in order of which trigger loaded first, if you want 1 to load over the other I would sugest preloading it.
 

ZugZugZealot

New Member
Reaction score
33
It will most likly go in order of which trigger loaded first, if you want 1 to load over the other I would sugest preloading it.
That's false, try doing...
Trigger:
  • A
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: First
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: Third


Trigger:
  • B
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Wait 0.50 seconds
      • Game - Display to (All players) the text: Second
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: Fourth

It creates a thread for each trigger instance that's fired, and it will release the thread when done. Same applies to expiring timers.

If you did the order right, it should go "First, Second, Third, Fourth" if you have the order swapped it will do "Second, First, Fourth, Third"

Order is based on the order the triggers were created.

Calls to the trigger initializations are added to the InitCustomTriggers() function progressively on trigger creation. Since I created A first, its initialization will be called first, and along with that, its event will be registered first, making it "first in line".
JASS:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_A()
    call InitTrig_B()
endfunction
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Triggers with the same event run in the order they are listed in the compiled JASS file within the map file. For GUI triggers, the order they get written into that file seems to be random within each trigger category, although the order of trigger categories seems to be preserved. (Eg. if you have category A with triggers 1 and 2, and below that you have category B with triggers 3 and 4, then 1 and 2 will always run before 3 and 4, but there's no guarantee whether 1 will run before 2, or 3 before 4.)

It's possible to trigger other triggers within the execution of a trigger. :)nuts:) Either by using the Run action, or by tripping the event of another trigger (eg. causing damage), the newly executed trigger will do its actions until its thread terminates (eg. the trigger is finished, or waiting), and then the first trigger will continue with its actions from where it was.

FYI, the way GDD is coded, if a trigger causes damage, then all (not disabled) damage triggers will run again with the new source/target/damage, and once those are done, the remaining triggers will continue running with the original source/target/damage.

In your situation, you'll need to be careful to not create an infinite loop between the two triggers - when your crit ability deals its damage, it could trigger Lightning Slash.



What you could do is to give the crit strike trigger the condition ((GDD_DamageSource has buff Lightning slash ) Equal to False) or ((Lightning Slash <gen> is on) Equal to False) (where the second condition is the boolean comparison Trigger - Trigger Is On.) This way, the crit trigger will only run when Lightning Slash will not run (or is already running).
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
That's false, try doing...
Trigger:
  • A
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: First
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: Third


Trigger:
  • B
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Wait 0.50 seconds
      • Game - Display to (All players) the text: Second
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: Fourth

It creates a thread for each trigger instance that's fired, and it will release the thread when done. Same applies to expiring timers.

If you did the order right, it should go "First, Second, Third, Fourth" if you have the order swapped it will do "Second, First, Fourth, Third"

Order is based on the order the triggers were created.

Calls to the trigger initializations are added to the InitCustomTriggers() function progressively on trigger creation. Since I created A first, its initialization will be called first, and along with that, its event will be registered first, making it "first in line".
JASS:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_A()
    call InitTrig_B()
endfunction

The wait pauses the first trigger allowing the secound trigger to run. So it is still only 1 trigger running at a time. So as I said, only 1 trigger can run at a time.
 

LightChaosma

New Member
Reaction score
60
If they have the same event I think it's top-down based on the order of the trigger in the trigger editor

an easy way to keep is simple tho:
create 1 trigger with that event that runs the other 2 in the order you want,
and remove the event from the other 2

with help of some booleans and if statements this works, thx, +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top