OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: sharkattack on 09 Sep 2007, 14:08:02
-
Hi ..
cant seem to my head around this ???
how could i create a soldier in a parachute in a position close to the players ( who would also be in a parachute)
many thanx
-
You may create the soldier, create a cute, move the chute near the players and then moveInDriver your soldier in the chute.
-
hey
thanx for swift reply mandoble
i can create the units and the chutes its getting the positioning correct
ideally id like to create 3 paras in flight in a close formation to the player
any advice :good:
-
Do you have any problem for that close formation?
-
yup
i dont know how to relay position of created unit to that of player in flight :-[
-
;5m to the right of player's vehicle (his chute)
_pos1 = (vehicle player) modelToWorld [5,0,0]
;5m to the left of player's vehicle (his chute)
_pos2 = (vehicle player) modelToWorld [-5,0,0]
-
this is what i have so far
para .sqs
=======
chute = createVehicle ["ParachuteWest", position player, [], 0, "FLY"];
~2
"SoldierWPilot"createUnit [position chute,group team1,"this moveindriver chute"];
----------------------------------
it works fine for one player
how would i incorporate the values you have given, to the para script
so that each para is created in a close formation to the player ??
----
edit
----
the easy way seems to be to include a slight delay in between the creation of each para as the drift of the chute seems to create a close formation of its own
but for future reference any advice on how to crerate units in a more accurate formation would be more than welcome
-
Chutes in circular formation around player
_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]
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"
-
excellent .. thanks very much mate :)
i will give it a try and let you know how it goes
many thanks :good:
edit
===
works like a treat many thanx :good:
-
hi the above script is excellent
however would it be possible to add a custom weapons loadout
to the created para jumper ?
many thanx
-
Yes,
_num_chutes = 4
_radius = 6
_group = group team1
_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]
_chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
~0.1
_soldier = _group createUnit ["SoldierWPilot",getPos _chute, [], 0, "NONE"]
_soldier moveInDriver _chute
removeAllWeapons _soldier;
_soldier AddWeapon "whateverweaponyoulike"
_i = _i + 1
?_i < _num_chutes: goto "create_formation"
-
hey thanx again mandoble ..
ps is there a way to ensure fellow parajumpers always start above you at the min sometimes they can start below positon of player dosnt look right ive tried but am failing big time
again many thanks for all youre help
-
Try 6m above player's pos.
_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]
-
Sorry if it seems like i am hijacking this thread and for my newbieness
i have questions that i would like to ask
1. How do i call this script - is this sqs or sqf format ?
2. can this be script be activated by an airplane so that the Halo group can jump from the plane ?
thanks in advance
-
1. [] exec "scriptname.sqs"
2. Would need to be adapted.
this exec "scriptname.sqs
_plane = _this select 0
@!(player in _plane)
~2.5
...
Rest of script
...
Should wait for the player to Eject out of the aircraft, 2.5 second pause then carry on with what the script originally did.
-
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
-
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.
this addEventHandler ["GETOUT", { _this execVM "jumpFormation.sqf" }];
_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).
-
Make sure the player gets out in the air and not with the plane/chopper landed :P
-
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