Hey there.
I'm currently making a spell that increases my heroes parry chance by X and decreases his critical strike chance by X. I used the parry chance and crit chance variables in a system already, but there's just something not working. I think it has something to do with the trigger event.
The spell I used is an editted version of Immolation so you can turn it on and off.
Here's the trigger code:
So am I using the right events here?
I'm currently making a spell that increases my heroes parry chance by X and decreases his critical strike chance by X. I used the parry chance and crit chance variables in a system already, but there's just something not working. I think it has something to do with the trigger event.
The spell I used is an editted version of Immolation so you can turn it on and off.
Here's the trigger code:
JASS:
scope GuardianStanceOn initializer init
private function OnCast takes nothing returns boolean
local unit u
local integer bonus
local integer i
if GetSpellAbilityId() == 'A04Z' then
set u = GetTriggerUnit()
set i = GetPlayerId(GetOwningPlayer(u))
set bonus = 20
set PlayerParryBonus[i] = PlayerParryBonus[i] + bonus*3
set PlayerCritBonus[i] = PlayerCritBonus[i] - bonus*2
set u = null
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig, Condition(function OnCast))
set trig = null
endfunction
endscope
JASS:
scope GuardianStanceOff initializer init
private function OnCast takes nothing returns boolean
local unit u
local integer bonus
local integer i
if GetSpellAbilityId() == 'A04Z' then
set u = GetTriggerUnit()
set i = GetPlayerId(GetOwningPlayer(u))
set bonus = 20
set PlayerParryBonus[i] = PlayerParryBonus[i] - bonus*3
set PlayerCritBonus[i] = PlayerCritBonus[i] + bonus*2
set u = null
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_FINISH)
call TriggerAddCondition(trig, Condition(function OnCast))
set trig = null
endfunction
endscope
So am I using the right events here?