Home   Help Search Login Register  

Author Topic: Jumping in OFP  (Read 3204 times)

0 Members and 1 Guest are viewing this topic.

Offline MMFF

  • Members
  • *
  • Mission Maker From Finland
Jumping in OFP
« on: 03 Jan 2004, 08:32:53 »
You possibly know that in flashpoint, the player canÂ't jump. >:(
So here is the trick. Use the script.

I have no idea to make one tough. :'(

If someone could make one for me. That woul be awesome. :wow:
Do I need to play Operation Flashpoint to be here?

notmucheyecandy

  • Guest
Re:Jumping in OFP
« Reply #1 on: 03 Jan 2004, 13:24:42 »
should be reltivly simple to do with the setpos command, although it would have to be used from the action menu not assigned a key by the user

Rappy

  • Guest
Re:Jumping in OFP
« Reply #2 on: 03 Jan 2004, 20:41:53 »
Why would you need to jump however ???

jumping over bullets doesnt work in this game :D

But yah, i guess the script would be something like

player setpos [getpos player select 0, getpos player select 1, (getpos player select 2) + 2]

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #3 on: 03 Jan 2004, 21:01:36 »
It would me bore something like this :
In the players INIT feild player setpos [getpos player select 0, getpos player select 1, (getpos player select 2)]
And on the menu/radio thing, that launches a script with this in it :
player setvelocity [0,0,2]

What about something like a getvelocity command (Is there such a thing?) to replace the "0"s in the setvelocity.. so if your running, and you jump, you go forwards/left/right/back, because it knows your moving [16,1,0] and uses the set velocity to make this "[16,1,2]" (Maybe better [17,2,2], so you go a bit faster, as well as higher?)

I don't know :P
- Ben

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Jumping in OFP
« Reply #4 on: 12 Jan 2004, 06:49:57 »
    DBR_ONIX is on the right track, by using setvelocity. But to use setvelocity on men you need to setpos them above ground, which causes problems when the unit is on a bridge/building/etc (the unit teleports down to the ground. I think it could be worked around with an ASL function though). It wouldn't look pretty though, without animations and all. Plus, you could jump while you were lying down, unless someone knows of a way to tell when a unit is prone.

   But why would you need to jump anyway? This isn't counterstrike. You've got bushes and trees, for the most part; not boxes and stuff. And jumping with all that gear won't get you very much air....
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #5 on: 14 Jan 2004, 20:44:06 »
Someone would find a use :P
Hmm..
- Ben

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:Jumping in OFP
« Reply #6 on: 15 Jan 2004, 01:01:28 »
"velocity vehicle" returns the velocity

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #7 on: 02 Feb 2004, 22:25:51 »
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 :
Code: [Select]
_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 :
Code: [Select]
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 :P)
I'm happy with it.. But still see no practial use :P
Apart from jumping stupid little things that you should be able to step over (The sandbag wall, for eg..)


:D
- Ben

BibiPhoque

  • Guest
Re:Jumping in OFP
« Reply #8 on: 03 Feb 2004, 22:20:47 »
"How can I get the players direction, and add the right X/Y speeds to make the player speed up in the right direction?"

Code: [Select]
_player1 = _this select 0
_speed = 5
_dir = (direction _player1)
_vx = _speed*cos _dir
_vy = _speed*sin _dir
_player1 setvelocity[_vy, _vx, 0]

I think that makes the player accelerate in the direction he's looking...

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #9 on: 06 Feb 2004, 22:36:49 »
Thank you, I'll try and implement this..
Looks like it should work.. Not that I understand trig in the slightest :P
Cheers!
- Ben
BTW, I've credited you in the code, BibiPhoque :)
« Last Edit: 06 Feb 2004, 22:40:12 by DBR_ONIX »

BibiPhoque

  • Guest
Re:Jumping in OFP
« Reply #10 on: 07 Feb 2004, 19:43:48 »
Thx :D
BTW, I forgot to say that you can change the value of _speed, but I guess you've noticed that already =)

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #11 on: 10 Feb 2004, 18:12:07 »
No prob :)
Basicly done now :)
Just to stort a few things, and it'll be done :D

- Ben

Offline MMFF

  • Members
  • *
  • Mission Maker From Finland
Re:Jumping in OFP
« Reply #12 on: 09 Jul 2004, 21:47:20 »
Hi guys! HavenÂ't been here for a while. Sounds cool. And by the way, I made some funny things with the original jump script, removed that 3 sec. wait, tried with vehicles.
Do I need to play Operation Flashpoint to be here?

Neptune

  • Guest
Re:Jumping in OFP
« Reply #13 on: 12 Jul 2004, 11:08:50 »
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... ::)
:D
- Ben

Make a check on the altitude of the unit.
like 'IF unit's alt. > 0 BREAK'

something like that... ::)
« Last Edit: 12 Jul 2004, 11:09:46 by Neptune »

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #14 on: 12 Jul 2004, 11:50:16 »
Nah, I sorted it with this code a while ago ::
Code: [Select]
_guy removeaction jumpacc

~3

