Jump to content
rlex

Virtual Garage - possible to use as spawner like VVS?

Recommended Posts

23 hours ago, dragonspride1995 said:

ok so it is spawning in the debug zone of the bottom left of the map

 

It's spawning at [0,0,0] because you didn't place a marker for them to spawn on. Read the entire thread, particularly Iconic's post where opec666's code originated.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 18/6/2016 at 4:01 PM, opec666 said:

I worked a little bit on the code Iconic posted above. I will share what I've got so far:

 

fn_garageNew.sqf:


disableSerialization;
uiNamespace setVariable [ "current_garage", ( _this select 0 ) ];
_fullVersion = missionNamespace getVariable [ "BIS_fnc_arsenal_fullGarage", false ];
if !( isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) ) exitwith { "Garage Viewer is already running" call bis_fnc_logFormat; };
{ deleteVehicle _x; } forEach nearestObjects [ getMarkerPos ( _this select 0 ), [ "AllVehicles" ], 10 ];
_veh = createVehicle [ "Land_HelipadEmpty_F", getMarkerPos ( _this select 0 ), [], 0, "CAN_COLLIDE" ];
uiNamespace setVariable [ "garage_pad", _veh ];
missionNamespace setVariable [ "BIS_fnc_arsenal_fullGarage", [ true, 0, false, [ false ] ] call bis_fnc_param ];
with missionNamespace do { BIS_fnc_garage_center = [ true, 1, _veh, [ objNull ] ] call bis_fnc_param; };
with uiNamespace do {  
	_displayMission = [] call ( uiNamespace getVariable "bis_fnc_displayMission" );
	if !( isNull findDisplay 312 ) then { _displayMission = findDisplay 312; };
	_displayMission createDisplay "RscDisplayGarage";
	uiNamespace setVariable [ "running_garage", true ];
	waitUntil { sleep 0.25; isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) };
	_marker = uiNamespace getVariable "current_garage";
	_pad = uiNamespace getVariable "garage_pad";
	deleteVehicle _pad;
	_veh_list = ( getMarkerPos _marker ) nearEntities 5;
	{
		_vehType = typeOf _x;
		_textures = getObjectTextures _x;
		
		_crew = crew _x;
		{
			_x spawn { 
				_this action [ "Eject", vehicle _this ];
				sleep ( random 2 );
				_this setDamage 1;
				sleep ( random 5 );
				deleteVehicle _this;
			};
		} forEach _crew;
		deleteVehicle _x;
		sleep 0.5;
		_new_veh = createVehicle [ _vehType, getMarkerPos _marker, [], 0, "CAN_COLLIDE" ];
		_new_veh setPosATL [ ( position _new_veh select 0 ), ( position _new_veh select 1 ), 0.25 ];
		_vehDir = markerDir _marker;
		_new_veh setDir _vehDir;
		_count = 0;
		{
			_new_veh setObjectTexture [ _count, _x ];
			_count = _count + 1;
		} forEach _textures;
	} forEach _veh_list;
};

Add to your editor-placed object's init:


this addaction ["<t color='#FFFF00'>Virtual Garage</t>", {[("garage_marker")] call opec_fnc_garageNew;}];

Download demo: garage-demo.VR.pbo

 

This garage script should be used by one person at a time, so you've been warned. The vehicle should be visible only to you while in the Garage screen. As soon as you exit the interface, the vehicle you had selected will spawn, facing the correct direction.

 

Vehicle textures will be saved over into the newly spawned vehicle. The VR AI crew will be ejected, ruthlessly killed and then deleted.

 

Remember to set the direction/azimuth of your marker so that your vehicle gets spawned correctly! Add as many object/marker pairs in your mission as you like.

 

 

Azimuth isn't working, how can I make it work?

Share this post


Link to post
Share on other sites
On 4/10/2015 at 3:04 AM, CptGrumpyCat said:

I just tried replacing BIS_fnc_arsenal with BIS_fnc_garage and it worked. It spawns the vehicle right beside the player though. So adding this to the players init field in the Mission-Editor should work:


this addaction ["Open Virtual Garage", {["Open",true] call BIS_fnc_garage;}];
 

 

Edit: Using 'vehicle allowDamage true' makes the vehicle vulnerable again, though I don't know how to apply this dynamically once the vehicle spawns.

For that part If you use a static position to spawn the vehicle ("helipad_1") just put a trigger that is repeatable on the spawn position. If player in trigger zone, getpos helipad_1, get nearest objects and set damage true. 

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

×