[JASS] My special effects wont DIE!

Level 9
Joined
Aug 27, 2004
Messages
471
I have completed my second spell, but it wont kill the special effects. It justs leaves them there... Even though i have a destroying function.

Why dont they die???

One function that doesnt remove sfx (Its not the variable passing)
JASS:
function SkyFinishPortion takes nothing returns nothing
local effect Morbid82 = GetHandleEffect(GetExpiredTimer(), "FrozenSfx2150")
local unit FOG = GetHandleUnit(GetExpiredTimer(), "FOGCurrent2150")
call SetUnitMoveSpeed(FOG, (GetUnitDefaultMoveSpeed(FOG)))
call DestroyEffect(Morbid82)
set FOG = null
set Morbid82 = null
endfunction

JASS:
function EarthPortion takes real painful, real range, integer maxama, location targpos, unit casterunit returns nothing
local location array TargetPoint
local effect array DestroEff
local integer lvl = GetHandleInt(GetTriggeringTrigger(), "levelism")
local real TargposX = GetLocationX(targpos)
local real TargposY = GetLocationY(targpos)
local real RanX = 0.00
local real RanY = 0.00
local real Twait = 0.00
local real Mawait = (0.80 / I2R(lvl))
local real Miwait = (0.20 / I2R(lvl))
local integer CountA = 0
local unit FOG
local group TotalTargs
local location BlackLoc
local player owner = GetOwningPlayer(casterunit)
set TotalTargs = GetUnitsInRangeOfLocAll(range, targpos)
loop
 exitwhen(CountA == maxama)
 set RanX = (GetRandomReal((range / 10), (range)))
 set RanY = (GetRandomReal((range / 10), (range)))
 set TargetPoint[CountA] = Location((RanX + TargposX), (RanY + TargposY))
 call AddSpecialEffectLoc("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", TargetPoint[CountA])
 set DestroEff[CountA] = GetLastCreatedEffectBJ()
 set TotalTargs = GetUnitsInRangeOfLocAll(range, TargetPoint[CountA])
 set FOG = FirstOfGroup(TotalTargs)
  if(IsUnitAliveBJ(FOG) == true) then
   if(IsUnitEnemy(FOG, owner) == true) then
   call UnitDamageTargetBJ(casterunit, FOG, painful, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL)
   endif
  endif
set Twait = (GetRandomReal(Miwait, Mawait))
call TriggerSleepAction(Twait)
call DestroyEffectBJ(DestroEff[CountA])
set DestroEff[CountA] = null
set CountA = (CountA + 1)
endloop
endfunction

Its so weird... they just stay as if nothing was happening... And i dont get why, its not a variable problem...??? Jass is weird o_O
 
Level 3
Joined
Mar 27, 2004
Messages
70
The function GetLastCreatedEffectBJ only works if you created the effect usinga BJ function. That is, AddSpecialEffectBJ or AddSpecialEffectTargetBJ.
But I don't recommend using those function. I'd rather save the effect directly in a local:
JASS:
// This is where you create the effect
 set TargetPoint[CountA] = Location((RanX + TargposX), (RanY + TargposY)) 
 call AddSpecialEffectLoc("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", TargetPoint[CountA])
set DestroEff[CountA] = GetLastCreatedEffectBJ() 

// Instead: do this:
set DestroEff[CountA] = AddSpecialEffect("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", (RanX + TargposX), (RanY + TargposY))
Note that I also replaced AddSpecialEffectLoc with AddSpecialEffect. It would still work using locations, but it is better to use the coordinates when possible.
 
Top