Jump to content
Sign in to follow this  
dustoff

assignascargo

Recommended Posts

I know there is a section in the wiki but I cant seem to get this to work correctly

Trying to make a part of the mission where you land and pick up a passenger and transport them to anthor spot .

Ive tried this code but the ai will not board the chopper , I can use the radio caommand while playing the mission and make him board and he gets out by hime self when I arrive at the place to be dropped off using the getout command but he will not board the chopper

hunter is the name of the ai and is assigned to the player group. Helio is the name of the chopper .

hunter assignAsCargo helio;

[hunter] orderGetIn true;

the unit spawns and I can control him with the radio command in game but he wont board the coppper .

Share this post


Link to post
Share on other sites

This will work if the ai is not part of the player group, but if he is and the player is the leader then it will not. You will need to use the action menu to order him to get in.

If it is important that he is part of the player group, then join him AFTER he gets in with something like;

hunter joinSilent group player;

Share this post


Link to post
Share on other sites

I tried making another group but he just goes to that ones commander .

I thought it was the problem of being the player group but not having success at making a group

Share this post


Link to post
Share on other sites

If he is not in the same group as the player, the commands you have given him should work. Where are you putting the code?

Here's a very simple example mission where I use this ...

Example Mission

In the onAct field of a scripted land waypoint I add the following code;


hint "well done you landed!"; [b]// just displays an on-screen hint[/b]
{_x assignascargo hsim_heli1} foreach units myGroup;  [b]// assigns each unit of the ai group to the helicopter[/b]
{[_x] ordergetin true} foreach units myGroup; [b]// orders each unit of the ai group to get in the helicopter[/b]

Each of the ai people are assigned to a group using the following in their initialisation code;

myGroup = group this;

Note, in my example the player is not part of the group.

If your ai is not in a group then you would use this;


hint "well done you landed!"; [b]// just displays an on-screen hint[/b]
hunter assignascargo hsim_heli1; [b]// assign hunter to the helicopter[/b]
[hunter] ordergetin true; [b]// order hunter to get in the helicopter[/b]

Edited by Jedra

Share this post


Link to post
Share on other sites

thanks I knew I was missing something simple .

I forgot this

Each of the ai people are assigned to a group using the following in their initialisation code;

Share this post


Link to post
Share on other sites

You may also be interested in the new command to assign cargo to a specific index:

_unit:Object assignAsCargoIndex [_vehicle:Object, _index:Scalar]

... and for turrets:

_unit:Object assignAsTurret [_vehicle:Object, _turretPath:Array]

Share this post


Link to post
Share on other sites

Hi guys,

I have a problem related to the boarding of the chopper too...

I can get the code above working fine when I pick up people on solid ground.

I tried to use the same code to get AI board my heli after I land on the rooftop of a skyscraper in Seattle but it doesn't work.

I carefully placed my AI passengers on the border of the helipad.

I see them start walking to me as soon as I landed but then they stand still at one of the sides of the helipad. It's like they don't have enough space around the chopper to board...

How can I succesfully pick up people when landing on a rooftop helipad??

Cheers,

Sylvain

Share this post


Link to post
Share on other sites

Use the TKOH scripted waypoint type “transport†and put a “transport†type waypoint on top of each unit

http://community.bistudio.com/wiki/BIS_fnc_wpTransport

Or use

unitName moveInCargo vehicle;

or

unitName moveInCargo [vehicle, CargoIndex];

in the on activation bit of the waypoint for all the units you want in at that point

http://community.bistudio.com/wiki/moveInCargo

In all cases there will be NO getting in sequence they will just immediately be in the cargo space

Share this post


Link to post
Share on other sites

Thanks a lot b101_uk!

Just for my personal understanding...

Is it due to space constraints on the rooftop that you cannot do this boarding action with an animation sequence??

Cheers,

Sylvain

Share this post


Link to post
Share on other sites

Something along those lines as implied in the txt in the “BIS_fnc_wpTransport†link.

Share this post


Link to post
Share on other sites

may be it can help you....

to add crew on a medium heli at start, I use one line of this code in the init section of each crew member:

co-pilot seat: this moveInTurret [heli_1,[0]];

left gunner seat: this moveInTurret [heli_1,[1]];

right gunner seat: this moveInTurret [heli_1,[2]];

back pilot seat: this moveInTurret [heli_1,[3]];

---------- Post added at 03:20 PM ---------- Previous post was at 03:13 PM ----------

and after some test: a script to take automaticaly the nearest civils in my chopter (with animation) function of free cargo seat available in chopter... (sorry for the comment in french)

/**********************************************************************************

***********************************************************************************

EMBARQUEMENT DE CIVILS DANS VEHICULE JOUEUR

Paramètres :

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

nul = [chef_de_groupe] execVM "civil_group_in.sqf"

*************************************************************************************

*************************************************************************************/

// *****************************************************************************************

// Inventaire des civiles les plus proches du véhicule à charger (=> _passagers)

// et

// Creation d'un groupe de civils (_grpcivils) en fonction du nombre des places libres (=> _placeslibres)

// *********************************************************************************************

/************************************************************

INITIALISATION DES VARIABLES LOCALES

*************************************************************/

_placesdepart = _placelibres;

_passagers = nearestObjects [getPos player , ["Woman01_Random_H","Citizen_Random_H","SeattleMan_Random_H","Woman03_Random_H","Woman02_Random_H","Workman_Random_H","Functionary_Random_H"],150];

_grpcivils = group (_passagers select 0);

_vehicule = vehicle player;

_placeslibres = _vehicule emptyPositions "cargo";

_nb_civil = count _passagers;

// **************************************************************************************************

// Création du groupe de civils les plus proches à transporter en fonction du nombre de places libres

// **************************************************************************************************

for "_x" from 1 to (_placeslibres - 1) do {

[_passagers select _x] join _grpcivils;

};

// ***********************************************

// Chargement des civils les plus proches

// ***********************************************

{_x assignAsCargo _vehicule; [_x] orderGetIn true;} forEach units _grpcivils;

hint "Embarquez !";

sleep 4;

// ***********************************************

// Boucle d'Affichage du nombre de places libres (Sortie si place libre =0 ou altitude repasse au dessus de 8

// ***********************************************

for [{_s = _placeslibres},{_s > 0},{_s = _s - 1}] do {

scopeName "loop";

hint format ["places restantes: %1", _s];

if (_s == (_placeslibres - _nb_civil)) then {

hint " plus personne a embarquer !";

sleep 3;

breakOut "loop";

};

waituntil {sleep 0.3; ((vehicle player emptyPositions "cargo") != _s) OR (getPos player select 2 >8)};

hint format ["places restantes: %1", (vehicle player emptyPositions "cargo")];

if (getPos player select 2 >4) exitwith {

hint format ["Reprise d'altitude", _grpcivils];

};

};

// ***********************************************

// Demembrement du groupe de passager

// ***********************************************

// hint " demembrement du groupe.... etape0";

{if (_x in _vehicule) then {} else {unassignVehicle _x}} foreach units _grpcivils; // libération des places assignés dans véhicule de ceux qui n'ont pas pu monter !

// hint " demembrement du groupe.... etape1";

{ _x join grpNull} forEach units _grpcivils;

// FIN

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  

×