Naga'sShadow
Ultra Cool Member
- Reaction score
- 49
I've got a spell that needs to detect after its finished casting. Except the data I need includes the target of the ability cast, not something included in the EVENT_PLAYER_UNIT_SPELL_FINISH. Right now I think that using structs would be the fastest way of getting this data from a trigger the stores the target on spell effect but I have no idea how to use structs and as I have it does not work. I'll post the code could someone tell me where I've gone wrong?
Main Trigger
Secondary Trigger
I've currently got the strut sitting in an otherwise empty library but due to the syntax checker going crazy whenever I attempt to use it I have no idea where it should go. Does in belong in either of these triggers?
Main Trigger
JASS:
function BoW_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A004039;
endfunction
function BoW_Actions takes nothing returns nothing
local unit targ
local integer array spell
local integer level = GetUnitAbilityLevel(GetTriggerUnit(), 039;A004039;)
local player p = GetOwningPlayer(GetTransportUnit())
local BattleTarget data = BattleTarget.create()
set targ = data.targ
set spell[1] = 039;A00P039;
set spell[2] = 039;A00Q039;
set spell[3] = 039;A00R039;
set spell[4] = 039;A00S039;
set spell[5] = 039;A00T039;
call CasterCastAbility(p, spell[ level ], "doom", targ, false)
set targ = null
endfunction
//=======================================================================
function InitTrig_Battle_of_Wits takes nothing returns nothing
local trigger gg_trg_BoW
set gg_trg_BoW = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_BoW, EVENT_PLAYER_UNIT_SPELL_FINISH)
call TriggerAddCondition(gg_trg_BoW, Condition(function BoW_Conditions))
call TriggerAddAction(gg_trg_BoW, function BoW_Actions)
set gg_trg_BoW = null
endfunction
Secondary Trigger
JASS:
function BoW2_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A004039;
endfunction
function BoW2_Actions takes nothing returns nothing
local BattleTarget data = BattleTarget.create()
set data.targ = GetSpellTargetUnit()
endfunction
//=======================================================================
function InitTrig_Battle_of_Wits2 takes nothing returns nothing
local trigger gg_trg_BoW2
set gg_trg_BoW2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_BoW2, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_BoW2, Condition(function BoW2_Conditions))
call TriggerAddAction(gg_trg_BoW2, function BoW2_Actions)
set gg_trg_BoW2 = null
endfunction
I've currently got the strut sitting in an otherwise empty library but due to the syntax checker going crazy whenever I attempt to use it I have no idea where it should go. Does in belong in either of these triggers?