Jump to content
Sign in to follow this  
kibaBG

Spawn a group as cargo

Recommended Posts

Hi, I am trying to spawn a boat with 4 soldiers inside. 

//boat patrol   
private _boatgrp1 = createGroup [east, true];  
private _boat1 = [[7229.31,19598.3,0],350,"O_G_Boat_Transport_01_F",_vehgrp1] call BIS_fnc_spawnVehicle;
private _boatmen = [(getPos _boat1), EAST, ["O_Soldier_F","O_Soldier_F","O_Soldier_F" ,"O_Soldier_F"]] call BIS_fnc_spawnGroup;
{_x moveInCargo _boat1;} forEach units _boatmen;
{    
 _x setSkill ["general",1];    
 _x setSkill ["courage",1];     
 _x setSkill ["aimingAccuracy", 0.15];     
 _x setSkill ["aimingShake", 0.50];     
 _x setSkill ["aimingSpeed", 0.50];     
 _x setSkill ["reloadSpeed", 0.50];     
} forEach (units _boatmen);   
_vehgrp1 setBehaviourStrong "AWARE"; _vehgrp1 allowFleeing 0;
[_vehgrp1, 0] setWaypointBehaviour "AWARE";    
private _boatwp1 = _boatgrp1 addWaypoint [[7229.31,19598.3,0],-1];
_boatwp1 setWaypointType "MOVE"; [_boatgrp1, 1] setWaypointBehaviour "AWARE";
private _boatwp2 = _boatgrp1 addWaypoint [[7512.96,19268,0],-1];
_boatwp2 setWaypointType "MOVE"; [_boatgrp1, 2] setWaypointBehaviour "AWARE";
private _boatwp3 = _boatgrp1 addWaypoint [[7229.31,19598.3,0],-1];
_boatwp3 setWaypointType "CYCLE"; [_boatgrp1, 2] setWaypointBehaviour "AWARE";

Something is wrong because only the boat and driver spawn and not the infantry men. 🙄

Share this post


Link to post
Share on other sites

Pay attention to what the functions return.
https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle
https://community.bistudio.com/wiki/BIS_fnc_spawnGroup

//boat patrol   
private _vehgrp1 = createGroup [east, true];  
private _boat1 = [[7229.31,19598.3,0],350,"O_G_Boat_Transport_01_F",_vehgrp1] call BIS_fnc_spawnVehicle;
_boat1 = _boat1 select 0;
private _boatmen = [position _boat1, EAST, ["O_Soldier_F","O_Soldier_F","O_Soldier_F" ,"O_Soldier_F"]] call BIS_fnc_spawnGroup;
{_x moveInCargo _boat1;} forEach units _boatmen;
{	
 _x setSkill ["general",1];	
 _x setSkill ["courage",1];	 
 _x setSkill ["aimingAccuracy", 0.15];	 
 _x setSkill ["aimingShake", 0.50];	 
 _x setSkill ["aimingSpeed", 0.50];	 
 _x setSkill ["reloadSpeed", 0.50];	 
} forEach (units _boatmen);   
_vehgrp1 setBehaviourStrong "AWARE"; _vehgrp1 allowFleeing 0;
[_vehgrp1, 0] setWaypointBehaviour "AWARE";	
private _boatwp1 = _vehgrp1 addWaypoint [[7229.31,19598.3,0],-1];
_boatwp1 setWaypointType "MOVE"; [_vehgrp1, 1] setWaypointBehaviour "AWARE";
private _boatwp2 = _vehgrp1 addWaypoint [[7512.96,19268,0],-1];
_boatwp2 setWaypointType "MOVE"; [_vehgrp1, 2] setWaypointBehaviour "AWARE";
private _boatwp3 = _vehgrp1 addWaypoint [[7229.31,19598.3,0],-1];
_boatwp3 setWaypointType "CYCLE"; [_vehgrp1, 2] setWaypointBehaviour "AWARE";

 

  • Like 1

Share this post


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

Something is wrong because only the boat and driver spawn and not the infantry men. 🙄

_boat1 is not object (the boat), but array, see BIKI.

  • Like 1

Share this post


Link to post
Share on other sites

SUCCESS! -> https://ibb.co/QcTBgy2 🤠

private _boatgrp1 = createGroup [east, true];  
private _result = [[7229.31,19598.3,0],350,"O_G_Boat_Transport_01_F",_vehgrp1] call BIS_fnc_spawnVehicle;
private _vehicle = _result select 0; 
_result params ["_vehicle", "_crew", "_group"];
private _boatmen = [(getPos _vehicle), EAST, ["LOP_ISTS_OPF_Infantry_GL","LOP_ISTS_OPF_Infantry_AR_2",
"LOP_ISTS_OPF_Infantry_AR" ,"LOP_ISTS_OPF_Infantry_AT"]] call BIS_fnc_spawnGroup;
{_x moveInCargo _vehicle;} forEach units _boatmen;
{    
 _x setSkill ["general",1];    
 _x setSkill ["courage",1];     
 _x setSkill ["aimingAccuracy", 0.15];     
 _x setSkill ["aimingShake", 0.50];     
 _x setSkill ["aimingSpeed", 0.50];     
 _x setSkill ["reloadSpeed", 0.50];     
} forEach (units _boatmen);   

Thank you guys.  

 

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  

×