Home   Help Search Login Register  

Author Topic: Jumping in OFP  (Read 3206 times)

0 Members and 1 Guest are viewing this topic.

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