Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: fn_spawnVehicle.sqf
- Author: Bryan "Tonic" Boardwine
- Description:
- Spawns the selected vehicle, if a vehicle is already on the spawn point
- then it deletes the vehicle from the spawn point.
- */
- disableSerialization;
- private["_position","_direction","_className","_displayName","_spCheck","_cfgInfo"];
- if(lnbCurSelRow 38101 == -1) exitWith {hint "You did not select a vehicle to spawn!"};
- _className = lnbData[38101,[(lnbCurSelRow 38101),0]];
- _displayName = lnbData[38101,[(lnbCurSelRow 38101),1]];
- _position = getMarkerPos VVS_SP;
- _direction = markerDir VVS_SP;
- //Make sure the marker exists in a way.
- if(isNil "_position") exitWith {hint "The spawn point marker doesn't exist?";};
- //Check to make sure the spawn point doesn't have a vehicle on it, if it does then delete it.
- _spCheck = nearestObjects[_position,["landVehicle","Air","Ship"],12] select 0;
- if(!isNil "_spCheck") then {deleteVehicle _spCheck;};
- _cfgInfo = [_className] call VVS_fnc_cfgInfo;
- _vehicle = _className createVehicle _position;
- //_vehicle = [_className]execVM "scripts\vehicle\monitor.sqf";
- [[[this],"scripts\vehicle\monitor.sqf"],"BIS_fnc_execVM",false,true] call BIS_fnc_MP; //Need to put this script in the spawned vehicles init
- diag_log format ["%1, Spawned with Script", _className];
- _vehicle allowDamage false;
- _vehicle setPos _position; //Make sure it gets set onto the position.
- _vehicle setDir _direction; //Set the vehicles direction the same as the marker.
- if((_cfgInfo select 4) == "Autonomous") then
- {
- createVehicleCrew _vehicle;
- };
- if(VVS_Checkbox) then
- {
- clearWeaponCargoGlobal _vehicle;
- clearMagazineCargoGlobal _vehicle;
- clearItemCargoGlobal _vehicle;
- };
- _vehicle allowDamage true;
- hint format["You have spawned a %1",_displayName];
- closeDialog 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement