Jump to content
Sign in to follow this  
billw

BIS_fnc_spawnVehicle side doesn't work if vehicles side is not the same?

Recommended Posts

Sorry if the title is confusing: basically if I try and use BIS_fnc_spawnVehicle to spawn a BLUFOR MRAP (e.g. "B_MRAP_01_F") but on side east it doesn't correctly set the side? I tried with creating an east group and passing that as well but it still returned a vehicle that thought it was BLUFOR (showed blue on map). Only way I get it to work is if I create the group first, pass it in then add the vehicle and crew returned to the group again my self. Still the vehicle shows up blue on my map until I get close enough to it to presumably identify that the crew is in-fact opfor.

Any ideas, intended behavior (why?!) or bug?

Share this post


Link to post
Share on other sites

blufor units will show up as blue.

opfor units will show up as red.

indep units will show up as green.

civ units will show up as purple in the editor.

This will creat an MRAP with east units in the vehicle. The vehicle will show up as red on the map.

[] spawn {
_grp = createGroup EAST;
_veh = createVehicle ["B_MRAP_01_F", position player, [], 0, "NONE"];
[_veh, _grp,FALSE,"","O_Soldier_F"] call BIS_fnc_spawnCrew;
};

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Thanks!

So just to clarify, BIS_fnc_spawnVehicle IS broken? I know how to do this stuff "manually", but I am modifying an existing code base and want to make as few changes as possible. There is a piece of script that spawns enemies and requires an array of valid vehicle classes. Previously that list was OPFOR vehicles only, but I wanted to allow the enemies to use any vehicle so added the other classes to the list. But this for some reason causes the spawned vehicles to belong to whatever side the vehicle class defaulted to instead of the one being specified in spawnVehicle.

---------- Post added at 13:05 ---------- Previous post was at 11:32 ----------

Okay well it looks like this function definitely doesn't work consistently. I checked spawnCrew which is supposed to have a default mode where you don't provide a crew type and it derives it from the group side, but this uses selectCrew which can only return "USMC_Soldier_Crew", "US_Soldier_Crew_EP1", "RU_Soldier_Crew" or "TK_Soldier_Crew_EP1". So yeah...

Ahh, just seen, if I select A3 from the second drop down in Function viewer these "spawn" functions no longer show up, so I guess I shouldn't expect them to work for A3!

---------- Post added at 13:14 ---------- Previous post was at 13:05 ----------

For your consideration:

bw_fnc_spawnVehicle = 
{
private ["_vehicleType", "_group", "_position"];

_vehicleType = _this select 0;
_group = _this select 1;
_position = _this select 2;

_veh = createVehicle [_vehicleType, _pos, [], 0, "NONE"];

_soldierType = "";
switch(side _group) do
{
case west: { _soldierType = "B_Soldier_F"; };
case east: { _soldierType = "O_Soldier_F"; };
case resistance: { _soldierType = "I_Soldier_F"; };
default {};
};

[_veh, _group, FALSE, "", _soldierType] call BIS_fnc_spawnCrew;

_veh
};

_pos = position player;
_pos set [0, (_pos select 0) + 10];
_grp = createGroup west;
_veh = ["I_MRAP_03_F", _grp, _pos] call bw_fnc_spawnVehicle;

Thanks for the help!

Edited by billw
resistance not guer for side.

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  

×