Jump to content
Sign in to follow this  
Eraknelo

Spawning Blufor/Opfor UAV's

Recommended Posts

I've been trying for a couple of days now to spawn in a Blufor UAV, so that any UAV Operator on the Blufor team can actually operate it.

I've tried the regular createVehicle as well as the BIS_fnc_spawnVehicle where you can say EAST or WEST. I've also tried doing assignTeam = "BLUE" in the initialization field of a UAV that's spawned in under "Empty" in the editor, but no luck.

Is this a bug, or am I doing something wrong?

Share this post


Link to post
Share on other sites
myUAV = [getPos player, 0, "B_UAV_02_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);  

Share this post


Link to post
Share on other sites

I too have been wondering how to do this, thanks kylania, though I would like to know how to spawn one that is on the ground in front of the player, and somehow restrict the max MQ4s that blufor can have operational at a time.

EDIT: Nevermind I found out how to do what I needed.

Edited by BravoM5

Share this post


Link to post
Share on other sites

Thanks, I'll check it out in a bit.

I could not have guessed you need to create vehicle crew :| The U in UAV does in the end stand for "Unmanned" :D

I too have been wondering how to do this, thanks kylania, though I would like to know how to spawn one that is on the ground in front of the player, and somehow restrict the max MQ4s that blufor can have operational at a time.

EDIT: Nevermind I found out how to do what I needed.

Could you enlighten us? :O I think I was struggling with that before as well.

Share this post


Link to post
Share on other sites

For spawning it on the ground use:

myUAV = createVehicle ["B_UAV_02_F", getPos player, [], 0,""];  
createVehicleCrew myUAV; 

Share this post


Link to post
Share on other sites

My goal was to get a UAV to respawn with the crew inside so that one can use it with the terminal as soon as it respawns. What I did was place the UAV in the editor I wanted to respawn with its respawn script and then I named it. After I did that I inserted a trigger that surrounded the UAV I wanted to use. I set the trigger activation to "Anybody" and "Repeatedly" then I added this into the "On Act." box.

createVehicleCrew yourUAVnamehere ;trigger triggerAttachVehicle [yourUAVnamehere];

Share this post


Link to post
Share on other sites

Alternatively you can edit the respawn script and add vehicle crew only if vehicle being respawned is uav

This way it will work for all uavs/ugvs

// after: _vehicle = ... createVehicle ...
if(getNumber(configFile >> "CfgVehicles" >> typeof _vehicle >> "isUav")==1) then {
   createVehicleCrew _vehicle; 	
};

Share this post


Link to post
Share on other sites
Alternatively you can edit the respawn script and add vehicle crew only if vehicle being respawned is uav

This way it will work for all uavs/ugvs

// after: _vehicle = ... createVehicle ...
if(getNumber(configFile >> "CfgVehicles" >> typeof _vehicle >> "isUav")==1) then {
   createVehicleCrew _vehicle; 	
};

Nice! That works perfectly! I was going to check every single model name, but this is quite a lot easier >.> Thank all of you guys :D

Share this post


Link to post
Share on other sites
For spawning it on the ground use:

myUAV = createVehicle ["B_UAV_02_F", getPos player, [], 0,""];  
createVehicleCrew myUAV; 

Kylania, sorry for the noob question but where would I place this php code please? Thanks.......

Share this post


Link to post
Share on other sites

- Set it in a trigger (F3), in the "onAct" box. Then set "activation" to Radio Alpha and set the trigger to "repeatedly" .

- Then in game, press 0 0 1 (numbers above the keyboard - not the numPad)

- Profit :)

Share this post


Link to post
Share on other sites

Thanks but what would the case be for multiplayer would all players have to go through this every time they want to re-use an uav? Sorry if this sounds daft!

---------- Post added at 23:01 ---------- Previous post was at 22:51 ----------

once the UAV has been used it and the user crashes it, it respawns locked so no one else can use it again, I guess this is meant to be because of the UAV controller is still connected to the player! Any chance of help making this re-usable for all Opfor to re-use after respawn? just like any other vehicle in this given situation? Thanks again.

Edited by daneplant

Share this post


Link to post
Share on other sites

Well if it's for multiplayer then it's a diffierent kettle of fish (and a bit more complicated).

It depends how you want to spawn them.

Are you thinking of spawning them from a base, or on request from the action menu of the players? (for example)

Share this post


Link to post
Share on other sites

Morning, I am wanting the UAV's to be available within the base and re-deployable once the last operator has crashed them, if that makes sense? so they need the regular Respawn as default but re-usable once spawned at base irrelevant if the operator still has his controller connected. Sort of re Sync another player and disconnect the first once he has crashed his toy! Thanks Buddy :P

