• 🏆 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] wuts wrong with this??

Status
Not open for further replies.
Level 2
Joined
Apr 16, 2005
Messages
10
I scratch my head and i spent 3 hours trying to find out wuts wrong
Can someone tell me wuts wrong with this?
function Trig_Nova_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00Z' ) ) then
return false
endif
return true
endfunction

function Trig_Nova_Actions takes nothing returns nothing
call PolledWait( 0.50 )
// The Angel swings his sword just after 1.5 seconds
set udg_UnitVar = GetTriggerUnit()
// Save the casting unit to use it later and easily in JASS function calls
set udg_PointVar = GetUnitLoc(GetTriggerUnit())
// Save PointVar to use it later in a function call and to remove it
call CasterSetCastSourceLoc(udg_PointVar)
// Will set the caster spawn position at the position of PointVar, this will only work for the functions in this process before a wait
call CasterSetRecycleDelay(5)
// The damage from shockwave is not instant, let's say the damage will be of 5 seconds
// Determine the Recicling delay to 5 seconds for next called caster system functions
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 36
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
// Shockwave at all the directions around the casting unit :
set udg_PointVar2 = PolarProjectionBJ(udg_PointVar, 50.00, ( I2R(GetForLoopIndexA()) * 10.00 ))
// We can use PointVar since we know it is at the position of the Unit
// -------------------------------- Calling the function: ---------------------------------
// function CasterCastAbilityPointLoc takes player owner, integer abilid, string order, location loc, boolean instant returns unit
// To call it use:
call CasterCastAbilityPointLoc( GetOwningPlayer(udg_UnitVar), 'A018' , "shockwave", udg_PointVar2, false)
// Uses The owner of the UnitVar unit
// The rawcode of the ability in this map is 'A018'
// The orderstring is "shockwave"
// Use PointVar2 as target point
// this is not instant and it will also take some time to do all its damage, last argument is false
// (remember that CasterSetCastSourceLoc and CasterSetRecycleDelay are making effect)
call RemoveLocation( udg_ )
// Remove PointVar2 so it doesn't leak
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_)
// Remove PointVar so it doesn't leak
endfunction

//===========================================================================
function InitTrig_Nova takes nothing returns nothing
set gg_trg_Nova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Nova, Condition( function Trig_Nova_Conditions ) )
call TriggerAddAction( gg_trg_Nova, function Trig_Nova_Actions )
endfunction
 
Level 3
Joined
Jul 17, 2004
Messages
57
what is this !? you need 3 hours to convert a spell of vexorians demo-map from the editor triggers to jass ?! maybe u need the VARS TOO when you export it to another map, all globals are only udg_ and so they are NOTHING also i would have the function to save the casting unit BEFORE the wait.
 
Level 2
Joined
Apr 16, 2005
Messages
10
I got a question when you say "save the casting unit" and when he says "save PointVar so we can use it in a function to remove it" what do u guys mean?
also when he says "Remove PointVar so it doesn't leak" does he mean remove the varible PointVar?
i know im a noob..
 
Level 2
Joined
Apr 16, 2005
Messages
10
I got a question when you say "save the casting unit" and when he says "save PointVar so we can use it in a function to remove it" what do u guys mean?
also when he says "Remove PointVar so it doesn't leak" does he mean remove the varible PointVar?
i know im a noob..
 
Level 3
Joined
Jul 17, 2004
Messages
57
things like LastCreatedUnit, GetCastingUnit, GetSpellTargetLoc can lose/change their value due waits etc. so u save them in vars. location for example can be removed, groups and trigger can be destroyed to prevent them to leak (use memory even if they are no longer needed) vars that are not real,integer,string or boolean (the handles) are supposed to leak. so u set them to "null", its their empty or default value.
 
Status
Not open for further replies.
Top