so basically i have a skill based off shockwave but i wanted the effect to be a huge missle so i created dummy unit with a model of a bullet and scaled it up greatly and knocked it back according to how i want it. now my code looks like this:
anything wrong with it because randomly it causes the game to crash. thanks for viewing.
YO_MA_MA
EDIT: it only seems to have problems with multiplayer
EDIT2: i just thought of an idea that maybe i should pre-load the unit... testing it preloaded atm
JASS:
function Trig_Cannon_Fire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A02H'
endfunction
function Trig_Cannon_Fire_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit dummy
local location uloc = GetUnitLoc(u)
local location targetloc = GetSpellTargetLoc()
local real angle = AngleBetweenPoints(uloc, targetloc)
local player p = GetOwningPlayer(u) //i just relized i dont use this, so i took it out just now but would this have been the problem?
local real distance = GetUnitAbilityLevel(u, 'A02H') * 100 + 800
set dummy = CreateUnitAtLoc(GetOwningPlayer(u), 'h008', uloc, angle)
call UnitApplyTimedLife(dummy, 'BTLG', distance/500)
call Knockback.create(dummy, angle * bj_DEGTORAD, 500, distance )
call RemoveLocation(uloc)
call RemoveLocation(targetloc)
set uloc = null
set targetloc = null
set u = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Cannon_Fire takes nothing returns nothing
set gg_trg_Cannon_Fire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cannon_Fire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Cannon_Fire, Condition( function Trig_Cannon_Fire_Conditions ) )
call TriggerAddAction( gg_trg_Cannon_Fire, function Trig_Cannon_Fire_Actions )
endfunction
anything wrong with it because randomly it causes the game to crash. thanks for viewing.
YO_MA_MA
EDIT: it only seems to have problems with multiplayer
EDIT2: i just thought of an idea that maybe i should pre-load the unit... testing it preloaded atm