I am making a skill that deals damage based on current mana, and after you cast it, a dummy unit casts a regeneration skill on the caster.
However, the dummy units are created but do nothing. What could be the problem?
JASS:
function Trig_ManaCoil_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 039;A0H5039; then
return true
endif
return false
endfunction
function ManaCoilCheck takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit u2 = GetFilterUnit()
local player p = GetOwningPlayer(u)
if IsUnitAlly(u2, p) == false and IsUnitAliveBJ(u2) == true and IsUnitType(u2, UNIT_TYPE_STRUCTURE) == false then
set u = null
set u2 = null
set p = null
return true
endif
set u = null
set u2 = null
set p = null
return false
endfunction
function ManaCoil takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2 = GetEnumUnit()
local real d = 10 * GetUnitState(u, UNIT_STATE_MANA)
call UnitDamageTargetBJ( u, u2, d, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call AddSpecialEffectTargetUnitBJ( "origin", u2, "Objects\\Spawnmodels\\NightElf\\NEDeathSmall\\NEDeathSmall.mdl" )
set u = null
set u2 = null
endfunction
function Trig_ManaCoil_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local location l2 = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching(120.00, l, Condition(function ManaCoilCheck))
local player p = GetOwningPlayer(u)
call ForGroupBJ(g,function ManaCoil)
call CreateUnitAtLoc( p, 039;n027039;, l2, bj_UNIT_FACING )
call UnitAddAbilityBJ( 039;A0H6039;, GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "rejuvination", u )
call UnitApplyTimedLifeBJ( 5.00, 039;BTLF039;, GetLastCreatedUnit() )
call RemoveLocation(l)
call RemoveLocation(l2)
call DestroyGroup(g)
set u = null
set l = null
set l2 = null
set g = null
set p = null
endfunction
//===========================================================================
function InitTrig_ManaCoil takes nothing returns nothing
set gg_trg_ManaCoil = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(6), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(7), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ManaCoil, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ManaCoil, Condition( function Trig_ManaCoil_Conditions ) )
call TriggerAddAction( gg_trg_ManaCoil, function Trig_ManaCoil_Actions )
endfunction
However, the dummy units are created but do nothing. What could be the problem?