Jump to content
zealot111

Helicopter fastrope script

Recommended Posts

Helicopter fastroping script.

Allows players to toss ropes from helicopter and the fastrope to the ground using these ropes. Ropes are 50m long (A3 has ropes only this length) so you can fastrope from that height.

Helicopter must maintain speed under 10km/h while fastroping.

29/12/2013 Added animation while fastroping.(thanks to TheSystem for idea). Slightly increased fastroping speed. Heli pilot now cannot fastrope :)

Helicopter doors close after cutting the ropes.

26/12/2013 Added limited support of AI units fastroping. AI Members of the players team will fastrope after the leader. (Players still need to select "Fastrope" from the menu themselves) Fixed mh-9 once more :)

26/12/2013 Now script supports respawn. Increased speed limit for helicopter while fastroping.

25/12/2013 Updated script for mh-9 hummingbird. Now ropes should not damage helicopter while tossing.

Installation and Usage:

Put this script into your mission folder in Documents\Arma 3 - Other Profiles\{YOUR ARMA PROFILE NMAE}\MPMissions

Put in your init.sqf string:

[] execVM "zlt_fastrope.sqf";

Sample mission: http://stels-arma.ucoz.ru/rope_example.Stratis.zip

Script: http://stels-arma.ucoz.ru/zlt_fastrope.sqf

zlt_fastrope.sqf:

// v1g Fast Rope by [sTELS]Zealot

#define MAX_SPEED_WHILE_FASTROPING 10
#define MAX_SPEED_ROPES_AVAIL 30


#define STR_TOSS_ROPES "Toss Ropes"
#define STR_FAST_ROPE "Fast Rope"
#define STR_CUT_ROPES "Cut Ropes"


if (isdedicated) exitwith {};
waituntil {player == player};

zlt_rope_ropes = [];
zlt_mutexAction = false;

zlt_rope_helis = ["O_Heli_Light_02_unarmed_F","O_Heli_Light_02_F","B_Heli_Transport_01_F","B_Heli_Transport_01_camo_F","O_Heli_Attack_02_F","O_Heli_Attack_02_black_F","I_Heli_Transport_02_F","B_Heli_Light_01_F"];
zlt_rope_helidata = 
[
[
	["O_Heli_Light_02_unarmed_F", "O_Heli_Light_02_F"],
	[1.35,1.35,-24.95],
	[-1.45,1.35,-24.95]
],
[
	["B_Heli_Transport_01_F", "B_Heli_Transport_01_camo_F"],
	[-1.11,2.5,-24.7],
	[1.11,2.5,-24.7]
],
[
	["O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F"],
	[1.3,1.3,-25],
	[-1.3,1.3,-25]
],
[
	["I_Heli_Transport_02_F"],
	[0,-5,-26],
	[]
],	
[
	["B_Heli_Light_01_F"],
	[0.6,0.5,-25.9],
	[-0.8,0.5,-25.9]
]
];


zlt_fnc_tossropes = {
private ["_heli","_ropes","_oropes","_rope"];
_heli = _this;
_ropes = [];
_oropes = _heli getvariable ["zlt_ropes",[]];
if (count _oropes != 0 ) exitwith {};
_i = 0;
{
	if ((typeof _heli) in (_x select 0)) exitwith {
		_ropes = _ropes + [_x select 1];
		if ( count (_x select 2) !=0 ) then { 
			_ropes = _ropes + [_x select 2];
		};
	};
	_i = _i +1;
} foreach zlt_rope_helidata;

sleep random 0.3;
if ( count (_heli getvariable ["zlt_ropes",[]]) != 0 ) exitwith { zlt_mutexAction = false; };
_heli animateDoor ['door_R', 1];
_heli animateDoor ['door_L', 1];
{
	_rope = createVehicle ["land_rope_f", [0,0,0], [], 0, "CAN_COLLIDE"];
	_rope setdir (getdir _heli);
	_rope attachto [_heli, _x];
	_oropes = _oropes + [_rope];
} foreach _ropes;
_heli setvariable ["zlt_ropes",_oropes,true];

_heli spawn {
	private ["_heli","_ropes"];
	_heli = _this;
	while {alive _heli and count (_heli getvariable ["zlt_ropes", []]) != 0 and abs (speed _heli) < MAX_SPEED_ROPES_AVAIL } do {
		sleep 0.3;
	};
	_ropes = (_heli getvariable ["zlt_ropes", []]);
	{deletevehicle _x} foreach _ropes;
	_heli setvariable ["zlt_ropes", [], true];
};

};