jumpacc = _guy addAction ["Jump","jump.sqs"]
exit
It removes the Jump action from the player, the waits 3 seconds, and adds it again
I guess your way would allow bunny-hopping.. But I can't remeber if the alt is from the ground or the sea-level (The ground level I'm sure)
But anyway, my way stops bunny-hopping :P

- Ben

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Jumping in OFP - Here's my version
« Reply #15 on: 13 Jul 2004, 03:24:36 »
Hi All

Attached is my own version of a Jump script.  It was one of the first scripts that I ever wrote (around a year ago) so please go easy on me !  :-\  :noo:

I wrote the script before I got Resistance so I couldn't use the setVelocity command.  Instead, I used a recursive form of the SetPos command, making the units Jump height go up to a maximum value, then down again until the unit is back on the ground (height = 0).

I tried custom animations etc but they didn't add much and actually reduced the effect if the unit was running or whatever.  Because the script just raises the units height you can use it to jump up onto things (such as low objects, the roof of a very low building etc), or over things (such as low fences, gaps between close buildings etc) if you are also running or sprinting at the same time.

You should be aware of two little quirks that I added to it.

First - if you sprint and jump (especially downhill) you often fall too far back to earth and may end up injuring yourself - the script checks for this and if you take any damage the script sends you prone.  This is useful to let you know when you're jumping too far and also stops bunny hopping.

The second quirk is that the script disables itself whenever you are in the air so the player can't call the script more than once at a time.  What this means is that a player can't Jump while they are jumping - pretty obvious really.  If you want to create an even bigger delay between allowable jumps all you have to do is change the final delay at the end of the script.

I've played with this as standard ever since I made this script up.  It's great for leaping low walls and getting on top of boulders in the desert.  You can also use it to leap through the windows of some buildings.

The script comes with a custom sound effect, so to use simply extract jump.sqs to your mission folder and the sound file (jump.ogg) to your sounds sub-folder.  If this is the only custom sound in your mission then simply add the description.ext file to the mission folder as is, otherwise snip the sound config bit and add it to your own description.ext file.  Note that the attached .ext file also has info about respawning and other sound files that I have created - delete or amend these to suit yourself.

Enjoy !



Roni

PS - Feedback greatly appreciated !

Dubieman

  • Guest
Re:Jumping in OFP
« Reply #16 on: 13 Jul 2004, 03:46:26 »
I'm not involved here but I think there is one thing that needs to be addressed. MMFF said he had fun using vehicles with it. I dunno if you want to disable that or not but a jeep coming down the road and all the sudden it goes up 3m? Or a heli goes up 3m instanly or a tank.... :D ;)

Not sure if you noticed this or not... :-\

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Jumping in OFP
« Reply #17 on: 13 Jul 2004, 04:13:42 »
I generally play two player co-op with a friend every Saturday night.  I only assign the Jump script to player (non-vehicle) units so I have no isue with jmping tanks or whatever.

My only gripe with my own script (  8) ) is that the addAction command makes that action usable by anyone adjacent to that unit.  My friend and I have fun "jolting" each other into the air, but sometimes it can be a pain.  Once I did it for a laugh and actually broke my buds legs when he fell back to earth.  We then both ended up getting killed when the baddies started circling in . . .


Roni

Dubieman

  • Guest
Re:Jumping in OFP
« Reply #18 on: 13 Jul 2004, 04:16:06 »
Yea I know but stil it might be something of a realism issue but it's not a dire problem with the script. :-\

MuSe

  • Guest
Re:Jumping in OFP
« Reply #19 on: 13 Jul 2004, 10:20:03 »
I also noticed you can jump whilst being prone, which is quite funny but not realistic. Here's my script but theres a several second time delay after returning to up position before the action is returned again.

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Jumping in OFP
« Reply #20 on: 13 Jul 2004, 10:55:03 »
This is my second reply to this thread - after 15 minutes of typing on my last one the server told me that it was too big and killed it !   :P

Jumping vehicles aren't a problem since I only assign the addAction to player units.  The addAction is generally unavailable when the player is in a vehicle and on the one or two occasions when a glitch did make it available the script did nothing on activation.

Jumping from prone IS a probem but from my various readings it looks as if there is no easy way to detect a unit's standing position (up, crouched or prone).

One simple way around this would be to add an animation at the start of the jump such as "stand from crouch" - this would make prone units look as if they're standing up up before jumping and would get rid of the need for any pause between jumps - the animation delay would make it unecessary.

MuSe: I haven't tried your jump script yet but if it's better - I'll use it !

Cheers



Roni


MuSe

  • Guest
Re:Jumping in OFP
« Reply #21 on: 13 Jul 2004, 11:05:15 »
Its along the right track but the time delay between the action becoming available after prone is unavoidable for now.

Neptune

  • Guest
Re:Jumping in OFP
« Reply #22 on: 15 Jul 2004, 13:28:32 »
Nah, I sorted it with this code a while ago ::
Code: [Select]
_guy removeaction jumpacc

~3

jumpacc = _guy addAction ["Jump","jump.sqs"]
exit
It removes the Jump action from the player, the waits 3 seconds, and adds it again
I guess your way would allow bunny-hopping.. But I can't remeber if the alt is from the ground or the sea-level (The ground level I'm sure)
But anyway, my way stops bunny-hopping :P

