Hi, having had years of experience with GUI I've decided to finally learn to use JASS. Been using it for a few weeks now but ran into problems such as with the code below in which I want to make lightning spell. I can't figure out why after the PolledWait the trigger stops executing any actions and I've tried modifying different things but nothing seems to make it work. Could anyone help me out (I'm probably being very stupid).
Cheers,
Cheers,
JASS:
function Trig_Zap1_Actions takes nothing returns nothing
local unit shamzap
local unit zaptar
local effect z
local lightning k
native AddSpecialEffectTarget takes string modelName, widget targetWidget, string attachPointName returns effect
native AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning
set shamzap = GetTriggerUnit()
set zaptar = GetSpellTargetUnit()
set z = AddSpecialEffectTarget ("units\\undead\\Abomination\\Abomination", zaptar, "origin")
set k = AddLightningEx ( "CLPB" , false, GetUnitX (shamzap), GetUnitY (shamzap), 50, GetUnitX (zaptar), GetUnitY (zaptar), 50 )
call DisplayTextToForce(GetPlayersAll(), "Effects made, timer started 0.5 sec" )
call PolledWait ( 0.5 )
call DisplayTextToForce(GetPlayersAll(), "timer complete" )
call DestroyEffect ( z )
call DisplayTextToForce(GetPlayersAll(), "destroy effect")
call DestroyLightning ( k )
call DisplayTextToForce(GetPlayersAll(), "destroy lightning")
set z = null
set k = null
set shamzap = null
set zaptar= null
call DisplayTextToForce(GetPlayersAll(), "Everything set to null")
endfunction
//=========================================================================== Conditions
function Trig_Zap1_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A000' ) then
call Trig_Zap1_Actions()
endif
return false
endfunction
//=========================================================================== Events Below here
function InitTrig_Zap1 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Trig_Zap1_Conditions))
set t = null
endfunction
Last edited: