Jump to content
Sign in to follow this  
arigato

Script jumps (overcoming obstacles)

Recommended Posts

ARIGATO JUMPER SCRIPT (v1.2)

http://s015.radikal.ru/i330/1207/44/1945c31b784d.jpg (107 kB)

Bring to your attention the script jumps (something that lacked both players Arma :) ). Besides the standard jumping over low fences (default key is [V]) the script adds a full jump, with which you can fly over more serious obstacles. To jump using the traditional key [sPACE].

jumper.sqf

/*
* ARIGATO JUMPER SCRIPT (v1.2)
* (c) Arigato Software, 2012
*/

player setvariable ["ARGT_JUMP_POWER", 5.5, true];
player setvariable ["ARGT_JUMP_READY", true, true];

ARGT_JUMP =
{
 private ["_moves", "_state", "_velocity", "_power", "_speed"];
 if ( ! (player getvariable "ARGT_JUMP_READY") || vehicle player != player ) exitwith {true};
 _moves = configfile >> gettext ( configfile >> "CfgVehicles" >> typeof player >> "moves" );
 _state = getnumber (_moves >> "Actions" >> gettext ( _moves >> "States" >> animationstate player >> "actions" ) >> "upDegree");
 if ( _state in [1,2,3,4,5,6,7,11,13,14] ) exitwith {true};
 _power = (1 - (damage player)) * (player getvariable "ARGT_JUMP_POWER");
 _speed = _power / 2;
 _velocity = velocity player;
 player switchmove "ActsPercMrunSlowWrflDf_FlipFlopPara";
 player setvariable ["ARGT_JUMP_READY", false, true];
 player setvelocity [(_velocity select 0) + _speed * sin getdir player,
                     (_velocity select 1) + _speed * cos getdir player,
                     (_velocity select 2) + _power];
 true
};

player addeventhandler ["AnimDone",
{
 private ["_unit"];
 _unit = _this select 0;
 if ( ! (_unit getvariable "ARGT_JUMP_READY") ) then {_unit setvariable ["ARGT_JUMP_READY", true, true]};
}];

ARGT_KEYDOWN =
{
 private ["_dikcode"];
 _dikcode = _this select 1;
 switch ( true ) do
 {
   case ( _dikcode == 0x39 ) : {call ARGT_JUMP}; // DIK_SPACE
   default {false};
 };    
};

while { true } do
{
 waituntil { ! isnull finddisplay 46 };
 finddisplay 46 displayaddeventhandler ["KeyDown", "_this call ARGT_KEYDOWN"];
 waituntil { isnull finddisplay 46 };
};

He runs init.sqf mission, additional configuration is not required. To make it easier to understand attached the demo mission.

Notes:

1. Bots do not jump, just a player.

2. Not tested in multiplayer missions.

3. If you jump from a hill, and you can break.

4. The action assigned to the key [sPACE] will be lost.

5. The lower the player's health, the less power the jump.

Discussion: http://www.flashpoint.ru/threads/%D0%A1%D0%BA%D1%80%D0%B8%D0%BF%D1%82-%D0%BF%D1%80%D1%8B%D0%B6%D0%BA%D0%BE%D0%B2-%D0%BF%D1%80%D0%B5%D0%BE%D0%B4%D0%BE%D0%BB%D0%B5%D 0%BD%D0%B8%D0%B5-%D0%BF%D1%80%D0%B5%D0%BF%D1%8F%D1%82%D1%81%D1%82%D 0%B2%D0%B8%D0%B9.49776/

Download the demo mission:

1. http://www.armaholic.com/page.php?id=17140

2. http://narod.ru/disk/54944927001.5a029c99aeba19557fad08eefee4d215/JUMP.utes.zip.html

3. http://webfile.ru/6021715

© Arigato Software, 2012

Edited by Arigato

Share this post


Link to post
Share on other sites

