Jump to content
  • 0

[Fixed] Virtual Garage - spawnpoints for different Vehicle


joe_candy

Question

Hey, i can't find my error, so i hope you could help me...

 

I try to use two different spawnpoints for Air and Land vehicle with two different "helipads".

 

"HeliHCivil" -> air vehicle

"Sr_border" -> land vehicle

 

i try some different codes at the "getvehicle.sqf" but nothing works.

RPT don't log some errors, so i don't know where i could find my error.

 

Try this code

//Get Spawn Location
_dir = round(random 360);
_helipad = nearestObjects [player, ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army"], 70];
_vgcarspawn = nearestObjects [player, ["MAP_Heli_H_cross","Sr_border"], 70];
if((count _helipad == 0) && (_vehicleClass == "Air")) exitWith {cutText ["You need a helipad to spawn air vehicles", "PLAIN DOWN"];};
if((count _vgcarspawn == 0) && (_vehicleClass == "Land")) exitWith {cutText ["You need a carpad to spawn land vehicles", "PLAIN DOWN"];};
if((count _helipad > 0) && (_vehicleClass == "Air")) then {
	_location = (getPosATL (_helipad select 0));
	} else {
		if((count _vgcarspawn > 0) && (_vehicleClass == "Land")) then {
		_location = (getPosATL (_vgcarspawn select 0));
	} else {
		_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
	};};

 

original getvehicle.sqf

// Developed by [GZA] David for German Zombie Apocalypse Servers (https://zombieapo.eu/)
private["_vehicle","_vehicleClass","_dir","_helipad","_location","_veh","_location","_veh","_result","_id","_inventory","_backpack","_fuel","_damage","_id"];
if(lbCurSel 2802 == -1) exitWith {hint  "No Vehicle selected"};
closeDialog 0;
_vehicle = lbData[2802,(lbCurSel 2802)];
_vehicle = (call compile format["%1",_vehicle]);
_vehicleClass = getText(configFile >> "CfgVehicles" >> (_vehicle select 1) >> "vehicleClass");



//Get Spawn Location
_dir = round(random 360);
_helipad = nearestObjects [player, ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross","Sr_border"], 70];
if((count _helipad == 0) && (_vehicleClass == "Air")) exitWith {cutText ["You need a helipad to spawn air vehicles", "PLAIN DOWN"];};
if(count _helipad > 0) then {
_location = (getPosATL (_helipad select 0));
} else {
_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
};

_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];


PVDZE_spawnVehicle = [_veh, [_dir,_location], player,  (_vehicle select 0)]; // _vehicle select 0 = id
publicVariableServer "PVDZE_spawnVehicle";

waitUntil {!isNil "PVDZE_spawnVehicleResult"};

if(PVDZE_spawnVehicleResult != "0") then {
			_result = "0";
			_id = parsenumber PVDZE_spawnVehicleResult;
			if ((_id > 0) && (_id <= 2500)) then {_result = format["ItemKeyGreen%1",_id];};
			if ((_id > 2500) && (_id <= 5000)) then {_result = format["ItemKeyRed%1",_id-2500];};
			if ((_id > 5000) && (_id <= 7500)) then {_result = format["ItemKeyBlue%1",_id-5000];};
			if ((_id > 7500) && (_id <= 10000)) then {_result = format["ItemKeyYellow%1",_id-7500];};
			if ((_id > 10000) && (_id <= 12500)) then {_result = format["ItemKeyBlack%1",_id-10000];};
			
			_inventory = (weapons player);
			_backpack = ((getWeaponCargo unitBackpack player) select 0);
			if (_result in (_inventory+_backpack)) then
			{
				if (_result in _inventory) then {cutText [format["Key [%1] already in your inventory!",_result], "PLAIN"];};
				if (_result in _backpack) then {cutText [format["Key [%1] already in your backpack!",_result], "PLAIN"];};
			}
			else
			{
				player addweapon _result;
				cutText [format["Key [%1] added to your inventory!",_result], "PLAIN"];
				
			};
};

PVDZE_spawnVehicleResult = nil;
PVDZE_queryGarageVehicleResult = nil;
sleep 2;
cutText ["Spawned Vehicle.", "PLAIN DOWN"];

Link to comment
Share on other sites

Recommended Posts

  • 0

ok, well still not really clue why the arrow appears 12m in the air.

 

Are you not using: 

PARACHUTE_TARGET

as a parking lot? Because i cant find it in the nearObjects array

Have you tried to spawn a car on an open field with this script?

 

Next thing we could do here is some dirty work, IF you want that the land vehicles spawn allways on the ground:

 

add this:

if (_vehicle select 0 isKindOf 'LandVehicle') then {
	_position = [_position select 0,_position select 1, 0.1];
};

under 

_position = getPosATL _nearestpad;

This is a solution for this problem, but it is the dirty way and only if you want the landvehicles should spawn on the ground

Link to comment
Share on other sites

  • 0

I moved the parking lot and it works fine now. So maybe it was an issue with the terrain?

 

I dunno :D

 

Gonna push this live and let players test it out now!

 

Schwede/UKMartin you guys are awesome for not giving up on this.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...