ok, so i wrote this function as part of an ability. thing is... it crashes war3 when i try to save it. and i have no idea where the fault is.
note im using the handlevar system by kattana
note im using the handlevar system by kattana
JASS:
function Trig_Soul_Requiem_New_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03F' ) ) then
return false
endif
return true
endfunction
function Requiem takes nothing returns nothing
// call PauseUnitBJ( true, GetTriggerUnit() )
// call SetUnitAnimation( GetTriggerUnit(), "death" )
// call ResetUnitAnimation( GetTriggerUnit() )
endfunction
function SoulRequiem2Action takes nothing returns nothing
local unit u = GetTriggerUnit()
local real dmg = GetEventDamage()
local real hp = GetUnitStateSwap(UNIT_STATE_LIFE, u)
if (dmg > hp) then
call SetUnitLifeBJ(u, dmg + 5)
endif
endfunction
function RequiemNoMana takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")
call SetUnitManaBJ(u, 0)
endfunction
function Trig_Soul_Requiem_New_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local player p = GetOwningPlayer(u)
local trigger dd = CreateTrigger()
local trigger rq = CreateTrigger()
call TriggerRegisterUnitEvent(dd, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(dd, function SoulRequiem2Action)
call SetPlayerAbilityAvailable(p,'A03K' , false)
call SetHandleHandle(t, "u', u)
call TimerStart(t, 0.2, true, function RequiemNoMana)
endfunction
//===========================================================================
function InitTrig_Soul_Requiem_New takes nothing returns nothing
set gg_trg_Soul_Requiem_New = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Soul_Requiem_New, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Soul_Requiem_New, Condition( function Trig_Soul_Requiem_New_Conditions ) )
call TriggerAddAction( gg_trg_Soul_Requiem_New, function Trig_Soul_Requiem_New_Actions )
endfunction