- Joined
- Jan 24, 2015
- Messages
- 26
In attempt to learn JASS, I thought to convert some of my triggers to it and clean up the leaks and such. This one in particular is for a spell called Flame Body, which causes units killed to explode and damage nearby enemies, including structure at reduced damage.
However, for a reason I can't figure out, it won't spawn the explosion effect or add units to the unit group that deals the damage.
It is executing, because I am getting the first two debug messages, and the x and y reals are being set properly. No matter what I try, though, the effect won't spawn nor will nearby units take damage. Not even the debug messages attached to the damage event pop up.
I know that it's not the fact that I'm instantly destroying the effect that's causing that one part, since removing that part of the line does nothing. I really have no idea what's causing this, does anyone have an idea?
However, for a reason I can't figure out, it won't spawn the explosion effect or add units to the unit group that deals the damage.
JASS:
function Trig_Flame_Body_JASS_Enum takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetKillingUnit()))
endfunction
function Trig_Flame_Body_JASS_Conditions takes nothing returns boolean
local unit killer = GetKillingUnit()
local unit killee = GetDyingUnit()
//local location killee_loc = GetUnitLoc(killee)
local real killee_x = GetUnitX(killee)
local real killee_y = GetUnitY(killee)
local integer ability_level = GetUnitAbilityLevel(killer, 'A00G')
local group targets
local unit temp
local real temp_damage = (50.0 + (40.0 * I2R(ability_level)))
if(GetUnitAbilityLevel(GetKillingUnit(), 'A00G') > 0) then
call BJDebugMsg("Boom!")
call BJDebugMsg(R2S(killee_x) + " " + R2S(killee_y))
call GroupEnumUnitsInRange(targets, killee_x, killee_y, 200.0, Condition(function Trig_Flame_Body_JASS_Enum))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", killee_x, killee_y))
//call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", killee_loc)))
loop
set temp = FirstOfGroup(targets)
exitwhen temp == null
if(IsUnitType(temp, UNIT_TYPE_STRUCTURE) == TRUE) then
call UnitDamageTarget(killer, temp, temp_damage * 0.6, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
call BJDebugMsg("Structure hit")
else
call UnitDamageTarget(killer, temp, temp_damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
call BJDebugMsg("Other hit")
endif
call GroupRemoveUnit(targets, temp)
endloop
set killer = null
set killee = null
//set killee_loc = null
set targets = null
set temp = null
endif
return false
endfunction
It is executing, because I am getting the first two debug messages, and the x and y reals are being set properly. No matter what I try, though, the effect won't spawn nor will nearby units take damage. Not even the debug messages attached to the damage event pop up.
I know that it's not the fact that I'm instantly destroying the effect that's causing that one part, since removing that part of the line does nothing. I really have no idea what's causing this, does anyone have an idea?