1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] My special effects wont DIE!

Discussion in 'Triggers & Scripts' started by Modeler, Oct 31, 2005.

  1. Modeler

    Modeler

    Joined:
    Aug 27, 2004
    Messages:
    496
    Resources:
    0
    Resources:
    0
    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)
    Code (vJASS):

    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
     


    Code (vJASS):

    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
     
  2. KaTTaNa

    KaTTaNa

    Joined:
    Mar 27, 2004
    Messages:
    70
    Resources:
    0
    Resources:
    0
    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:
    Code (vJASS):

    // 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.
     
  3. Modeler

    Modeler

    Joined:
    Aug 27, 2004
    Messages:
    496
    Resources:
    0
    Resources:
    0
    Dam, you know what you're doing! I didint realize i could call something from a set-var outside of initializing the locals, thats very useful to know! Thank you again ^,^.