- Joined
- Jul 9, 2008
- Messages
- 253
Hello everybody, I got another problem with a spell I tried to make. Basicly it should do a triggered Entangling Roots, but it gets an error when I try to save or test the map. Although turning the trigger on, doesn't.
Please tell me what I did wrong, and what I need to improve.
Trigger:
Thanks in advance, Quetzalcotl
Please tell me what I did wrong, and what I need to improve.
Trigger:
JASS:
// Spell ID //
constant function Entangling_ID takes nothing returns integer
return 'A00D'
endfunction
// Constant Damage //
constant function Entangling_Constant_Factor takes nothing returns real
return 0.8
endfunction
// Level Damage //
constant function Entangling_Level_Factor takes nothing returns real
return 0.2
endfunction
// Duration //
constant function Entangling_Duration takes nothing returns integer
return 5
endfunction
// Dummy ID //
constant function Dummy_ID takes nothing returns integer
return 'h004'
endfunction
// Dummy Model //
constant function Dummy_Model takes nothing returns string
return "Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl"
endfunction
// Dummy Size //
constant function Dummy_Size takes nothing returns real
return 1.6
endfunction
// Spell Condition //
function Trig_Entangling_Vines_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Entangling_ID()
endfunction
function Trig_Entangling_Vines_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local player p = GetOwningPlayer( caster )
local integer level = GetUnitAbilityLevelSwapped( Entangling_ID() , caster )
local real x = GetUnitX( target )
local real y = GetUnitY( target )
local real facing = GetUnitFacing( caster )
local integer i = 0
local unit u
local integer int = GetHeroInt( caster , true )
local effect model
//
set u = CreateUnit( p , Dummy_ID() , x , y , facing )
call SetUnitScale( u , Dummy_Size() , Dummy_Size() , Dummy_Size() )
set model = AddSpecialEffectTarget( Dummy_Model() , u , "origin" )
//
loop
if i == Entangling_Duration() then
call RemoveUnit( u )
call DestroyEffect( model )
endif
exitwhen i == Entangling_Duration()
if GetUnitState( target , UNIT_STATE_LIFE ) > 0 then
call UnitDamageTarget( caster , u , ( int * ( Entangling_Constant_Factor() + ( Entangling_Level_Factor() * I2R( level ) ) ) ) , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
else
call RemoveUnit( u )
call DestroyEffect( model )
endif
call PolledWait( 1. )
set i = i + 1
endloop
//Actions//
set caster = null
set target = null
set p = null
set u = null
set model = null
endfunction
function AntiLeaker takes nothing returns boolean
return true
endfunction
//===========================================================================
function InitTrig_Entangling_Vines takes nothing returns nothing
local trigger t = CreateTrigger( )
local filterfunc f = Filter( function AntiLeaker )
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent( t, Player( i ) , EVENT_PLAYER_UNIT_SPELL_EFFECT , f )
set i = i + 1
exitwhen i == 16
endloop
call TriggerAddCondition( t , Condition( function Trig_Entangling_Vines_Conditions ) )
call TriggerAddAction( t , function Trig_Entangling_Vines_Actions )
call DestroyFilter( f )
set f = null
set t = null
endfunction
Thanks in advance, Quetzalcotl