• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Spell stops working

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,292
Hello, so I made a spell.
Whenever the spell damages a target it just stops working (no more illusions spawn and casters stays hidden & paused forever), else it works fine.
So I need help on how to fix the damage part of it to continue working after damage is done.

I know it uses BJs and is quite badly coded:


JASS:
scope ReleaseLimits initializer InitTrig_Release_Limits
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A048' 
endfunction

private function Con takes nothing returns boolean
    return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit()))
endfunction

private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l
local real AOE = 750.
local unit d
local integer i = 15
local integer c 
local real t = 0.1
local group g = CreateGroup()
local integer i2
local unit ta
local integer lvl = GetUnitAbilityLevel(u, 'A048')
call PauseUnit(u, true)
call ShowUnit(u, false)

loop
exitwhen i <= 0
set l = PolarProjectionBJ(GetUnitLoc(u), GetRandomReal(100, AOE), GetRandomReal(0, 360))
set d = CreateUnitAtLoc(GetOwningPlayer(u), 'h00Y', l, 0.00)
call AddSpecialEffectLoc("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", l)
call SetUnitVertexColor(d, 255, 255, 255, 100)
call SetUnitExploded(d, true)
set c = GetRandomInt(1, 6)

if c == 1 or c == 2 or c == 3 then
call SetUnitAnimation(d, "attack")
set g = GetUnitsInRangeOfLocMatching(250, l, function Con)
set i2 = CountUnitsInGroup(g)

loop
exitwhen i2 <= 0
set ta = GroupPickRandomUnit(g)
call UnitDamageTargetBJ(u, ta, 100 + (lvl * 50), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnit(g, ta)
set ta = null
endloop

call UnitApplyTimedLife(d, 'BTLF', 1.5 )
call DestroyGroup(g)
endif

if c == 4 or c == 5 then
call SetUnitAnimation(d, "slam")
set g = GetUnitsInRangeOfLocMatching(350, l, function Con)
set i2 = CountUnitsInGroup(g)

loop
exitwhen i2 <= 0
set ta = GroupPickRandomUnit(g)
call UnitDamageTargetBJ(u, ta, 100 + (lvl * 75), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnit(g, ta)
set ta = null
endloop

call UnitApplyTimedLife(d, 'BTLF', 1.5 )
call DestroyGroup(g)
endif

if c == 6 then
call SetUnitAnimation(d, "attack walk stand spin")
set g = GetUnitsInRangeOfLocMatching(500, l, function Con)
set i2 = CountUnitsInGroup(g)

loop
exitwhen i2 <= 0
set ta = GroupPickRandomUnit(g)
call UnitDamageTargetBJ(u, ta, 100 + (lvl * 100), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnit(g, ta)
set ta = null
endloop

call UnitApplyTimedLife(d, 'BTLF', 2.5 )
call DestroyGroup(g)
endif

set d = null
call RemoveLocation(l)
set i = i - 1
call TriggerSleepAction(t)
endloop

call ShowUnit(u, true)
call PauseUnit(u, false)
set u = null
endfunction

//===========================================================================
private function InitTrig_Release_Limits takes nothing returns nothing
   local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction(t, function Actions )
endfunction
endscope
 
Status
Not open for further replies.
Top