Triggers will never execute at the "same time". They're always ordered just like how the actions in a trigger execute from top to bottom. So as long as you do something like this you'll be fine:
-
example 1
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to Some Spell
-
Actions
-
Set CastingUnit = (Triggering unit)
-
Set TargetUnit = (Target unit of ability being cast)
-
Set Damage = 100.00
-
Unit - Cause CastingUnit to damage TargetUnit, dealing Damage damage of attack type Spells and damage type Normal
But where you can go wrong is with Waits/Timers. So in this next trigger we do the same thing but our variables are referenced after a 2.00 second Wait. That's a problem, because if any of our variables were to change at any point during those 2.00 seconds then it won't work properly. The damage might be the wrong number, or maybe the castingunit or targetunit will be the wrong units.
-
example 2
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to Some Spell
-
Actions
-
Set CastingUnit = (Triggering unit)
-
Set TargetUnit = (Target unit of ability being cast)
-
Set Damage = 500.00
-
Wait 2.00 seconds
-
Unit - Cause CastingUnit to damage TargetUnit, dealing Damage damage of attack type Spells and damage type Normal
To fix the problem in example 2 you have multiple options.
1) You can use multiple global variables (depending on your map this may create 100's of extra variables)
2) Use local variables (requires JASS knowledge)
3) Use shadowed global variables (this is a nice mix between GUI and JASS and can be very simple to use)
Search for "shadowing global variables" in this link (unless you already know what I'm talking about):
Things You Should Know When Using Triggers / GUI
And here's an example of using local variables that I have written in Lua. It should look very similar to the example 2 trigger I posted above, however I didn't bother putting in the Events/Conditions. So I store 3 local variables, the casting unit, the target unit of ability being cast, and the amount of damage to deal just like we did before. Then I create a timer that expires after 2.00 seconds (basically the same as "Wait 2.00 seconds" but even more precise and problem-free) that deals damage once expired.
Lua:
function SpellExample()
local castingunit = GetTriggerUnit()
local targetunit = GetSpellTargetUnit()
local damage = 500
TimerStart(CreateTimer(), 2.00, false, function()
UnitDamageTarget(castingunit, targetunit, damage, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, nil)
PauseTimer(GetExpiredTimer())
DestroyTimer(GetExpiredTimer())
end)
end
What makes local variables great is that they will not cause any of the problems that I mentioned before. Damage will always be equal to 500.00 and CastingUnit/TargetUnit will not change. This is because every time you run this code it's creating new unique local variables instead of replacing existing global variables. Variables in Lua are also great because you can name them whatever you want and you don't have to define their types (like Unit, Real, Integer, Point).