- Joined
- Nov 1, 2006
- Messages
- 1,612
I'm working on my first full JASS script and I have loosely followed some tutorials to figure out how to get what I want. However, when my effects are supposed to be created, UDeathSmall shows VERY quickly and then disappears (not playing it's full animation before being removed) and HowlTarget does not even show up.
Can anyone spot the problem? I'm sure there's a few considering this is my first attempt at a full JASS script.
Can anyone spot the problem? I'm sure there's a few considering this is my first attempt at a full JASS script.
JASS:
function Trig_EnableVampirism_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A002' ) ) then
return false
endif
return true
endfunction
function Trig_EnableVampirism_Actions takes nothing returns nothing
local effect b
local unit u = GetSpellTargetUnit()
local unit t = GetTriggerUnit()
call TriggerSleepAction( 0.15 )
// Uses udg_RVunit to check if the spell was blocked or not
if ( not ( GetUnitUserData(u) == 99) ) then
// Spell was blocked
set b = null
set u = null
set t = null
else
// Spell wasn't blocked, effects created and Spell<gen> is turned on
call SetUnitUserData( u, 13 )
call DestroyEffect (AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\UDeathSmall\\UDeathSmall.mdl", u,"origin"))
set b = AddSpecialEffectTarget("Abilities\\Spells\\Other\\HowlOfTerror\\HowlTarget.mdl", u,"origin")
call EnableTrigger( gg_trg_Spell )
call TriggerSleepAction( ( 5.00 + ( 5.00 * I2R(GetUnitAbilityLevelSwapped('A002', t)) ) ) )
call DisableTrigger( gg_trg_Spell )
call SetUnitUserData( u, 0 )
call DestroyEffect(b)
set u = null
set t = null
set b = null
endif
endfunction
//===========================================================================
function InitTrig_EnableVampirism takes nothing returns nothing
set gg_trg_EnableVampirism = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_EnableVampirism, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_EnableVampirism, Condition( function Trig_EnableVampirism_Conditions ) )
call TriggerAddAction( gg_trg_EnableVampirism, function Trig_EnableVampirism_Actions )
endfunction