- Joined
- Aug 9, 2015
- Messages
- 33
Hello,
recently i've encountered some problems that i've fixed with the help of some that answered my last thread [[JASS] - Indexing]. Apparentely, the script just won't work even after fixing it.
(For those who helped me on the last thread - i've merged the two triggers together.)
recently i've encountered some problems that i've fixed with the help of some that answered my last thread [[JASS] - Indexing]. Apparentely, the script just won't work even after fixing it.
JASS:
globals
hashtable rocketHash
endglobals
function rocket_condition takes nothing returns boolean
if (GetSpellAbilityId() == 'A000') then
return true
elseif (GetSpellAbilityId() == 'A001') then
return true
endif
return false
endfunction
function explosion takes nothing returns nothing
local timer RocketTimer = GetExpiredTimer()
local unit rocket = LoadUnitHandle(rocketHash, GetHandleId(RocketTimer), 0)
call UnitDamagePointLoc(rocket, 0, 100, GetUnitLoc(rocket), 20, ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL)
call CreateUnitAtLoc(GetOwningPlayer(rocket), 'hpea', GetUnitLoc(rocket), 270)
call RemoveUnit(rocket)
///Variable cleansing
call FlushChildHashtable(rocketHash, GetHandleId(RocketTimer))
call PauseTimer(RocketTimer)
call DestroyTimer(RocketTimer)
set RocketTimer = null
set rocket = null
endfunction
function rocket_action takes nothing returns nothing
local unit rocket = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 'hpea', OffsetLocation(GetUnitLoc(GetTriggerUnit()), 50.00, 0), GetUnitFacing(GetTriggerUnit()))
local timer RocketTimer = CreateTimer()
call SaveUnitHandle(rocketHash, GetHandleId(RocketTimer), 0, rocket)
call TimerStart(RocketTimer, 1.5, false, function explosion)
// the height
call IssuePointOrderLocBJ( rocket, "move", PolarProjectionBJ(GetUnitLoc(rocket), 500.00, GetUnitFacing(rocket)) )
call SetUnitFlyHeight(rocket, GetUnitFlyHeight(GetTriggerUnit()), 0)
call SetUnitFlyHeight(rocket, 0 , 1.5 / GetUnitFlyHeight(rocket))
// cleaning
set RocketTimer = null
set rocket = null
endfunction
//===========================================================================
function InitTrig_Rockets takes nothing returns nothing
set gg_trg_Rockets = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Rockets, EVENT_PLAYER_UNIT_SPELL_CHANNEL)
call TriggerAddCondition(gg_trg_Rockets, Condition(function rocket_condition))
call TriggerAddAction(gg_trg_Rockets, function rocket_action)
endfunction
(For those who helped me on the last thread - i've merged the two triggers together.)