Well, im trying to make a ability, only for testing my knowledge in handles, the following ability its a Storm Bolt, wich poisons the target.
but when i try to run my map, it justs close the WE, dont give any errors, just close and shows a message , worldeditor.exe need to be closed blablabla, + REP for the helps wich resolve my prob !
but when i try to run my map, it justs close the WE, dont give any errors, just close and shows a message , worldeditor.exe need to be closed blablabla, + REP for the helps wich resolve my prob !
JASS:
function Trig_Storm_Bolt_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
function Storm_Poison takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = GetHandleInt(t, "level")
local unit u = GetHandleUnit(t, "caster")
local unit target = GetHandleUnit(t, "vitima")
local real dur = GetHandleReal(t, "dur")
local real upd = GetHandleReal(t, "upd")
if upd < dur then
loop
set upd = upd + 0.5
exitwhen upd = dur
call UnitDamageTarget (u, target, 15*i, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, null)
endloop
else
call FlushHandleLocals(t)
endif
set u = null
set target = null
set t = null
call DestroyTimer(t)
endfunction
function Trig_Storm_Bolt_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real tx = GetUnitX(target)
local real ty = GetUnitY(target)
local integer level = GetUnitAbilityLevel(caster, 039;A000039;)
local timer t = CreateTimer()
local real duration = 7
local real update = 0.5
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", tx, ty)
call SetHandleInt (t, "level", level)
call SetHandleHandle (t, "caster", caster)
call SetHandleHandle (t, "vitima", target)
call SetHandleReal (t, "dur", duration)
call SetHandleReal (t, "upd", update)
call TimerStart(t, update, true, function Storm_Poison)
set caster = null
set target = null
set t = null
endfunction
//===========================================================================
function InitTrig_Storm_Bolt takes nothing returns nothing
set gg_trg_Storm_Bolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Storm_Bolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Storm_Bolt, Condition( function Trig_Storm_Bolt_Conditions ) )
call TriggerAddAction( gg_trg_Storm_Bolt, function Trig_Storm_Bolt_Actions )
call Preload ("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
endfunction