• 🏆 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!

Troubleshooting help with JASS

Status
Not open for further replies.
Level 3
Joined
Mar 2, 2008
Messages
62
ok, so i wrote this function as part of an ability. thing is... it crashes war3 when i try to save it. and i have no idea where the fault is.

note im using the handlevar system by kattana

JASS:
function Trig_Soul_Requiem_New_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A03F' ) ) then
        return false
    endif
    return true
endfunction


function Requiem takes nothing returns nothing

//    call PauseUnitBJ( true, GetTriggerUnit() )
//    call SetUnitAnimation( GetTriggerUnit(), "death" )
//    call ResetUnitAnimation( GetTriggerUnit() )

endfunction


function SoulRequiem2Action takes nothing returns nothing

local unit u = GetTriggerUnit()
local real dmg = GetEventDamage()

local real hp = GetUnitStateSwap(UNIT_STATE_LIFE, u)

if (dmg > hp) then

call SetUnitLifeBJ(u, dmg + 5)

endif

endfunction


function RequiemNoMana takes nothing returns nothing

local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")

call SetUnitManaBJ(u, 0)

endfunction



function Trig_Soul_Requiem_New_Actions takes nothing returns nothing

local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local player p = GetOwningPlayer(u)

local trigger dd = CreateTrigger()
local trigger rq = CreateTrigger()

call TriggerRegisterUnitEvent(dd, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(dd, function SoulRequiem2Action)

call SetPlayerAbilityAvailable(p,'A03K' , false)
call SetHandleHandle(t, "u', u)
call TimerStart(t, 0.2, true, function RequiemNoMana)

endfunction

//===========================================================================
function InitTrig_Soul_Requiem_New takes nothing returns nothing
    set gg_trg_Soul_Requiem_New = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Soul_Requiem_New, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Soul_Requiem_New, Condition( function Trig_Soul_Requiem_New_Conditions ) )
    call TriggerAddAction( gg_trg_Soul_Requiem_New, function Trig_Soul_Requiem_New_Actions )
endfunction
 
Status
Not open for further replies.
Top