Jump to content
Sign in to follow this  
philcommando

Jump/leap script

Recommended Posts

Dont u ever wish u could leap over bushes, logs and fences?

While attempting to re-script my horse for upgrading, i experimented and got the leaping feature done - it is possible! and can use for any vehicle although i would find perhaps only for animals, humans and fast cars/bikes.

//Leap script

//----------------------------------

_vehicle = _this select 0

_vehicle setdammage 0

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

_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3]

~0.5

exit

//--------------------------------

To use:-

1. place this script into one of your missions

2. use a trigger, set to radio alpha - repeatly

3. init:- [man1] exec "leap.sqs"

4. name any unit as man1, and click radio anytime u wanna leap.

To modify settings:-

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

XXX is the height - between 1 to 2 metres - yer choice

_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3]

1.3 is the units current speed X 1.3 to push the unit further.

:- many other ways to implement the script:-

-onemapclick

-addaction

-etc, etc.

Share this post


Link to post
Share on other sites

hhmm.. have to try that. Though i thought you couldnt use setvelocity with humans. I guess they have to be in the air first. Should be fun smile_o.gif

Share this post


Link to post
Share on other sites

Have a try.

As it is, if u are standing and jump, u will only jump upwards cos your speed is at 0

However if u are running and exec the jump, the speed u have will throw u forward, how far depending on the speed u set in the script.

To further improve the script for AI, perhaps to use nearestobject command, eg

?getpos nearestobject select 2>1m: _vehicle goto "1"

Share this post


Link to post
Share on other sites

!!!! crazy_o.gif I like Victor was also SURE you couldn't setvelocity a soldier !

wow, I'll have to try, if this works ........ opens a whole new bunch of projects smile_o.gif

Share this post


Link to post
Share on other sites

A consistent modified jump script of Philcommandos, the difference between this and the original is this has a smoother jump and fixes a few bugs.

smile_o.gif

Jump.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this select 0

_dammage = getdammage _vehicle

#Jump

_vehicle removeaction A2

_vehicle setdammage 0

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

~0.02

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

~0.02

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

~0.02

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

~0.02

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

_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3]

~0.5

_vehicle setdammage _dammage

~1

A2 = _vehicle addaction ["Jump", "Jump.sqs"]

exit

In The Players Init Line

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

A2 = this addaction ["Jump", "Jump.sqs"]

This works for as many players as you want. Please note there is now a rest between jumps to allow for the death that could follow due to "setvelocity" when you land after doing it twice or more quickly. wink_o.gif

There is currently a bug that will happen to all when using the Jump action in the action menu in MP, you can make other people use jump without them knowing it because if your close enough it pops up in your menu. If anyone knows a way around this please tell me. In SP dont add Jump.sqs to Ai use the script below:

JumpAi.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this select 0

_dammage = getdammage _vehicle

#Jump

_vehicle setdammage 0

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

~0.02

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

~0.02

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

~0.02

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

~0.02

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

_vehicle setvelocity [(velocity _vehicle select 0) * 1.3,(velocity _vehicle select 1) * 1.3,(velocity _vehicle select 2) * 1.3]

~0.5

_vehicle setdammage _dammage

exit

Share this post


Link to post
Share on other sites

anybody got a screen showing how high , far they can jump?

biggrin_o.gif got to test it when i get home from school but thats like 6-7 hours left untill i can play with this sad_o.gif

Share this post


Link to post
Share on other sites

Great job, AustralianSpecialForces!!!...its definately better than mine. May what u have done open up further improvement to AI.

One thing i noticed about ofp is that even when u try something that seem unreal as some had said about wearing all that gear and cant jump which is a myth as any soldier who has been in real battle will tell u - u will do anything when the real bullets to fly, to either save yourself or your buddy...........ofp's engine will still simulate it realistically thru its effect of gravity. U may fly but u wont fly forever! wow_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle setdammage 0

So when you're hit, just jump and you're allright?  rock.gif

I should :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_dam = getdammage _vehicle

; at the beginning

and...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle setdammage _dam

at the end.

Share this post


Link to post
Share on other sites

there's still a _vehicle setdammage 0 line in your code, 2th line under the #jump label  wink_o.gif

Oh , I see, ok, it doesn't matter, it's for safety...

I should also add a line (just before #jump)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? not canstand _vehicle : _vehicle removeaction A2;exit

If seen a jump animation once in an animpack, but I can't remember which one. (it wasn't static, so you can use it for this)

Meanwhile you can use :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle switchmove "CombatRunF"

when he's in the air and

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

@getpos _vehicle select 2 < 0.1

_vehicle switchmove "putdown"

...when he touches the ground again and to prevent bunnyhopping.

Maybe a loop is better here because when the player stays in the air (dunno why, but you'll never know smile_o.gif ) the script will never exit.

Share this post


Link to post
Share on other sites

Hunter released an anim pack that included a jumping animation about a year ago.

Have a look...

at this thread

Share this post


Link to post
Share on other sites

Dude,

this script is totally fun to play around with. Especially when you use a vehicle and set it to jump reaaaaaaaaaaaaally high up in the air from a standstill.

BOOOIIIIIINNNNNG wow_o.gif

Share this post


Link to post
Share on other sites

Nah, if you noted what happens in my script it makes a pause of 2 seconds, as this is changeable it still is good to keep it there to prevent us Bunnys. wink_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×