- Ben

aah yeah! You're right, good thinking.  :o

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #23 on: 16 Jul 2004, 17:45:42 »
@ Roni... ;D
Thats not a bug, it's fun! :P
Hmm... I can't think of way round that  :-\

As for the jumping while prone.. What about using a plavemove thing the beginning of the script, say the strokeweapon/fist anim..
If you've ever tried one of the ofp knifes, if you go prone, and try and fire it, you stand up, then it plays the anim..
Erm, unless somen finds a way of checking a players stance,thats me out of ideas  :-\

- Ben

Offline Nemesis6

  • Members
  • *
Re:Jumping in OFP
« Reply #24 on: 16 Jul 2004, 22:59:00 »
Try the "CombatGetOutTank" move. It's not the best one, but it's a start.
I am actually flying into a star... this is incredible!

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #25 on: 17 Jul 2004, 20:06:57 »
Hmm, only thing is, if you playmove and they're prone, and there is a pause to let the player stand up, it will look okay..
But if the player is standing, the pause will be naff  :-\
No pause and the player is prone, they jump while the prone-to-not anim is played.. :(

Hmmm, if that prone-to-not thing is played, afterwards, will the player still be standing..?
- Ben

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Jumping in OFP
« Reply #26 on: 19 Jul 2004, 01:50:12 »
I agree that there is no perfect way to make the anim look right without some way fo working out whether or not the player is standing up.    :-\  :'(

BTW - if you play the "prone to standing" anim (or any anim for that matter) then you will end up in the final stance for that anim (in this case - standing).

Maybe OFP2 will show us the way . . .



Roni


Offline MMFF

  • Members
  • *
  • Mission Maker From Finland
Re:Jumping in OFP
« Reply #27 on: 28 Jul 2004, 20:57:49 »
That is correct Roni... Maybe the OFP2 will lead the way now... :P :(
Do I need to play Operation Flashpoint to be here?

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #28 on: 28 Jul 2004, 23:20:24 »
Bah :P
I've posted this idea in a few places.. But no replies (To the part of my post anyway)
Here it is again ::
Make a bullet at foot height.. If if it hits, they're either prone, or higher
If it misses, err.. Quit the script, I suppose
Make a bullet at waist height, if it hits, they're not prone, but croched or standing, if it misses, they're prone, quit the script
Make a bullet at head height, if it hits, they're standing..

That could return the the position of the unit..?
- Ben

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Jumping in OFP
« Reply #29 on: 29 Jul 2004, 02:18:53 »
H DBR !

That's a fantastic idea !   :cheers:

At first I started thinking about the problems this approach would cause for things such as hit type event handlers, damage and healing and all the other stuff but then I hit on a similar idea that should work just as well or even better !  ;D

I have completed a number of scripts that allow the player to build a tent or a campfire.  The problem is - the thing keeps appearing at some random point around him and not exactly on his position or in front of him as it should.

I tracked the problem to the old OFP clipping problem and I now create the object WAY in front of the player, so at least you'll know where it is and not have to search for it after building it   :P

This made me think about your suggestion.  How about this for an algorithm -


Make a function called checkHeight.sqf and have it take in the name of the unit being checked, whether a real name or a variable (eg rags or _player).

The function will do this -

Create a small object at the EXACT position of the target unit, but 2.5m above his head.
Check the EXACT position of the object - if it is EXACTLY the same as the target unit then keep looping REALLY FAST !
Lower the height of the object by (say) 0.05 metre.
Check again

Keep checking until the object is displaced by trying to occupy the same space as the target unit.

At that point if the object height is above (say) 1.5m then say that the target unit is "Standing", if it is above (say) 1m then say that he is "Crouching", othewise say that he is "Prone".

Delete imaginary object and exit script.



That should do the trick !  It uses your idea of checking height of player without having to create a "zero damage" bullet addon or damage the player and heal him.

Of course I'd have to test it to work out the real limits for standing, crouching etc, but that SHOULD do the trick.

I'll try to draw this script up on the weekend and get back to the board with it if it works. (With full credit to you of course !  :cheers: )

Cheers !



Roni


DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #30 on: 16 Aug 2004, 13:13:08 »
So how's if comming along?
:)
- Ben

Offline MMFF

  • Members
  • *
  • Mission Maker From Finland
Re:Jumping in OFP
« Reply #31 on: 22 Dec 2004, 08:23:42 »
Down here again eh... HavenÂ't been here for a WHILE. By the way... About that vehicles jumping thing... Empty jeep, a man with the jump script= jumping jeep. I also tried it with skis and a snowboard.
Do I need to play Operation Flashpoint to be here?

DBR_ONIX

  • Guest
Re:Jumping in OFP
« Reply #32 on: 22 Dec 2004, 15:49:02 »
if you want to stop this.. Use... If I remeber correctly..
?(driver _unit != _unit):exit
It's something like that anyway.. Basicly it checks if _unit has a driver (Which people don't), and exits the script if it does
- Ben