- Joined
- Jul 9, 2008
- Messages
- 253
Hello everybody, I got a problem with a spell. There are no errors this time, it's just that the damaging doesn't work.
Trigger:
The green part doesn't work, help would be great.
Thanks in advance, Quetzalcotl
Trigger:
JASS:
// Spell ID //
constant function Lightning_Generator_ID takes nothing returns integer
return 'A002'
endfunction
// Dummy ID //
constant function Lightning_Generator_Dummy takes nothing returns integer
return 'o001'
endfunction
// Damage Constant //
constant function Lightning_Generator_Constant_Damage takes nothing returns real
return 10.
endfunction
// Power Factor //
constant function Lightning_Generator_Power_Factor takes nothing returns real
return 0.3
endfunction
// Area of Effect //
constant function Lightning_Generator_Area takes nothing returns real
return 300.
endfunction
// Effect //
constant function Lightning_Generator_Effect takes nothing returns string
return "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldBuff.mdl"
endfunction
// Filter //
function Lightning_Generator_EnemyFilter takes nothing returns boolean
return IsPlayerEnemy( GetOwningPlayer( GetFilterUnit() ) , GetOwningPlayer( GetTriggerUnit() ) ) == true and GetUnitState( GetFilterUnit() , UNIT_STATE_LIFE ) > 0.405
endfunction
function Lightning_Generator_Expire takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle( udg_Lightning_Hashtable , GetHandleId( t ) , 1 )
local real amount = LoadReal( udg_Lightning_Hashtable , GetHandleId( t ) , 2 )
local player p = GetOwningPlayer( dummy )
local real x = GetUnitX( dummy )
local real y = GetUnitY( dummy )
local real count = LoadReal( udg_Lightning_Hashtable , GetHandleId( t ) , 3 ) + 0.9
local unit u
local group g = CreateGroup()
//
if count >= 4.55 then
set count = 0
call SaveReal( udg_Lightning_Hashtable , GetHandleId( t ) , 3 , count )
call KillUnit( dummy )
call DestroyTimer( t )
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl" , x , y ) )
else
call SaveReal( udg_Lightning_Hashtable , GetHandleId( t ) , 3 , count )
call BJDebugMsg( "lol" )
//
//=============================================================//
//=============================================================//
call GroupEnumUnitsInRange( g , x , y , Lightning_Generator_Area() , Condition( function Lightning_Generator_EnemyFilter ) )
loop
set u = FirstOfGroup( g )
exitwhen u == null
//
call UnitDamageTarget( dummy , u , amount , true , false , ATTACK_TYPE_NORMAL , DAMAGE_TYPE_UNKNOWN , WEAPON_TYPE_WHOKNOWS )
//
call GroupRemoveUnit( g , u )
set u = null
endloop
//=============================================================//
//=============================================================//
//
endif
//
call DestroyGroup( g )
//
set t = null
set dummy = null
set p = null
set g = null
endfunction
function Trig_Lightning_Generator_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetTriggerUnit()
local real tx = GetSpellTargetX()
local real ty = GetSpellTargetY()
local real amount = Lightning_Generator_Constant_Damage() + ( Lightning_Generator_Power_Factor() * udg_Power )
local unit dummy
local player p = GetOwningPlayer( caster )
local real angle = GetUnitFacing( caster )
//
set dummy = CreateUnit( p , Lightning_Generator_Dummy() , tx , ty , angle )
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl" , tx , ty ) )
call SetUnitX( dummy , tx )
call SetUnitY( dummy , ty )
call AddSpecialEffectTarget( Lightning_Generator_Effect() , dummy , "chest" )
//
call SaveUnitHandle( udg_Lightning_Hashtable , GetHandleId( t ) , 1 , dummy )
call SaveReal( udg_Lightning_Hashtable , GetHandleId( t ) , 2 , amount )
//
call TimerStart( t , 0.9 , true , function Lightning_Generator_Expire )
//
set caster = null
set dummy = null
set t = null
set p = null
endfunction
// Spell Condition //
function Trig_Lightning_Generator_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Lightning_Generator_ID()
endfunction
//===========================================================================
function InitTrig_Construct_Lightning_Generator takes nothing returns nothing
local trigger t = CreateTrigger( )
set udg_Lightning_Hashtable = InitHashtable()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t , Condition( function Trig_Lightning_Generator_Conditions ) )
call TriggerAddAction( t , function Trig_Lightning_Generator_Actions )
set t = null
endfunction
The green part doesn't work, help would be great.
Thanks in advance, Quetzalcotl