- Joined
- Sep 12, 2008
- Messages
- 657
hey.. i really dont like all those systems of jumping out-there..
so i tried to make my own, for some reason, nothing happends..
and the unit just stays there.
thanks in advance.
so i tried to make my own, for some reason, nothing happends..
and the unit just stays there.
JASS:
library JumpEngine initializer OnInit
globals
private constant real GravityForce = 0.75
private unit array GravityUnit
private integer array GravityCount
private real array GravityStart
private boolean array GravityJumpPlus
endglobals
private function SetHeightPlus takes unit u returns nothing
call SetUnitFlyHeight(u, (GetUnitFlyHeight(u) + GravityForce), 0)
endfunction
private function SetHeightMinus takes unit u returns nothing
call SetUnitFlyHeight(u, (GetUnitFlyHeight(u) - GravityForce), 0)
endfunction
function SetJumper takes integer i, unit n returns nothing
set GravityUnit[i] = n
endfunction
function GetJumper takes integer i returns unit
return GravityUnit[i]
endfunction
private function ClearJump takes integer i returns nothing
set GravityUnit[i] = null
set GravityStart[i] = 0
set GravityJumpPlus[i] = false
set GravityCount[2] = GravityCount[2] - 1
if GravityCount[2] == 0 then
set GravityCount[1] = 0
endif
endfunction
function ForceStop takes nothing returns nothing
set GravityCount[1] = 0
set GravityCount[2] = 0
set GravityCount[3] = 0
endfunction
private function OnLoop takes nothing returns nothing
local real h = 0
if GravityCount[1] >= 1 then
loop
if GravityCount[3] == GravityCount[1] then
set GravityCount[3] = 1
else
set GravityCount[3] = GravityCount[3] + 1
endif
if GravityUnit[GravityCount[3]] != null then
if GravityJumpPlus[GravityCount[3]] == true then
if GetUnitFlyHeight(GravityUnit[GravityCount[3]]) >= 10 then
call SetHeightMinus(GravityUnit[GravityCount[3]])
else
call ClearJump(GravityCount[3])
endif
else
if GetUnitFlyHeight(GravityUnit[GravityCount[3]]) < GravityStart[GravityCount[3]] then
call SetHeightPlus(GravityUnit[GravityCount[3]])
else
set GravityJumpPlus[GravityCount[3]] = true
endif
endif
endif
endloop
endif
endfunction
function Jump takes unit u, real startheight returns nothing
set GravityCount[1] = GravityCount[1] + 1
set GravityCount[2] = GravityCount[2] + 1
set GravityUnit[GravityCount[1]] = u
set GravityStart[GravityCount[1]] = startheight
endfunction
private function OnInit takes nothing returns nothing
call TimerStart(CreateTimer(), 0.032, true, function OnLoop)
endfunction
endlibrary
-
Untitled Trigger 001
-
Events
-
Player - Player 1 (Red) skips a cinematic sequence
-
-
Conditions
-
Actions
-
Set u = Blood Mage 0001 <gen>
-
Set r = 750.00
-
Custom script: call Jump(udg_u, udg_r)
-
-
thanks in advance.