Edited by daneplant

Share this post


Link to post
Share on other sites
Alternatively you can edit the respawn script and add vehicle crew only if vehicle being respawned is uav

This way it will work for all uavs/ugvs

// after: _vehicle = ... createVehicle ...
if(getNumber(configFile >> "CfgVehicles" >> typeof _vehicle >> "isUav")==1) then {
   createVehicleCrew _vehicle; 	
};

I need help please, this code works?

I could explain better?

where I put that code? I use this script to spawn vehicles:

/*  
==================================================================================================================
 Simple Vehicle Respawn Script v1.81 for Arma 3
 by Tophe of �stg�ta Ops [OOPS]

 Put this in the vehicles init line:
 veh = [this] execVM "vehicle.sqf"


 Options:
 There are some optional settings. The format for these are:
 veh = [object, Delay, Deserted timer, Respawns, Effect, Dynamic] execVM "vehicle.sqf"

 Default respawn delay is 30 seconds, to set a custom respawn delay time, put that in the init as well. 
 Like this:
 veh = [this, 15] execVM "vehicle.sqf"

 Default respawn time when vehicle is deserted, but not destroyed is 120 seconds. To set a custom timer for this 
 first set respawn delay, then the deserted vehicle timer. (0 = disabled) 
 Like this:  
 veh = [this, 15, 10] execVM "vehicle.sqf"

 By default the number of respawns is infinite. To set a limit first set preceding values then the number of respawns you want (0 = infinite).
 Like this:
 veh = [this, 15, 10, 5] execVM "vehicle.sqf"

 Set this value to TRUE to add a special explosion effect to the wreck when respawning.
 Default value is FALSE, which will simply have the wreck disappear.
 Like this:
 veh = [this, 15, 10, 5, TRUE] execVM "vehicle.sqf"

 By default the vehicle will respawn to the point where it first was when the mission started (static). 
 This can be changed to dynamic. Then the vehicle will respawn to the position where it was destroyed. 
 First set all preceding values then set TRUE for dynamic or FALSE for static.
 Like this:
 veh = [this, 15, 10, 5, TRUE, TRUE] execVM "vehicle.sqf"

 If you you want to set the INIT field of the respawned vehicle, first set all other values, then set init commands. 
 Those must be inside quotations.
 Like this:
 veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

 Default values of all settings are:
 veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf"


Contact & Bugreport: cwadensten@gmail.com
================================================================================================================== */


private ["_hasname","_delay","_deserted","_respawns","_noend","_dead","_nodelay","_timeout","_position","_dir","_effect","_rounds","_run","_unit","_explode","_dynamic","_unitinit","_haveinit","_unitname","_type"];
if (!isServer) exitWith {};

// Define variables
_unit = _this select 0;
_delay = if (count _this > 1) then {_this select 1} else {30};
_deserted = if (count _this > 2) then {_this select 2} else {120};
_respawns = if (count _this > 3) then {_this select 3} else {0};
_explode = if (count _this > 4) then {_this select 4} else {false};
_dynamic = if (count _this > 5) then {_this select 5} else {false};
_unitinit = if (count _this > 6) then {_this select 6} else {};
_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;
_unitname = vehicleVarName _unit;
if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};
_noend = true;
_run = true;
_rounds = 0;

if (_delay < 0) then {_delay = 0};
if (_deserted < 0) then {_deserted = 0};
if (_respawns <= 0) then {_respawns= 0; _noend = true;};
if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;
_position = getPosASL _unit;
_type = typeOf _unit;
_dead = false;
_nodelay = false;


// Start monitoring the vehicle
while {_run} do 
{	
 sleep (5 + (random 20));
 if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.
if (_deserted > 0) then
{
   _nearPlayers = false;
   {
     if ((_x distance _unit) < 0) exitWith { _nearPlayers = true; };
   } forEach playableUnits;
	if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8) and !_nearPlayers) then 
	{
		_timeout = time + _deserted;
		sleep 0.1;
	 	waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};
		if ({alive _x} count crew _unit > 0) then {_dead = false}; 
		if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; 
		if !(alive _unit) then {_dead = true; _nodelay = false}; 
	};
};

// Respawn vehicle
 if (_dead) then 
{	
	if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};
	if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
	if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};
	sleep 0.1;

	deleteVehicle _unit;
	sleep 2;
	_unit = _type createVehicle _position;
	_unit setPosASL _position;
	_unit setDir _dir;

	_dead = false;

	// Check respawn amount
	if !(_noend) then {_rounds = _rounds + 1};
	if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
};
};

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  

×