Handy Tools Rope System by Geloxo (hotfix included)

---------------------------------------------------

Installation:

Copy @HT folder to your ArmA folder and the demo mission to your missions folder (please do not modify the folder names or scripts wonīt work). 
Delete any previous versions of HT.pbo from your hard disk cause this one includes a hotfix in 3D model that caused servers to crash.

---------------------------------------------------

Public Variables (informative for debug process)

* VEHICLE

- ht_rope_type: settings for attach bones (configure for each vehicle type: attach offset regarding driver pos, vectorup and visibility)
	= [_type, _off1, _vup1, _inv1, _off2, _vup2, _inv2]
- ht_rope_status: main script status
	= "active", "stop", "none"
- ht_rope_config: main script data
	= [_cargo, _mode]
- ht_rope and ht_rope2: rope pendulum variables
	= [_bonei, _thetai, _phii, _thetamaxi, _periodxi, _phimaxi, _periodyi, _rbone]
- ht_rope_drop: order to drop cargo
- ht_rope_bones and ht_rope_bones2: number of bones in the ropes

* CARGO

- ht_rope: cargo status
	= "waiting", "attached", "landed", "dropped", "terminated"
- ht_rope_acc: vehicle X and Y acceleration (speed substraction)
	= [_ax, _ay]
- ht_rope_bone: cargo position in rope (rope last bone ID)
- ht_rope_rad: cargo position in bone (radius)

* TROOPS

- ht_rope: unit status
	= "active", "landed", "terminated", "none"
- ht_rope_ID: rope the unit is assigned to
- ht_rope_bone: unit position in rope (rope bone ID)
- ht_rope_rad: unit position in bone (radius)

* OTHER ISSUES
- Proper animations for rapel are set in troops_position1.sqf and troops_position2.sqf: "MLB_Fast_Rope", "KA50_Pilot", "UH60_Pilot"

---------------------------------------------------

Attach configuration

If you want to add your custom configuration for any chopper edit rope_attach_type.sqf, located in @HT\Config folder, copy any existing block before the default one and set the following entries there:

	case "name": {
	//description for the attach config if you need so
		_off1 = [x, y, z];
		_dir1 = "left";
		_inv1 = true;

		_off2 = [x', y', z'];
		_dir2 = "right";
		_inv2 = false;

		_ropes = 2;

	};

The content goes as follows:

- A name for the config is needed to be called by the main script

- Number of ropes to be used is set in _ropes (values are 1 or 2). If you use only one rope you donīt need to add the variables _off2, _dir2 and _inv2, but _ropes is still needed

- Offset positions from vehicle [0,0,0] position. Set it by means of x,y,z and x',y',z'.

- Direction for the attach bone. Just leave "left", "right", "front" or "back" for ropes placed on left, right, front or back sides of the chooper

- Invisible attach point. Set _inv1 and _inv2 to true or false if you donīt want the attach bone to appear on rope 1 and rope 2. This is useful to fit rope to exsisting hooks in the chopper

---------------------------------------------------

Troops configuration

If you want to modify the conditions for troops to disembark for rapel operation just edit troops_init.sqf to fit to your needs. The final trigger to start the operation is to assign a public
variable "ht_rope" to each troop and set it to "active" value. Leader will disembark last, so please consider to add your modifications to him too.

---------------------------------------------------

Calling the script

You just need to call the main script as follows:

[helicopter, rope lenght, "config", "mode", unit or cargo] execVM "ht\rope.sqf";

Examples: 

	a) To make a chinook (heli1) transport and drop a cargo (tank1) with 30m rope lenght using the predefined config for 1 rope in the belly use: 
		[heli1, 30, "chinook_1c", "drop", tank1] execVM "ht\rope.sqf";

	b) To make a huey (heli1) perform a rapel insertion for a squad (squad1) with 20m rope lenght using the predefined config for 2 ropes (one on each door) use: 
		[heli1, 20, "huey_2", "rapel", squad1] execVM "ht\rope.sqf";

		Note: squad1 must be inside the chopper before the operation starts

	c) To make a blackhawk (heli1) pickup and transport a cargo (tank1) with 10m rope lenght using the predefined config for 1 rope in the belly use: 
		[heli1, 10, "hawk_1c", "pickup", tank1] execVM "ht\rope.sqf";

You can fire it in a radio or trigger, for instance.

---------------------------------------------------

Player actions

If player is onboard the helicoter, once the script runs several options will appear as actions on the vehicle

- Start rope camera: this brings some comeras to the gameplay, just for you to see the resulting operation
- Rise and lower ropes: this allows you to adjust the rope lenght once itīs deployed. Be careful with tall objets or they may collide with your choppers.
- Drop cargo: drops the attached cargo. You can use it or just bring the cargo to land manually lowering the rope or landing the chopper.
- Stop script: terminates the script

---------------------------------------------------

Comments for operation

If rope is not long enough for rapel troops will fall down and die, so keep your altitude while manual flying to allow the to complete the operation.

Manual pick up may become hard if you donīt take into account the following: hover near the object and increase power a little bit so that once the rope is attached the cargo altitude
does not drop to 0, which will trigger the end of the operation. Rope end needs to be slightly above cargo or even below ground level. In that case, the remaining rope will stay there. 
If you donīt want to see it just rise the rope and lower it again.

You can add waypoints to an AI chopper and call the script at any time, but be carefull with speeds and altitudes or it will become hard to perform the operation at your desired place.

---------------------------------------------------

Known issues

Due to game engine limitations the following errors will occur:

- Position of cargos or ropes may change while flying above irregular terrain areas (this is caused by setposASL command and maps with small peaks under sea level)
- Some static objects such as M119 gun or any "static" class produce an error on the second rope which seems to be caused by collision of bones with the object. This will not happen if you
use only one rope. On the other side those object canīt be dropped as their vertical speed canīt be set. You have to leave them on the ground instead of dropping them.
- Bones are objects of class "civilian" so units may identify them as unknown man in radio chat. I had to use that class in as they have two important features needed for the code: its
position is measured from the bottom and vectorup can be set on them.


Enjoy!

Geloxo

	