- Joined
- Jul 9, 2008
- Messages
- 253
I am making a spell that makes a beam, heals all allies and damages enemies every 0.5 seconds for 10 seconds. But it doesn't work at all
This is what i have:
Could anyone help me?
This is what i have:
JASS:
function Trig_Sacred_Wave_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00P' ) ) then
return false
endif
return true
endfunction
function Trig_Sacred_Wave_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local group g = CreateGroup()
local player p = GetOwningPlayer(caster)
local unit u
local unit beam
local real duration = 0.00
loop
exitwhen duration > 10.00
call CreateUnitAtLoc( p, 'h00A', loc, bj_UNIT_FACING )
set beam = GetLastCreatedUnit()
set g = GetUnitsInRangeOfLocAll (250, loc )
loop
set u = FirstOfGroup ( g )
exitwhen u == null
call GroupRemoveUnit (g , u )
if IsUnitEnemy(u, p) then
call UnitDamageTargetBJ(caster, u, ( I2R(GetHeroStatBJ(bj_HEROSTAT_INT, caster, true)) * 0.25 ), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL )
else
call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) + I2R(GetHeroStatBJ(bj_HEROSTAT_INT, caster, true)) ) )
endif
set p = null
set u = null
endloop
call RemoveUnit(beam)
call TriggerSleepAction(0.50)
set duration = (duration + 1.00)
endloop
call RemoveLocation(loc)
set caster = null
call DestroyGroup(g)
set duration = 0.00
endfunction
//===========================================================================
function InitTrig_Sacred_Wave takes nothing returns nothing
set gg_trg_Sacred_Wave = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sacred_Wave, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Sacred_Wave, Condition( function Trig_Sacred_Wave_Conditions ) )
call TriggerAddAction( gg_trg_Sacred_Wave, function Trig_Sacred_Wave_Actions )
endfunction
Could anyone help me?