- Joined
- Sep 14, 2009
- Messages
- 284
I have a AoE spell that deals damage based on the number of units hit. Everything works, except that the damage dealth within the loop in HurricaneSlash_Actions is not dealt and the "loop start/end" debug messages are not displayed. My guess is that somehow GetBonusAtkDmg somehow prevents the rest of the function to execute, but I don't know why.
Here is the code:
EDIT: Solved. Didn't have anything to do with the GetBonusAtkDmg function but thanks anyway Purge.
Here is the code:
JASS:
function HurricaneSlash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A012'
endfunction
function HurrSlash_01 takes nothing returns boolean
return GetUnitAbilityLevelSwapped('A000', GetFilterUnit()) != 1 and IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == false and IsUnitAliveBJ(GetFilterUnit()) == true
endfunction
function HurricaneSlash_Actions takes nothing returns nothing
local unit cast = GetTriggerUnit()
local unit u
local location p = GetUnitLoc(cast)
local group g = GetUnitsInRangeOfLocMatching(300.00, p, Condition(function HurrSlash_01))
local integer i = CountUnitsInGroup(g)
call DisplayTextToForce(GetPlayersAll(), I2S(i))
call SetUnitAnimation(cast, "Attack Walk Stand Spin")
call QueueUnitAnimation(cast, "Stand")
call GetBonusAtkDmg(GetTriggerUnit())
call DisplayTextToForce(GetPlayersAll(), "Loop start")
loop
set u = FirstOfGroup(g)
exitwhen u == null
set udg_AbilityPhysical = true
call UnitDamageTargetBJ(cast, u, ((15.00 * I2R(GetUnitAbilityLevelSwapped('A012', cast)) + 125.00) + (1.80 * udg_GetAttackDamageAmount)) / i, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL)
set udg_AbilityPhysical = false
call DisplayTextToForce(GetPlayersAll(), I2S(CountUnitsInGroup(g)))
call GroupRemoveUnit(g, u)
endloop
call DisplayTextToForce(GetPlayersAll(), "Loop end")
call DestroyGroup(g)
call RemoveLocation(p)
set g = null
set p = null
set cast = null
set u = null
endfunction
//===========================================================================
function InitTrig_HurricaneSlash takes nothing returns nothing
set gg_trg_HurricaneSlash = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_HurricaneSlash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_HurricaneSlash, Condition(function HurricaneSlash_Conditions))
call TriggerAddAction(gg_trg_HurricaneSlash, function HurricaneSlash_Actions)
endfunction
JASS:
function GetBonusAtkDmg takes unit u returns nothing
local integer i = 1
local integer itemId
set udg_GetAttackDamageAmount = 0.00
loop
exitwhen i > 6
set itemId = GetItemTypeId(UnitItemInSlotBJ(u, i))
if itemId == 'I00A' then
set udg_GetAttackDamageAmount = (udg_GetAttackDamageAmount + 3.00)
endif
set i = i + 1
endloop
endfunction
EDIT: Solved. Didn't have anything to do with the GetBonusAtkDmg function but thanks anyway Purge.
Last edited: