Jump to content
FederalRazer89

Trying to move player and AI to vehicle with the "moveInCargo"

Recommended Posts

I am trying to create a mission that teleports the player and some newly created AI:s to a helicopter, but i encounter some problems with the "moveInCargo" commnad. I get generic error in expression, and the Ai units dont assume there new identity.

Also looking a way to find the edge of the map so i can start by flying form the edge of the map and spawn in other AI:s from the edge.

The script:

_Center              = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
_RandomStartPos      = [_Center, 2000, 10000, 3, 0, 20, 0] call BIS_fnc_findSafePos;
_spawnedVehicleArray = [_RandomStartPos,random (360),"B_Heli_Transport_01_F",west] call BIS_fnc_spawnVehicle;
_heli                = _spawnedVehicleArray select 0;
_heliCrews           = _spawnedVehicleArray select 2;
sleep 1;

 

player setFace "AfricanHead_01";
player setSpeaker "Male01ENGB";

player moveInCargo [_heli];

 

_unit1 = "B_medic_F" createUnit [position player, group player];
_unit1 setIdentity "Razer";
_unit1 moveInCargo [_heli];
_unit1 assignAsCargo [_heli];


_unit2 = "B_Recon_Sharpshooter_F" createUnit [position player, group player];
_unit2 setIdentity "Ghost";
_unit2 moveInCargo [_heli];
_unit2 assignAsCargo [_heli];

The script isnt done, going to add some waypoint and offloading of units and other stuff.

Edit: My plan is to create a mission which have controlled amount of AI across the map on several semi random objectivs. Used DUWS before as a plattform for a mission with the mod Ravage, but i started to get annoyed at several things big and small, especially the amount of AI that spawned and just took unnecessery CPU power.
 

Share this post


Link to post
Share on other sites
1 hour ago, killzone_kid said:

You might want to read documentation on moveInCargo first https://community.bistudio.com/wiki/moveInCargo


Really missed that detail, thanks should have gone to sleep early. But the spawned units dont join the player in the heli and "_unit2" dont spawn at all.

Edit: Removed assignAsCargo and added "units group player select 1" and it worked.

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

×