eliw00d
New Member
- Reaction score
- 3
Say for instance I have a trigger that starts out like this:
A few weeks ago I was looking for a way to detect a manipulated item at the same time as a spell was cast. I took what I found as a base and have built around it, but I'm not sure if it is the most effective way to do it (see:full trigger). I also don't fully understand the usage of the Trigger calls.
1) Does it matter what order they are in? i.e. Event, then Condition, then Action vs. Action then Event (as seen above).
2) If I want to detect a manipulated item, does it detect only for the function it is in? Or will it detect other manipulated items, such as from completely separate triggers/scopes?
I'm still learning vJASS and am trying to use Structs as well as I can understand them.
JASS:
private function Actions takes nothing returns nothing
local trigger t = CreateTrigger()
local data d = data.create()
set d.caster = GetTriggerUnit()
set d.target = GetSpellTargetItem()
call SetCSData(d.caster,d)
call TriggerAddAction(t,function Script)
call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_USE_ITEM)
set t = null
endfunction
private function InitReload takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function GetAbility))
call TriggerAddAction(t,function Actions)
endfunction
A few weeks ago I was looking for a way to detect a manipulated item at the same time as a spell was cast. I took what I found as a base and have built around it, but I'm not sure if it is the most effective way to do it (see:full trigger). I also don't fully understand the usage of the Trigger calls.
1) Does it matter what order they are in? i.e. Event, then Condition, then Action vs. Action then Event (as seen above).
2) If I want to detect a manipulated item, does it detect only for the function it is in? Or will it detect other manipulated items, such as from completely separate triggers/scopes?
I'm still learning vJASS and am trying to use Structs as well as I can understand them.