shiFt
Member
- Reaction score
- 8
How would I use
in a periodic so that I can get a smooth on the spot jump, mainly just setting a units height quite high, then falling dramatically.
Code:
SetUnitFlyHeight
SetUnitFlyHeight
library UP requires T32,Recycle
globals
private constant integer SPELL_ID = 'A017'
endglobals
private struct Data
private static thistype d
unit cs
unit t
real height
real rate
integer lvl
real x
real y
integer up
real z
private method onDestroy takes nothing returns nothing
call SetUnitFlyHeight(.t, 0.,900.)
call .stopPeriodic()
endmethod
private method periodic takes nothing returns nothing
set .z = GetUnitFlyHeight(t)
if .up == 0 then
call SetUnitFlyHeight(.t, .z + 15.,.rate - 450.)
endif
call BJDebugMsg(R2S(.z))
if .z >= 750. then
set.up = 1
endif
if .up == 1 then
set .z2 = GetUnitFlyHeight(t)
call SetUnitFlyHeight(.t, .z - 15.,.rate + 550.)
endif
if .z2 <= 16.and .up == 1 then
set.up = 2
endif
if .up ==2 then
call .destroy()
endif
endmethod
implement T32x
private static method Trig_LearnUlti_Conditions takes nothing returns boolean
return GetLearnedSkill() == SPELL_ID
endmethod
private static method act takes nothing returns boolean
local thistype this = thistype.allocate()
set .cs = GetTriggerUnit()
set .t = GetSpellTargetUnit()
set .x = GetUnitX(.t)
set .y = GetUnitY(.t)
set .lvl = GetUnitAbilityLevel(.cs,SPELL_ID)
set .height = 750.
set .rate = 12400.
set .up = 0
call UnitAddAbility(.t, 'A04H')
call UnitRemoveAbility(.t, 'A04H')
call .startPeriodic()
return false
endmethod
private static method onInit takes nothing returns nothing
call TriggerAddAction(GT_RegisterStartsEffectEvent(CreateTrigger(),SPELL_ID), function Data.act )
endmethod
endstruct
endlibrary
scope KillSpell initializer onInit // requires GTrigger
globals
private constant integer SPELL_ID = "A000"
endglobals
private function Actions takes nothing returns nothing
call KillUnit(GetTriggerUnit())
return false
endfunction
private function onInit takes nothing returns nothing
call TriggerAddCondition(GT_RegisterStartsEffectEvent(CreateTrigger(),SPELL_ID),Condition(function Actions))
endfunction
endscope