Jump to content
fat_lurch

Is there a way to add vehicle passengers in config.cpp?

Recommended Posts

Hello,

 

As stated in the title: I'm looking for ways to add/define passengers to a vehicle in the config.cpp. (not after init, e.g. not moveInCargo). 

 

Example: a transport helicopter pre-loaded with infantry to act as a QRF. 

 

Thanks in advance for any help!

 

For reference: I wound up searching for answers to anyway I could think of phrasing this question online for about an hour before posting this. I also went through some BID sample config. I'm fearing this may not be possible, but I'm hoping someone knows the magic for this.

Share this post


Link to post
Share on other sites

It's been a while since I've done faction and vehicle configs, but I think you are looking for the typicalCargo entry.

Share this post


Link to post
Share on other sites
On 7/13/2017 at 6:00 AM, Gilatar said:

It's been a while since I've done faction and vehicle configs, but I think you are looking for the typicalCargo entry.

Thanks for the tip @Gilatar,

 

I tried adding this line to a custom RHS HMMWV and Mi-8 with no luck. I tried a few variations:

 

typicalCargo[] = {"Soldier", "Soldier"};

typicalCargo[] = {"myCustomClassname", "myCustomClassname"};  //Where myCustomClassname is the actual class name of one of my infantry configs

 

I've also tried adding 1-5 soldiers in case the number of units was somehow the issue.

 

Can anyone expand upon this?

 

Thanks

Share this post


Link to post
Share on other sites
On 14/7/2017 at 11:16 PM, fat_lurch said:

Can anyone expand upon this?

 

Hello there fat_lurch !

 

Take a look here :

 

9 hours ago, GEORGE FLOROS GR said:

Hello there Guys !

 

# It's NOT to Show off ,

just a little bit of tease and another code in the BI forum for Everyone

 

 

  • ________________ GF Auto Population Script - Mod ________________
  • Not Yet published
  • This will be my next release so more new here :

 

 

 

Helicopters.sqf  - some part

  Reveal hidden contents







//________________  Author : GEORGE FLOROS [GR] ___________	22.01.19	_____________

/*
________________ GF Auto Population Script - Mod ________________

Not Yet published

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /*
means that it is disabled , so there is no need to delete the extra lines.

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain colors to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


/*
//________________	add this to use	________________
//________________	Helicopters_Transport_	________________
[] spawn GF_AP_Spawn_Helicopters_Patrol;
[] spawn GF_AP_Spawn_Helicopters_Defend;
[] spawn GF_AP_Spawn_Helicopters_Attack;
*/


//________________	GF_AP_Spawn_Helicopters_Patrol	________________

GF_AP_Spawn_Helicopters_Patrol = {

_Pos = GF_AP_Pos;
_Pos_Spawn = _Pos getPos [250,random 360];
_Spawn_Height = 1000;
_Group = createGroup GF_AP_Enemy_Side;
_Group_Crew = createGroup GF_AP_Enemy_Side;

_Helicopter = selectRandom GF_AP_Pool_Helicopters; 
_Spawned_Helicopter = createVehicle [_Helicopter,_Pos_Spawn, [], 0, "FLY"];
_Spawned_Helicopter setPosATL [getPosATL _Spawned_Helicopter select 0, getPosATL _Spawned_Helicopter select 1, _Spawn_Height];
_Spawned_Helicopter engineOn true;


//________________	Count all available seats including cargo slots	________________

_Seats_Number = [_Helicopter,true] call BIS_fnc_crewCount;	

if (GF_AP_Systemchat_info) then {
	systemchat format ['Vehicle: %1		seats:	%2', _Helicopter , _Seats_Number];
};


//________________	 Counts all available seats excluding cargo slots	________________

_Seats_Number_Crew = [_Helicopter,false] call BIS_fnc_crewCount;


//________________	 Spawn Crew	________________

for "_x" from 1 to _Seats_Number_Crew do {

	_unit_Crew = _Group_Crew createunit [selectrandom GF_AP_Pool_Infantry_Helicopters,_Pos_Spawn,[],0,"None"];
	[_unit_Crew] JoinSilent _Group_Crew;
	_unit_Crew moveInAny _Spawned_Helicopter;
	(leader _Group_Crew) setSkill GF_AP_set_AiSkill + floor random GF_AP_set_AiSkill_random;

if (GF_AP_Change_Equipment) then {	
_unit_Crew spawn GF_SCL_GF_AP;
};

	removeBackpack _unit_Crew;
	_unit_Crew addBackPack "B_parachute";
	
};


//________________	 Counts all cargo slots	________________

_Seats_Number_Cargo = _Seats_Number - _Seats_Number_Crew;	

//________________	 Spawn units in Cargo	________________

for "_x" from 1 to _Seats_Number_Cargo do {

	_unit = _Group createunit [selectrandom GF_AP_Pool_Infantry,_Pos_Spawn,[],0,"None"];
	[_unit] JoinSilent _Group;
	_unit moveInAny _Spawned_Helicopter;
	(leader _Group) setSkill GF_AP_set_AiSkill + floor random GF_AP_set_AiSkill_random;
			
if (GF_AP_Change_Equipment) then {	
_unit spawn GF_SCL_GF_AP;
};

	private _data = [backpack _unit,backpackitems _unit];
    removeBackpack _unit;
	_unit addBackPack "B_parachute";	
		  
	[_unit,_data] spawn {
	private ["_unit","_data"];
	_unit = _this select 0;
	_data = _this select 1;
	waitUntil { isTouchingGround _unit || (position _unit select 2) < 1 };
	sleep 1;
	removeBackpack _unit;
	_unit addbackpack (_data select 0);
	{_unit additemtobackpack _x;} foreach (_data select 1);
	};
	
};


[_Group_Crew,_Pos,GF_AP_Air_Patrol_distance + floor random GF_AP_Air_Patrol_distance_random] call BIS_fnc_taskPatrol;
[_Group,_Pos,GF_AP_Air_Patrol_distance + floor random GF_AP_Air_Patrol_distance_random] call BIS_fnc_taskPatrol;

while {(alive _Spawned_Helicopter)} do {
	_Spawned_Helicopter flyInHeight (50 + (random 2000));
	_getPosATL = getPosATL _Spawned_Helicopter;
	_nearEntities = _getPosATL nearEntities 2000;
	{_Group_Crew reveal [_x,4];} count _nearEntities;
	sleep 50;
	};
};

 

 

