I finaly got round to writing this script, remebering after a friend wanted to be able to jump in the game... Here's the script, call it jump.sqs :
_guy = _this select 0
; How high the person jumps, max 10, min 3, approx.
_howmuch = 5
; If the person jumps higher the more you jump
_jumpinc = 1
_wherex = getpos _guy select 0
_wherey = getpos _guy select 1
_wherez = getpos _guy select 2
_fastx = velocity _guy select 0
_fasty = velocity _guy select 1
_fastz = velocity _guy select 2
_newfastz = _fastz + 5
_guy setpos [_wherex,_wherey,_wherez]
_guy setvelocity [_fastx, _fasty, _newfastz]
; Stop the person jumping repeatadly, 3 should be enough of a delay
; It remove the jump acction, waits 3 seconds, and add's it again
_guy removeaction jumpacc
~3
jumpacc = _guy addAction ["Jump","jump.sqs"]
exit
And add to the player :
jumpacc = this addAction ["Jump","jump.sqs"]
It works pretty well, I sorted out a bug that if you repeatedly press the jump action, you fly up in to the air, higher and hight...
Only prob so far is that it doesn't speed you up (Forwards) as I'd like it to..
How can I get the players direction, and add the right X/Y speeds to make the player speed up in the right direction?
Doing y+10 is fine when running ar 0*, but run any other way and you get pushed sideways...
Can anyone help??
Anyway, it works fine, you can change the first few line so you jump higher (Look at comments)
It's fairly simple, I've not been coding long.. On of my first decent script (Most are 3 line thing
)
I'm happy with it.. But still see no practial use
Apart from jumping stupid little things that you should be able to step over (The sandbag wall, for eg..)
- Ben