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

hmm... now i tryed 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) && (_vehicle isKindOf "Air")) exitWith {cutText ["You need a helipad to spawn air vehicles", "PLAIN DOWN"];};
if((count _vgcarspawn == 0) && (_vehicle isKindOf "Land")) exitWith {cutText ["You need a carpad to spawn land vehicles", "PLAIN DOWN"];};

if((count _helipad > 0) && (_vehicle isKindOf "Air")) then {
	_location = (getPosATL (_helipad select 0));
} else {
	if((count _vgcarspawn > 0)&& (_vehicle isKindOf "Land")) then {
		_location = (getPosATL (_vgcarspawn select 0));
	} else {
		_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
	};
};

but same problem.

 

if i called a car from garage, it doesn't spawn anything.... RPT log is clear... :( next time i try with "_vehicleclass isKindOf"...

 

some more ideas?

Link to comment
Share on other sites

  • 0

at the top of the "getvehicle.sqf" is _vehicle difined.

_vehicle = lbData[2802,(lbCurSel 2802)];
_vehicle = (call compile format["%1",_vehicle]);
_vehicleClass = getText(configFile >> "CfgVehicles" >> (_vehicle select 1) >> "vehicleClass");

i do not get it.
On my first attempt, the query code works with the helipad, but the query with the carpad not work. Although I have used the same variable. As if the "carpad" is ignored and thereby generates an error.

 

*Edit*

Now everything works fine....

changed _vehicle to _vehicleclass and modify the player position.

 

