• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Why does this not work? It stops >:(

Status
Not open for further replies.
Level 18
Joined
Oct 18, 2007
Messages
930
JASS:
function S_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function S_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit a = GetSpellTargetUnit()
    local location loc1
    local location loc2
    local real degrees
    local effect se
    local effect see
    set loc1 = GetUnitLoc(u)
    set loc2 = GetUnitLoc(a)
    set degrees = GetUnitFacing(a)
    call BJDebugMsg("TEST")
    call AddSpecialEffectLoc( "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl", loc1 )
    set se = GetLastCreatedEffectBJ()
    call AddSpecialEffectTarget( "Sweep.mdx", u, "chest" )
    set see = GetLastCreatedEffectBJ()
    call DestroyEffect(se)
    call PolledWait(0.01)
    call DestroyEffect(see)
    call SetUnitPositionLocFacingLocBJ( u, PolarProjectionBJ(loc2, 100.00, (degrees + 180.00 ) ), loc2 )
    call RemoveLocation( loc1 )
    call RemoveLocation( loc2 )
    set loc1 = null
    set loc2 = null
    set u = null
    set a = null
    set se = null
    set see = null
endfunction

//*-------------------------------------------------------------------------------------------------------*
//|                                         *END OF SCRIPT*                                               |
//*-------------------------------------------------------------------------------------------------------*
function InitTrig_Charge takes nothing returns nothing
  local trigger S = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( S, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( S, Condition( function S_Actions ) )
    call TriggerAddAction( S, function S_Actions )
  set S = null
endfunction

It does all the things but not the move, hmm wonder why it does that, and the strange thing is that the se effects are created but not removed... Hmm..

Any ideas?
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
I can't see anything wrong except that you leak a location and instead of this:
JASS:
    call AddSpecialEffectLoc( "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl", loc1 )
    set se = GetLastCreatedEffectBJ()

You can do this:

JASS:
    set se = AddSpecialEffectLoc( "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl", loc1 )

And you don't need the "Polled Wait". Actually I think you can cut out the effect variables and just do this:

JASS:
    call DestroyEffect(AddSpecialEffectLoc( "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl", loc1 ))
    call DestroyEffect(AddSpecialEffectTarget( "Sweep.mdx", u, "chest" ))
 
Status
Not open for further replies.
Top