GF_Auto_Population_Remover.sqf

  Reveal hidden contents


//________________  Author : GEORGE FLOROS [GR] ___________	22.01.19	_____________

/*
________________ GF Auto Population Script - Mod ________________

Not Yet published

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /*
means that it is disabled , so there is no need to delete the extra lines.

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain colors to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


if (GF_AP_Systemchat_info) then {
systemchat "GF_Auto_Population_Remover Initializing";
};


if (GF_AP_Diag_Log_info) then {
diag_log "//________________	GF_Auto_Population_Remover.sqf	_____________";
diag_log "//________________ GF_Auto_Population_Remover Initializing _____________";
};


[]spawn	{
	while {true} do {

		uisleep GF_AP_Remover_Loop;
		_list = GF_AP_centerPosition nearEntities [["Man", "Air", "Car", "Ship", "Tank"], worldSize];	
							
		_Exclude_List = [
		"examle_classname..."
		]; 
		
		{	
		_Entity = _x;
		if (
	
			(isNull(attachedTo _Entity)) 
			&& (alive _x)
			&& (!((typeOf _x) in _Exclude_List))  
			&& (_x getVariable ["Var_GF_AP_Spawn",true])
			&& {(({((_x distance _Entity) < GF_AP_Remover_Distance)}count GF_AP_allPlayers)isEqualTo 0)} 
			
		) then {
		_list = _list - [_x];
		deleteVehicle _x};
		}forEach _list;
				
		if (GF_AP_Systemchat_info) then {
		systemchat "GF_AP_Remover_Loop";
		};
		
	};	
};


if (GF_AP_Systemchat_info) then {
systemchat "GF_Auto_Population_Remover Initialized";
};


if (GF_AP_Diag_Log_info) then {
diag_log "//________________ GF_Auto_Population_Remover Initialized _____________";
};

 

 

Info:

You can set a Variable to your spawned unit and see the remover code up ,

in order not everything to get deleted.

 

 

The most of the code is from my GF Missions Script ,

 

but i need to update this , as well.

The WIP GF Auto Population Script - Mod is ready but i'm still making some tests and adjustments.

 

I hope that i helped you !  :thumbs-up:

  • Like 1

Share this post


Link to post
Share on other sites
53 minutes ago, pierremgi said:

Here is a simple script spawning vehicles & units for a group, and move units in free cargo (the vehicles spawn with their crew anyway, using bis_fnc_spawnGroup)

 


0 = [] spawn {
  _assets = ["B_soldier_f","B_soldier_A_f","B_soldier_AAR_f","B_soldier_AAR_f","B_soldier_AR_f","B_soldier_AT_f","B_medic_f","B_truck_01_transport_F","B_LSV_01_armed_F","B_MBT_01_cannon_F"];  // or what you want
_spawnGrp = [];
  For "_i" from 0 to (round random 30 max 8) do {
    _spawnGrp pushBack (selectRandom _assets)
  };
  _grp = [ getMarkerPos "spawnHere", side player,_spawnGrp,[],[],[],[],[],180,false] call BIS_fnc_spawnGroup;
 
// interesting part for you:
//==========================
  _vehs = [_grp,true] call BIS_fnc_groupVehicles;
  _units = (units _grp select {isnull objectParent _x});
  {
    _unit = _x;
    {if ( (_x emptyPositions "cargo") > 0) exitWith {_unit moveInCargo _x};nil} count _vehs;
    nil
  } count _units;
};

 

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

×