zlt_fnc_ropes_cond = {
_veh = vehicle player;
_flag = (_veh != player) and {(not zlt_mutexAction)} and {count (_veh getvariable ["zlt_ropes", []]) == 0} and { (typeof _veh) in zlt_rope_helis } and {alive player and alive _veh and (abs (speed _veh) < MAX_SPEED_ROPES_AVAIL ) };
_flag;

};

zlt_fnc_fastropeaiunits = {
	private ["_heli","_grunits"];
	diag_log ["zlt_fnc_fastropeaiunits", _this];
	_heli = _this select 0;
	_grunits = _this select 1;

	dostop (driver _heli );
	(driver _heli) setBehaviour "Careless"; 
	(driver _heli) setCombatMode "Blue"; 

	_heli spawn zlt_fnc_tossropes;

	[_heli, _grunits] spawn {
		private ["_units","_heli"];
		sleep random 0.5;
		_units = _this select 1;
		_heli = (_this select 0);
		_units = _units - [player];
		_units = _units - [driver _heli];
		{if (!alive _x or isplayer _x or vehicle _x != _heli) then {_units = _units - [_x];}; } foreach _units;

		{ sleep (0.5 + random 0.7); _x spawn zlt_fnc_fastropeUnit; } foreach _units;
		waituntil {sleep 0.5; { (getpos _x select 2) < 1 } count _units == count _units; };
		sleep 10;
		(driver _heli) doFollow (leader group (driver _heli ));
		(driver _heli) setBehaviour "Aware"; 
		(driver _heli) setCombatMode "White"; 
		_heli call zlt_fnc_cutropes;

	};
};


zlt_fnc_fastrope = {
diag_log ["fastrope", _this];
zlt_mutexAction = true;
sleep random 0.3;
if (player == leader group player) then {
	[vehicle player, units group player] call zlt_fnc_fastropeaiunits;
};
player call zlt_fnc_fastropeUnit;
zlt_mutexAction = false;
};

zlt_fnc_fastropeUnit = {
private ["_unit","_heli","_ropes","_rope","_zmax","_zdelta","_zc"];
_unit = _this;
_heli = vehicle _unit;
if (_unit == _heli) exitWith {};

_ropes = (_heli getvariable ["zlt_ropes", []]);
if (count _ropes == 0) exitwith {};

_rope = _ropes call BIS_fnc_selectRandom;
_zmax = 22;
_zdelta = 7 / 10  ;

_zc = _zmax;
_unit action ["eject", _heli];
_unit switchmove "gunner_standup01";

_unit setpos [(getpos _unit select 0), (getpos _unit select 1), 0 max ((getpos _unit select 2) - 3)];
while {alive _unit and (getpos _unit select 2) > 1 and (abs (speed _heli)) < MAX_SPEED_WHILE_FASTROPING  and _zc > -24} do {
	_unit attachTo [_rope, [0,0,_zc]];
	_zc = _zc - _zdelta;
	sleep 0.1;
};
_unit switchmove "";
detach _unit;

};


zlt_fnc_cutropes = {
_veh = _this;
_ropes = (_veh getvariable ["zlt_ropes", []]);
{deletevehicle _x} foreach _ropes;
_veh setvariable ["zlt_ropes", [], true];
_veh animateDoor ['door_R', 0];
_veh animateDoor ['door_L', 0];

};

zlt_fnc_removeropes = {
(vehicle player) call zlt_fnc_cutropes;
};

zlt_fnc_createropes = {
zlt_mutexAction = true;
(vehicle player) call zlt_fnc_tossropes;
zlt_mutexAction = false;
};



player createDiarySubject [sTR_SCRIPTS_NAME,STR_SCRIPTS_NAME];
player createDiaryRecord [sTR_SCRIPTS_NAME,[sTR_SCRIPT_NAME, STR_HELP]];

