Home   Help Search Login Register  

Author Topic: HALO  (Read 3396 times)

0 Members and 3 Guests are viewing this topic.

Rhodesia

  • Guest
Re: HALO
« Reply #15 on: 12 Oct 2007, 02:57:35 »
Hi there

I keep getting errors here is what i have so far

_plane = _this select 0
@!(player in _plane)
~2.5
_num_chutes = 4
_radius = 6
_i = 0
_delta = 360 / _num_chutes
#create_formation
_pos = [(getPos (vehicle player) select 0)+sin(_delta * _i)*_radius,(getPos (vehicle player) select 1)+cos(_delta * _i)*_radius,(getPos (vehicle player) select 2) + 6]
chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
~0.1
"SoldierWPilot"createUnit [position chute,group team1,"this moveindriver chute"];
_i = _i + 1
?_i < _num_chutes: goto "create_formation"

 to be honest i dont know what i am really doing and think i may have cause a right mess
any help would be much apprecaited

what i am trying to acheive is a group parachuting out of a plane and landing close together and not being spread out so far
i would like to use this in a mission that i am making, i will give the credit to you guys for the help

Thanks in advance

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: HALO
« Reply #16 on: 12 Oct 2007, 14:34:24 »
Although this technique sort of works (as suggested by Jason0), it is a very inefficient way to detect when someone exits a vehicle. It also would only work at the end of init.sqs, since it doesn't run a new script. You should be placing a "GETOUT" event handler on the plane instead, which will be performed at the moment the player gets out of the plane, rather than continually checking whether the player is still in the plane using @.

Since it is a separate file, life is easier in SQF.

Code: (init on plane/helo) [Select]
this addEventHandler ["GETOUT", { _this execVM "jumpFormation.sqf" }];

Code: (jumpFormation.sqf) [Select]
_jumper = _this select 2;

// Only run the script if it is the local player jumping out of the plane.
if (_jumper != player) exitWith {};

// I suspect that waiting 2.5 seconds is a bit much, since you want the AI to
// appear as soon as the player has cleared the aircraft.
// You might like to play with this value to get the effect you want.
sleep 1;

_numChutes = 4;
_verticalOffset = 2; // Distance above player to put AI parachutes.
_radius = 10;
_delta = 360 / _numChutes;

// Create the formation.
for "_i" from 0 to (_numChutes - 1) do
{
_pos = [((getPos (vehicle player)) select 0) + (sin(_delta * _i) * _radius),
((getPos (vehicle player)) select 1) + (cos(_delta * _i) * _radius),
((getPos (vehicle player)) select 2) + _verticalOffset];

chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
chute setPos _pos;
chute setDir (getDir (vehicle player));

_soldier = "SoldierWPilot" createUnit [_pos, group player, "this moveInDriver chute"];

// Re-equip the soldier with removeAllWeapons,addWeapon,addMagazine here.
};

// Keep the formation on the way down (AI seem to paradrop using different
// physics to players!).
// This is quite ugly in a way, since the parachutes look like they are pinned
// in space, but otherwise, they would not keep in formation at all...
waitUntil
{
for "_i" from 0 to (_numChutes - 1) do
{
_pos = [((getPos (vehicle player)) select 0) + (sin(_delta * _i) * _radius),
((getPos (vehicle player)) select 1) + (cos(_delta * _i) * _radius),
((getPos (vehicle player)) select 2) + _verticalOffset];

(vehicle ((units (group player)) select (_i + 1))) setPos _pos;
};

// Wait until the player is near the ground to break the formation.
((getPos (vehicle player)) select 2) < 10;
};

exit;

On a more general note, saying that you are getting errors isn't very helpful to us, since it means we have to entirely recreate the mission you are testing, hoping that we make an exact copy just from your description. If we knew the error message, then we could probably fix the code without having to even fire up ArmA. Please either write down the full error message or take a screen-shot (but remember to trim the image down to just the black error area, or the file will be unnecessarily large).
« Last Edit: 12 Oct 2007, 14:45:19 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: HALO
« Reply #17 on: 12 Oct 2007, 17:43:46 »
Make sure the player gets out in the air and not with the plane/chopper landed :P
« Last Edit: 12 Oct 2007, 17:45:58 by Mandoble »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: HALO
« Reply #18 on: 12 Oct 2007, 18:02:25 »
Good point, but the script wasn't intended to be a very good solution. It isn't even HALO, which sort of got lost somewhere along the thread :whistle:

It would be nice if someone could make a proper HALO version of this, which caused the player's AI to actually jump out of the air vehicle (rather than spawning new AI in the air) and skydive into a close formation around the player for the long drop (actually moving realistically, rather than being "pinned in place"), then move apart to release their parachutes for the last part of the drop. Not going to be me though, but good luck if anyone can be bothered with a hard-core version ;P
« Last Edit: 12 Oct 2007, 18:04:01 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)