//Get Spawn Location
_dir = round(random 360);
_vgposplayer = getPos player;
_helipad = nearestObjects [_vgposplayer, ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army"], 70];
_vgcarspawn = nearestObjects [_vgposplayer, ["MAP_Heli_H_cross","Sr_border"], 70];
if((count _helipad == 0) && (_vehicleclass isKindOf "Air")) exitWith {cutText ["You need a helipad to spawn air vehicles", "PLAIN DOWN"];};
if((count _vgcarspawn == 0) && (_vehicleclass isKindOf "Land")) exitWith {cutText ["You need a carpad to spawn land vehicles", "PLAIN DOWN"];};

if((count _helipad > 0) && (_vehicleclass isKindOf "Air")) then {
	_location = (getPosATL (_helipad select 0));
} else {
	if((count _vgcarspawn > 0)&& (_vehicleclass isKindOf "Land")) then {
		_location = (getPosATL (_vgcarspawn select 0));
	} else {
		_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
	};
};

 

thanks for your help

Link to comment
Share on other sites

  • 0

Helipads are somewhat street like. They stay on the Groud, allways. The solution here is to use other Objects and then just play around with the positioning.

Link to comment
Share on other sites

  • 0

I can use another object as a spawn "marker" for the vehicle, but I can't find what is choosing the position of the vehicle in the code.

 

Here's the spawn vehicle code:

/*** Created by 0verHeaT ***/


private ["_index","_helipads","_helipadsnear","_nearestpad","_veh","_vehicle","_key","_vehname","_position","_checkkey","_sign"];
_index = _this select 0;
if (_index < 0) exitWith {cutText["\n\nNo Vehicle selected!","PLAIN DOWN"]};

_veh = VehStoredList select _index;
_vehicle = _veh select 0;
_key = _veh select 1;

_vehname = getText(configFile >> "cfgVehicles" >> (_vehicle select 0) >> "displayName");

_helipads = ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross"];

_helipadsnear = nearestObjects [(getPosATL player),_helipads,50];
if ((count _helipadsnear) < 1) exitWith {cutText["\n\nYou need a Helipad! Right click on your Toolbox to build one!","PLAIN DOWN"]};

_nearestpad = _helipadsnear select 0;
_position = getPosATL _nearestpad;

_checkkey = [player,_key] call BIS_fnc_invAdd;
if (!(_checkkey)) exitWith {cutText [(localize "str_epoch_player_107"),"PLAIN DOWN"]};

_sign = createVehicle ["Sign_arrow_down_large_EP1",_position,[],0,"CAN_COLLIDE"];

PVDZE_veh_spawn = [player,_vehicle,_sign,VirtualGarage];
publicVariableServer "PVDZE_veh_spawn";

cutText [format["\n\nYou have successfully spawned a %1, %2 has been added to your toolbelt.",_vehname,getText(configFile >> "CfgWeapons" >> _key >> "displayName")],"PLAIN DOWN"];

sleep 2;
call garage_getnearVeh;
call garage_getstoredVeh;

Link to comment
Share on other sites

  • 0

It is choosing one of the nearest objects defined in this array

["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross"];
You can add more objects to this array which also can be chosen as a position for the vehicle
Link to comment
Share on other sites

  • 0

I will write a quick script for that as soon as I get home.
But if you guys already want do it yourself try it with a check for LandVehicle or "isKindOf 'Air'"

 

EDIT:

 

Not Tested!

/*** Created by 0verHeaT ***/
private ["_Missing","_index","_SpawnPats","_helipadsnear","_nearestpad","_veh","_vehicle","_key","_vehname","_position","_checkkey","_sign"];
_index = _this select 0;
if (_index < 0) exitWith {cutText["\n\nNo Vehicle selected!","PLAIN DOWN"]};

_veh = VehStoredList select _index;
_vehicle = _veh select 0;
_key = _veh select 1;
_Missing = "";
_vehname = getText(configFile >> "cfgVehicles" >> (_vehicle select 0) >> "displayName");

if (_vehicle  isKindOf 'Air') then {
_SpawnPats = ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army"];
_Missing = "Helipad";
} else {
_SpawnPats = ["MAP_Heli_H_cross","Sr_border","MayAddMoreObejctsInHere"];
_Missing = "Parking Lot";
};

_helipadsnear = nearestObjects [(getPosATL player),_SpawnPats,50];
if ((count _helipadsnear) < 1) exitWith {cutText["\n\nYou need a "+_Missing+"! Right click on your Toolbox to build one!","PLAIN DOWN"]};

_nearestpad = _helipadsnear select 0;
_position = getPosATL _nearestpad;

_checkkey = [player,_key] call BIS_fnc_invAdd;
if (!(_checkkey)) exitWith {cutText [(localize "str_epoch_player_107"),"PLAIN DOWN"]};

_sign = createVehicle ["Sign_arrow_down_large_EP1",_position,[],0,"CAN_COLLIDE"];

PVDZE_veh_spawn = [player,_vehicle,_sign,VirtualGarage];
publicVariableServer "PVDZE_veh_spawn";

cutText [format["\n\nYou have successfully spawned a %1, %2 has been added to your toolbelt.",_vehname,getText(configFile >> "CfgWeapons" >> _key >> "displayName")],"PLAIN DOWN"];

sleep 2;
call garage_getnearVeh;
call garage_getstoredVeh;
Link to comment
Share on other sites

  • 0

doesnt work, client rpt

if (_vehicle  isKindOf 'Air') then {
_SpawnPats = ["He>
  Error position: <isKindOf 'Air') then {
_SpawnPats = ["He>
  Error iskindof: Type Array, expected String,Object
File mpmissions\__CUR_MP.chernarus\scripts\Garage\garage_spawnvehicle.sqf, line 12
Link to comment
Share on other sites

  • 0

YbFAvNW.jpgyeah, i see what you mean, can place the pad on the top level, it literally spawns 15m above it hangs there till takes dmg, falls to ground and blows up

 

need to adjust the re spawn hight above item, seems to be to much

Link to comment
Share on other sites

  • 0

yeah, i see what you mean, can place the pad on the top level, it literally spawns 15m above it hangs there till takes dmg, falls to ground and blows up

 

need to adjust the re spawn hight above item, seems to be to much

 

Which script are you using then now?

Link to comment
Share on other sites

  • 0

i placed a helipad ontop of the metal floor, for some reason, its getting all jacked up and adding an additional height parameter ontop of the helipad, it seems the higher it goes, the worse it gets

 

Would something like this work?

 

setPosATL [getposATL this select 0, getposATL this select 1, 4];
 
forcing the height variable of 4m above the item?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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