player addAction["<t color='#ffff00'>"+STR_TOSS_ROPES+"</t>", zlt_fnc_createropes, [], -1, false, false, '','[] call zlt_fnc_ropes_cond'];
player addAction["<t color='#ff0000'>"+STR_CUT_ROPES+"</t>", zlt_fnc_removeropes, [], -1, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0'];
player addAction["<t color='#00ff00'>"+STR_FAST_ROPE+"</t>", zlt_fnc_fastrope, [], 15, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0 and player != driver vehicle player'];

player addEventHandler ["Respawn", {
player addAction["<t color='#ffff00'>"+STR_TOSS_ROPES+"</t>", zlt_fnc_createropes, [], -1, false, false, '','[] call zlt_fnc_ropes_cond'];
player addAction["<t color='#ff0000'>"+STR_CUT_ROPES+"</t>", zlt_fnc_removeropes, [], -1, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0'];
player addAction["<t color='#00ff00'>"+STR_FAST_ROPE+"</t>", zlt_fnc_fastrope, [], 15, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0 and player != driver vehicle player'];
}];

Edited by zealot111
  • Like 1

Share this post


Link to post
Share on other sites
Is there a way to change the animation on ejecting?

Now script doesnt handle players animation at all. If you find suitable animation in Arma3 editor you can edit script yourself to implement animation change. Or just tell me what animation you have in mind I will try to change the script...

Edited by zealot111

Share this post


Link to post
Share on other sites
Guest

Thanks for informing us about the release, I think I overlooked it myself :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Thanks for releasing this if it's as good as your repair script I'll be using it for sure

  • Like 1

Share this post


Link to post
Share on other sites

Hey man, that's some good code! Glad to see that we have scripters here who understand programming and optimization (not that we didn't before or anything).

I'm guessing you came from a C++ or C-type background?

Are ropes visible?

Yes.

Share this post


Link to post
Share on other sites

Hey Zealot. I put the script in the mission, put the init string in my missions init as well, there's no option to fast rope? Did I miss something?

Share this post


Link to post
Share on other sites
Hey man, that's some good code! Glad to see that we have scripters here who understand programming and optimization (not that we didn't before or anything).

I'm guessing you came from a C++ or C-type background?

Yes.

Yes, I am C programmer in the past.

---------- Post added at 20:32 ---------- Previous post was at 20:31 ----------

Year, I am C programmer in the past.

Have you tried demo mission? It runs allright? Have you any errors in RPT file?

Edited by zealot111

Share this post


Link to post
Share on other sites
Hey Zealot. I put the script in the mission, put the init string in my missions init as well, there's no option to fast rope? Did I miss something?

I cant get it to work either, I followed instructions but are we supposed to just copy // [] execVM "zlt_fastrope.sqf"; \\ straight into the init.sqf? looks like its missing something but Im a noob lol And yes I also made an sqf with the other code in it and named it correctly but no addaction is coming up in game. is there supposed to be something placed into the init field of the heli's?

Share this post


Link to post
Share on other sites
I cant get it to work either, I followed instructions but are we supposed to just copy // [] execVM "zlt_fastrope.sqf"; \\ straight into the init.sqf? looks like its missing something but Im a noob lol And yes I also made an sqf with the other code in it and named it correctly but no addaction is coming up in game. is there supposed to be something placed into the init field of the heli's?

The same question for you. Have you tried demo mission? It runs allright? Have you any errors in RPT file when you add [] execVM "zlt_fastrope.sqf"; to your missions init.sqf?

Share this post


Link to post
Share on other sites

Tested

MH-9

If deploying ropes lower than 50 meters, the ropes would kill the helo. Ghosthawk and Orca works very well, excellent work!

Share this post


Link to post
Share on other sites
Tested

MH-9

If deploying ropes lower than 50 meters, the ropes would kill the helo. Ghosthawk and Orca works very well, excellent work!

Thanks for the bug report! Version in the first post updated. MH-9 should work OK now.

Share this post


Link to post
Share on other sites

Hey Zealot.

I updated the script and was playing with your test mission and in the test mission I was able to toss the ropes from both the Blackhawk and the Little Bird. When I choose to Fast Rope, I exited the vehicle and fell to my death. I wasn't holding on to the rope I guess, haha. Have you or anyone else experienced this?

Share this post


Link to post
Share on other sites
Hey Zealot.

I updated the script and was playing with your test mission and in the test mission I was able to toss the ropes from both the Blackhawk and the Little Bird. When I choose to Fast Rope, I exited the vehicle and fell to my death. I wasn't holding on to the rope I guess, haha. Have you or anyone else experienced this?

When someone holding on the rope the helicopter should maintain speed less then 5 km/h or else it could end badly for fastroping units.

Share this post


Link to post
Share on other sites
Thanks for the bug report! Version in the first post updated. MH-9 should work OK now.

:cool:

Share this post


Link to post
Share on other sites

I updated the script and was playing with your test mission and in the test mission I was able to toss the ropes from both the Blackhawk and the Little Bird. When I choose to Fast Rope, I exited the vehicle and fell to my death. I wasn't holding on to the rope I guess, haha. Have you or anyone else experienced this?

yeah same for me - great script by the way. it looked like my player was actually in the initial stages of being attached to the rope but then he just fell.

Share this post


Link to post
Share on other sites

same here.....is it possible the toss and cut ropes only for pilot , and the fastrope only for cargo players?

Share this post


Link to post
Share on other sites
yeah same for me - great script by the way. it looked like my player was actually in the initial stages of being attached to the rope but then he just fell.

Updated first post with new version, now speed limit is set higher and added limited support of AI fastroping (if player is leader of AI team, then AI will follow player). Could you check latest version?

---------- Post added at 09:57 ---------- Previous post was at 09:56 ----------

same here.....is it possible the toss and cut ropes only for pilot , and the fastrope only for cargo players?

Yes, it is easy to implement but I decided to not limit players this way. I can add a switch to the script if you want this feature.

---------- Post added at 09:58 ---------- Previous post was at 09:57 ----------

yeah same for me - great script by the way. it looked like my player was actually in the initial stages of being attached to the rope but then he just fell.

Could you try with latest version? It should support AI fastroping and fastroping from AI helis.

Edited by zealot111

Share this post


Link to post
Share on other sites

now when i fastrope , the copilot follow me..... copilots and pilots cant fastrope..... only cargo units i think is more realistic.

is this an AI version??? do you release something for multiplayer?

Thats why i need the toss rope command only for player pilot and then the cargo player units can fastrope (not AI units)

---------- Post added at 13:52 ---------- Previous post was at 13:47 ----------

also , i can toss ropes when heli is on ground.

---------- Post added at 14:04 ---------- Previous post was at 13:52 ----------

another thing is if you r copilot and toss the ropes then mh9 explode......

---------- Post added at 14:10 ---------- Previous post was at 14:04 ----------

another thing is that when you r on ground and toss ropes , and then cut ropes, you end up with 2 addactions toss ropes. edit: this is my problem....wrong call point from my script ...fixed

if in copilot ,heli on ground ,engines off you can toss ropes, if engines on , explode

---------- Post added at 14:17 ---------- Previous post was at 14:10 ----------

when in and out of the heli , for each in, you get new addaction toss ropes edit: ...fixed too..same as above...

Edited by dragonsyr

Share this post


Link to post
Share on other sites
now when i fastrope , the copilot follow me..... copilots and pilots cant fastrope..... only cargo units i think is more realistic.

is this an AI version??? do you release something for multiplayer?

Thats why i need the toss rope command only for player pilot and then the cargo player units can fastrope (not AI units)

---------- Post added at 13:52 ---------- Previous post was at 13:47 ----------

also , i can toss ropes when heli is on ground.

---------- Post added at 14:04 ---------- Previous post was at 13:52 ----------

another thing is if you r copilot and toss the ropes then mh9 explode......

---------- Post added at 14:10 ---------- Previous post was at 14:04 ----------

another thing is that when you r on ground and toss ropes , and then cut ropes, you end up with 2 addactions toss ropes. edit: this is my problem....wrong call point from my script ...fixed

if in copilot ,heli on ground ,engines off you can toss ropes, if engines on , explode

---------- Post added at 14:17 ---------- Previous post was at 14:10 ----------

when in and out of the heli , for each in, you get new addaction toss ropes edit: ...fixed too..same as above...

1) Latest version of the script also fastrope all your AI command members with you (but pilot stays in helicopter). It should be playable in MP anyway.

2) It was only 1 bug with rope attach points on mh-9 and now it should be fixed in the latest version of the script.

3) In the next version script will limit rope tossing while heli on the ground and fast rope option will be available only for cargo units.

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

×