ha i like that, would be cool to have something like this more realistic (short crouch slide to front or evasive role to left and right (only without heavy equipment).

this version here should fit well with the halo units :)

Share this post


Link to post
Share on other sites

If I read the lined properly, He defined the strength of the jump which you can modify too..

player***setvariable***["ARGT_JUMP_POWER",***5.5,***true];[/Code]

Good release anyways :)

Share this post


Link to post
Share on other sites

Yes, that's right, the strength of the jump is governed.

Share this post


Link to post
Share on other sites

I suppose _dikcode == 0x39 to define the key. Is there any list that shows which code represents which key? I use space for free look.

Btw, in IronFront'44 you can jump right out of running over fences. Would be great to have this feature in Arma as well.

Share this post


Link to post
Share on other sites

Thanks, Arigato (lol ;) )

Unfortunately, the rolling animation can not be seen by other players in multiplayer, since switchmove is local.

When you just execute

player switchmove "ActsPercMrunSlowWrflDf_FlipFlopPara";

other players see him sliding a bit forward without even moving the legs at all. A command "switchMoveGlobal" would be really great...

Other suggestions:

A jump/roll forward while you are moving backwards, looks strange:

if ( ! (player getvariable "ARGT_JUMP_READY") || vehicle player != player ) exitwith {true};
[color="#FF0000"]if ((speed player) < 0) exitwith {true};[/color]
[...]

You may also restrict the minimal required speed to < 15, so you only start to jump/roll when you have a certain speed.

Currently there is another problem:

When you hold a pistol in your hands, the character switches magically to his rifle when he starts to jump.

You can even create fun-deathmatch-maps with very high jumps. You just need to set unit allowdamage false while he is jumping (or at least about to land) to prevent the falling damage.

Share this post


Link to post
Share on other sites

At the expense of speed limits - good suggestion.

The problem with the pistol caused the most animated.

Share this post


Link to post
Share on other sites

I'm a huge fan of your fan of your defence script. This? Less keen.

Share this post


Link to post
Share on other sites

I'm afraid I'm out of the scripting routine too much to be of any help at the moment with this, but an idea I think could make this script very useful would be as follows.

Don't allow the player to jump more than once every few minutes with that kind of power, or include some kind of time-goverened scaling factor. Perhaps if the player jumps more than once in a short time there is a rapidly diminishing effect.

One could also base the size of the jump on what kind of equipment the player was carrying.

Finally there could be natural variances, either a randomization factor or simply a personal decision not to allow high jump strength factors on most units (except the most elite of the elite ;p).

Then, all our roleplaying-addon friends could even make it a skill where repeated use gradually increases your maximum jump strength.

In essence, I agree with all of you who say this is ridiculous, but at the same time I agree with the original intent of adding this kind of functionality.

I can't be the only one who finds it absurd to have died several times simply due to the player character not being able to climb a 4 foot obstacle.

Share this post


Link to post
Share on other sites

[objNull, player, rSWITCHMOVE, "ActsPercMrunSlowWrflDf_FlipFlopPara"] call RE;

Makes the animation seen on all clients

(Needs a functions module placed on the map).

Share this post


Link to post
Share on other sites

Seems a little high, but I love the tumble at the end of the jump. Nice job!

Share this post


Link to post
Share on other sites

Looks like a Portal 2 Anti fall Boots attached to that soldier, is there any way making the jump more realistic? (As, not lifting the guy up a meter and a half up in the air?) Thanks alot.

also, i'd suggest you put the realistic jump as default, and notify us if you edited all those awsome Member's notes (such as making the animation global and such.)

Thank you!

Share this post


Link to post
Share on other sites
[objNull, player, rSWITCHMOVE, "ActsPercMrunSlowWrflDf_FlipFlopPara"] call RE;

Makes the animation seen on all clients

(Needs a functions module placed on the map).

and where do we put this in the script??

and how hard would it be to make this a auto enabled addon??

Thanks in advance!! RougeTrooper

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  

×