| 08-16-2009, 12:26 PM | #1 |
I made a spell that uses xedamage, every time I create spells, I used xedamage, most of them excludes structures and magic immune units using xe.exception = UNIT_TYPE_STRUCTURE, xe.exception = UNIT_TYPE_MAGIC_IMMUNE and it seems working for them, while in this code, it doesn't work, it still deals damage to structures. JASS:scope Blaze initializer init globals private constant integer spell = 'A00Q' private group g = CreateGroup() private constant string sfx = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" endglobals private struct data unit c real dmg real dur real x real y endstruct private function callBack takes nothing returns boolean local timer t = GetExpiredTimer() local data d = GetTimerData(t) local real nx = GetUnitX(d.c) local real ny = GetUnitY(d.c) local real dis = SquareRoot((nx-d.x)*(nx-d.x) + (ny-d.y)*(ny-d.y)) local xedamage xe = xedamage.create() set xe.dtype = DTFIRE set xe.exception = UNIT_TYPE_STRUCTURE set xe.exception = UNIT_TYPE_MAGIC_IMMUNE if dis >= 100 then call xe.damageAOE(d.c,d.x,d.y,250.0,d.dmg) call DestroyEffect(AddSpecialEffect(sfx,d.x,d.y)) set d.x = nx set d.y = ny endif set d.dur = d.dur - 0.035 if d.dur <= 0.0 then call ReleaseTimer(t) call d.destroy() endif call xe.destroy() set t = null return true endfunction private function act takes nothing returns nothing local data d = data.create() local timer t = NewTimer() local unit c = SpellEvent.CastingUnit local integer l = GetUnitAbilityLevel(c,spell) set d.c = c set d.dmg = 40*l set d.dur = 15.0 set d.x = GetUnitX(c) set d.y = GetUnitY(c) call TimerStart(t,0.035,true,function callBack) call SetTimerData(t,d) set t = null set c = null endfunction private function init takes nothing returns nothing call RegisterSpellEffectResponse(spell,act) endfunction endscope note: DTFIRE is DAMAGE_TYPE_FIRE (I just created a shorter term for it, since I used elemental damage in my map) |
