Jump to content
Sign in to follow this  
v0lus

A group halo jump, and you're just an ordinary soldier

Recommended Posts

Clarifying the above, you're not the leader.

How do I make a group halo jump, activated by a trigger that can only be activated by their presence (or their plane's)? The catch is that I'm not the group leader, so I can't order my squad to halo jump. So how do I make it so, that by activating the trigger, my squad all gets out of the plane, and lands at a certain spot (not just anywhere)?

Share this post


Link to post
Share on other sites

Example mission:

https://dl.dropbox.com/u/37698503/HALOexample.Takistan.zip

put this in the aircraft waypoint - aircraft must be at 1000m height or so - I don't think triggers are ideal for this imho.

nul = [vehicle this] execVM "drop.sqf";

drop.sqf

//you need a functions module on the map
dropNum = dropNum +1;//defined as dropNum = 0; in init.sqf or group leaders init

player sidechat format["Airdrop 0%1 underway!",dropNum];

_aircraft = _this select 0;
 _dir = getDir _aircraft;
   _list = assignedCargo _aircraft;

{
unassignVehicle (_x); 
  (_x) action ["EJECT", vehicle _x];
    _x spawn bis_fnc_halo;

	sleep 0.3;
	  _x setDir (_dir - 180);
	    _x setVelocity [0,10,-20];
} foreach _list;

Squad will land in the grid square where they eject - precise landing solved below - post #5

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Just an idea, does the AI look after assigned doMove commands when in the air? Maybe issuing a doMove command towards an invisible object could get them to move to something specific.

Share this post


Link to post
Share on other sites

The only other thing I could think of was to setPosATL all the AI into a radius above the player before the parachutes are deployed. Tricky timing and if the player deploys the parachute early - it doesn't work. I tried doMove - didn't work.

Share this post


Link to post
Share on other sites

I have a solution to the last problem - might be bis_fnc_halo, I dunno but the horizontal velocity of the paratroopers increases during the drop and the formation can cover over 1000m with a full C-130. I came up with the idea of using a loop to control the x and y velocity and keep a tighter formation over the dropzone after setPosATL the paratroopers randomly around a marker during the eject, from the players perpective you don't really notice anything. New code shown in red.

Example mission: https://dl.dropbox.com/u/37698503/HALOexample2.Takistan.zip

//you need a functions module on the map

private ["_aircraft","_dir","_list"];
dropNum = dropNum +1;//defined as dropNum = 0; in init.sqf or group leaders init

player sidechat format["Airdrop 0%1 underway!",dropNum];

_aircraft = _this select 0;
 _dir = getDir _aircraft;
   _list = assignedCargo _aircraft;

{
unassignVehicle (_x); 
  (_x) action ["EJECT", vehicle _x];
    _x spawn bis_fnc_halo;

	sleep 0.1;
	  _x setDir (_dir - 180);
	    _x setVelocity [0,-20,-30];
} foreach _list;

[color="#FF0000"]waitUntil {count (assignedCargo _aircraft) == 0};
{_x setVelocity [0,0,((velocity _x) select 2)];
 _x SetPosATL [(getMarkerPos "dz1" select 0)+(floor (random 100)),(getMarkerPos "dz1" select 1)+(floor (random 100)),getPosATL _x select 2];[/color]
//you need a "dz1" marker to mark your dropzone, AI will land in a 100m radius aroud the marker, you can make this value smaller for smaller groups.
[color="#FF0000"]    } foreach _list;

while {true} do {
{_x setVelocity [0,0,(velocity _x select 2)];} foreach _list;//loop stops any horizontal movement so they fall straight down
 sleep 0.1;
   if ((player in _list && (getPosATL (_list select 0) select 2) <= 200)) exitWith {hint "Pull Ripcord! Open chute!";};//stops loop once first AI gets to 200m
     if ((!(player in _list) && (getPosATL (_list select 0) select 2) <= 200))  exitWith {};
};[/color]

Share this post


Link to post
Share on other sites

AI units using the bis_HALO_fnc are dependent on the group having a waypoint assigned to the LZ. If no waypoints are assigned, then by default they will be setvelocied to [0,0,0] at a fixed velocity equal to maximum velocity allotted to the player.

The Following is from an FSM I wrote that monitors AI both in freefall and under canopy. While in freefall use setvelocity, while under canopy use attachTo. (Parachute vehicles have effects scripted into them like wind ect. This will override that).

Freefall (Loops every 0.01 sec):

JTK_AI_GetAnim = {
_unit = _this select 0;
_dist = _this select 1;
_helper = _this select 2;

if (isNull _helper) exitwith {};

_InFrontOf = [_unit,_helper,(_dist/2)] call bis_fnc_isInFrontOf;

if ((_dist > 1.25) AND (_InFrontOf)) exitWith {"HaloFreeFall_F"};
if ((_dist > 1.25) AND !(_InFrontOf)) exitWith {"HaloFreeFall_B"};
if (true) exitwith {"HaloFreeFall_non"};
};
if (!_isWater) then {	
if (_unit == _pointJmpr) then {
	_unit setVelocity ([_unit,player] call JTK_GetVelocity);
}else{
	_form = if (getpos _pointJmpr select 2 > _wrn_alt) then {"STAG"}else{"DC"};
	_distTo = if (_form == "STAG") then {-(_stag_array select 0)}else{_DC_array select 0};
	_dirTo = if (_form == "STAG") then {_stag_array select 1}else{_DC_array select 1};
	_max = 3;
	_vz = [_unit,_pointJmpr] call JTK_GetROD;
	_vx = ((velocity _pointJmpr) select 0);
	_vy = ((velocity _pointJmpr) select 1);
	_formpos = [_pointJmpr,_distTo,_dirTo] call BIS_fnc_relPos;
	_dir_helper setPos _formpos;
	_dist = [_unit,_formpos] call BIS_fnc_distance2D;
	_unit playMoveNow ([_unit,_dist,_dir_helper] call JTK_AI_GetAnim);
	if (_dist > 0.5) then {
		if ((player getVariable "JTK_HALO_Status") != "WAITING") then {
			_dir = [_unit,_formpos] call BIS_fnc_dirTo;
			_speed = if ((_dist/25) < 1) then {_max*(_dist/25)}else{_max}; 
			_vx = _vx + (sin _dir*_speed);
			_vy = _vy + (cos _dir*_speed);
		};
	};
	_unit setVelocity [_vx,_vy,-_vz];
};
};

Under Canopy: (Loops every 0.05 sec):

_switchHelper = if ((getpos _pointjmpr select 2) < 25) then {true}else{false};
if ((_switchHelper) AND (_unit != _pointjmpr) AND (!_Landing)) then {
_dir_helper setDir (direction _unit);
_dir_helper setPos [position _unit select 0,position _unit select 1,0];
//_dist = [_unit,_pos] call BIS_fnc_distance2D;
_pos = _unit modelToWorld [0,15+(_index*5),0];
_Landing = true;
_attachPos = [0,0,position _unit select 2];	
};

if ((_Landing) AND (_unit != _pointjmpr)) then {
private ["_x","_y","_z"];
_dist = [_unit,_pos] call BIS_fnc_distance2D;
if(_dist < (_dist - (_index*0.5))) then {
	_x = 0;
	_y = 0;
}else{
	_x = (_avg_Chute_speed/_n);
	_y = (_avg_Chute_speed/_n);
};
_z = (_ROD/_n);
_attachPos = [_attachPos select 0,(_attachPos select 1)+_y,(_attachPos select 2)-_z];
_chute attachTo [_dir_helper,_attachPos];
};

if ((getpos _unit select 2) < 2 AND _Landing) then {
deleteVehicle _chute;
if (_unit != _pointjmpr) then {deleteVehicle _dir_helper};
_unit setPos [(getpos _unit) select 0,(getpos _unit) select 1,1.75];
};
if ((_unit == vehicle _unit) AND (isNull _chute)) exitwith {};

if (!_Landing) then {
if (_unit == _pointjmpr) then {
	private ["_x","_y","_z"];
	_dist = [_unit,_pos] call BIS_fnc_distance2D;
	if(_dist < (_dist - (_index*0.5))) then {
		_x = 0;
		_y = 0;
		_ROD = 10;
	}else{
		_x = (_avg_Chute_speed/_n);
		_y = (_avg_Chute_speed/_n);
	};
	_z = (_ROD/_n);
	_attachPos = [_attachPos select 0,(_attachPos select 1)+_y,(_attachPos select 2)-_z];
	JTK_GlobalAttachNew = [0,_y,(_attachPos select 2)-_z];
	_chute attachTo [_helper,_attachPos];
}else{
	if (!isNil "JTK_GlobalAttachNew") then {
		_new = JTK_GlobalAttachNew;
		_attachPos = [(_attachPos select 0) + (_new select 0),(_attachPos select 1)+(_new select 1),_new select 2];
		_chute attachTo [_helper,_attachPos];
	};
};
};

You can download the entire script here http://www.armaholic.com/page.php?id=18179 and pullout what you need.

NOTE: The videos shown were released before the FSM was made. To check formation while in free fall check put the picture.

Edited by Kempco

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  

×