Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,575
JASS:
function submergeC takes nothing returns boolean
return GetSpellAbilityId()=='A05H'
endfunction
function movesA takes nothing returns nothing
call SetUnitFlyHeight(GetTriggerUnit(),0,1)
call UnitRemoveAbility(GetTriggerUnit(),'B01A')
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function submergeAfter takes unit caster returns nothing
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(caster),'h00R',GetUnitLoc(caster),270)
local trigger moves = CreateTrigger()
call UnitApplyTimedLife(dummy,'B019',2)
call IssueTargetOrder(dummy,"invisibility",caster)
call TriggerRegisterUnitEvent(moves,caster,EVENT_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterUnitEvent(moves,caster,EVENT_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterUnitEvent(moves,caster,EVENT_UNIT_ISSUED_ORDER)
call TriggerRegisterUnitEvent(moves,caster,EVENT_UNIT_DETECTED)
call TriggerAddAction(moves,function movesA)
endfunction
function submergeP takes nothing returns nothing
local timer time = GetExpiredTimer()
local unit caster = GetHandleUnit(time,"caster")
local integer forc = GetHandleInt(time,"forc")
local real height = GetUnitFlyHeight(caster)
if height>10 then
call SetUnitFlyHeight(caster,height+I2R(forc),0)
else
call SetUnitFlyHeight(caster,height+I2R(forc/2),0)
endif
call SetHandleInt(time,"forc",forc-1)
if forc<-50 or height<1 then
call submergeAfter(caster)
call FlushHandleLocals(time)
call DestroyTimer(time)
endif
endfunction
function submergeA takes nothing returns nothing
local timer time = CreateTimer()
local unit caster = GetSpellAbilityUnit()
local integer forc = 20
local location pos = GetUnitLoc(GetSpellAbilityUnit())
if IsTerrainPathable(GetLocationX(pos),GetLocationY(pos),PATHING_TYPE_WALKABILITY) then
call UnitAddAbility(caster,'Amrf')
call UnitRemoveAbility(caster,'Amrf')
call SetHandleHandle(time,"caster",caster)
call SetHandleInt(time,"forc",forc)
call TimerStart(time,.03,true,function submergeP)
else
call DisplayTextToPlayer(GetOwningPlayer(GetSpellAbilityUnit()),0,0,"The water is not deep enough here!")
endif
endfunction
function InitTrig_submerge takes nothing returns nothing
set gg_trg_submerge = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_submerge,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_submerge,Condition(function submergeC))
call TriggerAddAction(gg_trg_submerge,function submergeA)
endfunction
I've ran a few debugs and it seems it's height over the water will never go below 0.
Is there some way to reduce it so it's underwater?
Thanks for any help.