joe_candy Posted April 20, 2015 Report Share Posted April 20, 2015 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 More sharing options...
0 Buck0 Posted May 18, 2015 Report Share Posted May 18, 2015 nope, that spawned it on the ground 2 floors under Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 18, 2015 Report Share Posted May 18, 2015 ok give some time, i will have a closer look on this then EDIT: Ok, i can only give guessings, because im not really able to test this, so you guys have to give me some ouput from this ^^ anyway. Cant really say whats wrong with this is, but defently solveable :) So lets try first some debug: server_spawnvehicle.sqf private ["_player","_vehicledata","_arrow","_key","_garage","_class","_cid","_colour1","_inventory","_fuel","_damage","_hitpoints","_location","_dir","_worldspace","_uid","_vehiclelist","_newlist"]; _player = _this select 0; _vehicledata = _this select 1; _arrow = _this select 2; _garage = _this select 3; _class = _vehicledata select 0; _cid = str(_vehicledata select 1); _colour1 = _vehicledata select 2; _colour2 = _vehicledata select 3; _inventory = _vehicledata select 4; _fuel = _vehicledata select 5; _damage = _vehicledata select 6; _hitpoints = _vehicledata select 7; _location = getPosATL _arrow; diag_log format ["[Schwedes-Debug] _location: %1 | getPos _arrow: %2",_location, (getPos _arrow)]; _dir = getDir _garage; _worldspace = [_dir,_location]; _uid = _worldspace call dayz_objectUID3; _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _cid, _worldspace, [], [], 1,_uid]; diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; [_arrow,_uid,_cid,_class,_dir,_location,_player,_colour1,_colour2,_inventory,_fuel,_damage,_hitpoints] spawn { private ["_object","_uid","_characterID","_done","_retry","_key","_result","_outcome","_oid","_class","_location","_object_para","_activatingPlayer","_colour1","_colour2","_inventory","_fuel","_damage","_hitpoints","_clrinit","_clrinit2","_objWpnTypes","_objWpnQty","_countr"]; _object = _this select 0; _uid = _this select 1; _characterID = _this select 2; _class = _this select 3; _dir = _this select 4; _location = _this select 5; _activatingPlayer = _this select 6; _colour1 = _this select 7; _colour2 = _this select 8; _inventory = _this select 9; _fuel = _this select 10; _damage = _this select 11; _hitpoints = _this select 12; _done = false; _retry = 0; while {_retry < 10} do { sleep 1; _key = format["CHILD:388:%1:",_uid]; diag_log ("HIVE: WRITE: "+ str(_key)); _result = _key call server_hiveReadWrite; _outcome = _result select 0; if (_outcome == "PASS") then { _oid = _result select 1; diag_log("CUSTOM: Selected " + str(_oid)); _done = true; _retry = 100; } else { diag_log("CUSTOM: trying again to get id for: " + str(_uid)); _done = false; _retry = _retry + 1; }; }; deleteVehicle _object; if(!_done) exitWith { diag_log("CUSTOM: failed to get id for : " + str(_uid)); }; _object = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"]; diag_log format ["[Schwedes-Debug] Object getPos: %1 | getPosASL: %2",(getPosASL _object), (getPos _object)]; _object setDir _dir; _object setvehiclelock "locked"; clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; _object setVariable ["ObjectID", _oid, true]; _object setVariable ["lastUpdate",time]; _object setVariable ["CharacterID",_characterID, true]; if (_colour1 != "0") then { _object setVariable ["Colour",_colour1,true]; _clrinit = format ["#(argb,8,8,3)color(%1)",_colour1]; _object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];"; }; if (_colour2 != "0") then { _object setVariable ["Colour2",_colour2,true]; _clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2]; _object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];"; }; _objWpnTypes = (_inventory select 0) select 0; _objWpnQty = (_inventory select 0) select 1; _countr = 0; { if(_x in (DZE_REPLACE_WEAPONS select 0)) then { _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x); }; _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)]; _countr = _countr + 1; } count _objWpnTypes; _objWpnTypes = (_inventory select 1) select 0; _objWpnQty = (_inventory select 1) select 1; _countr = 0; { if (_x == "BoltSteel") then { _x = "WoodenArrow" }; if (_x == "ItemTent") then { _x = "ItemTentOld" }; _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)]; _countr = _countr + 1; } count _objWpnTypes; _objWpnTypes = (_inventory select 2) select 0; _objWpnQty = (_inventory select 2) select 1; _countr = 0; { _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)]; _countr = _countr + 1; } count _objWpnTypes; _object setFuel _fuel; _object setDamage _damage; { private ["_selection","_dam"]; _selection = _x select 0; _dam = _x select 1; if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8}; [_object,_selection,_dam] call object_setFixServer; } forEach _hitpoints; PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object]; _object call fnc_veh_ResetEH; PVDZE_veh_Init = _object; publicVariable "PVDZE_veh_Init"; }; _vehiclelist = _garage getVariable ["StoredVehicles",[]]; _newlist = []; { private ["_data","_toremove"]; _toremove = false; if ((_x select 1) == _cid) then { _toremove = true; }; if (!_toremove) then { _data = [(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6),(_x select 7)]; _newlist set [count _newlist,_data]; }; } count _vehiclelist; _garage setVariable ["StoredVehicles",_newlist,true]; diag_log format["VIRTUAL GARAGE: Player %1 (%2) has spawned a %3 | "+str _newlist+"",(name _player),(getPlayerUID _player),_class]; [_garage,"gear",_newlist] spawn server_updateObject; i just added 2 lines with diag_logs for some output in the serverRPT So just spawn in a vehicle from the garage and search for them in the RPT and post them here. This should give enough info to solve this problem :) EDIT2: Just some trial: try on vanilla server_spawnvehicle.sqf under _location = getPosATL _arrow; add this: _location = [(_location select 0),(_location select 1),(_location select 2)]; Buck0 1 Link to comment Share on other sites More sharing options...
0 Guest Posted May 18, 2015 Report Share Posted May 18, 2015 Hi, so if you placed a heli pad under or above the metal floor (which is the same as under the metal floor, because it'll allways be painted on ground), then it's pretty Normal, that the Heli can't spawn there, as there is no space. it will find the best suitable position, which in that case is 30m above that metal floor. If you add the Metal Floor to this: _helipads = ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross"]; And change the code a little, to preferable use the metal Floor as Spawn point: /*** Created by 0verHeaT ***/ private ["_index","_helipads","_helipadsnear","_nearestpad","_veh","_vehicle","_key","_vehname","_position","_checkkey","_sign","_isMetalFloor","_getPosATL"]; _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; _isMetalFloor = false; _vehname = getText(configFile >> "cfgVehicles" >> (_vehicle select 0) >> "displayName"); _helipads = ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross","Metal_Floor_DZ"]; _helipadsnear = nearestObjects [(getPosATL player),_helipads,30]; if ((count _helipadsnear) < 1) exitWith {cutText["\n\nYou need a Helipad witin 30 meters to spawn a vehicle!","PLAIN DOWN"]}; _nearestpad = _helipadsnear select 0; //Overwrite first assignment, if Metal Floor { if (typeOf _x == "Metal_Floor_DZ") exitWith {_nearestpad = _x;_isMetalFloor = true;}; } count _helipadsnear; if (_isMetalFloor) then { _getPosATL = getPosATL _nearestpad; //Spawn a tiny bit above the Metal Floor, to avoid glitching. _position = [(_getPosATL select 0),(_getPosATL select 1),((_getPosATL select2)+0.2))]; } else { _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 More sharing options...
0 SchwEde Posted May 18, 2015 Report Share Posted May 18, 2015 the actual spawn position is actually from the red arrrow, so would be nice to know where it appears before the actual spawn Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 18, 2015 Report Share Posted May 18, 2015 Kk will run it when im home, unless cen gets you the info you need first Link to comment Share on other sites More sharing options...
0 cen Posted May 18, 2015 Report Share Posted May 18, 2015 The vanilla spawn vehicle isn't used though is it? The script uses this code to spawn the vehicle: https://github.com/0verHeaT/VehicleGarage/blob/master/Garage/garage_spawnvehicle.sqf Link to comment Share on other sites More sharing options...
0 cen Posted May 18, 2015 Report Share Posted May 18, 2015 try chaning this line _position = getPosATL _nearestpad; into this: _position = getPos _nearestpad; Tried this and the heli spawns underneath the metal floors/object still: Link to comment Share on other sites More sharing options...
0 cen Posted May 19, 2015 Report Share Posted May 19, 2015 Hi, so if you placed a heli pad under or above the metal floor (which is the same as under the metal floor, because it'll allways be painted on ground), then it's pretty Normal, that the Heli can't spawn there, as there is no space. it will find the best suitable position, which in that case is 30m above that metal floor. If you add the Metal Floor to this: _helipads = ["HeliH","HeliHCivil","HeliHRescue","MAP_Heli_H_army","MAP_Heli_H_cross"]; <SNIP> Tried this UK and it didn't even spawn the vehicle :D Link to comment Share on other sites More sharing options...
0 Guest Posted May 19, 2015 Report Share Posted May 19, 2015 Tried this UK and it didn't even spawn the vehicle :D And you used the whole code, without blindly copy + pasting? ^^ Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 Spawning to a metal floor seems like a bad idea, multiple levels of a base all with metal floors... whats forcing it to spawn to the one you want? Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 Wouldnt something like this be better? As its a defined spawn point //Overwrite first assignment, if SR_border { if (typeOf _x == "SR_border") exitWith {_nearestpad = _x;_SRborder = true;}; } count _helipadsnear; if (_SRBorder) then { _getPosATL = getPosATL _nearestpad; //Spawn a tiny bit above the S_ border, to avoid glitching. _position = [(_getPosATL select 0),(_getPosATL select 1),((_getPosATL select2)+0.2))]; } else { _position = getPosATL _nearestpad; }; Link to comment Share on other sites More sharing options...
0 cen Posted May 19, 2015 Report Share Posted May 19, 2015 And you used the whole code, without blindly copy + pasting? ^^ Yup used your entire code and it tells me there isn't a helipad within 30m. Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 what about the changed server_spawnvehicle.sqf? any results with it? what about the output in the Rpt? ( search for "Schwede") Buck0 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 what about the changed server_spawnvehicle.sqf? any results with it? what about the output in the Rpt? ( search for "Schwede") Ill test in a few hours, not near a pc currently SchwEde 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 what about the changed server_spawnvehicle.sqf? any results with it? what about the output in the Rpt? ( search for "Schwede") 22:19:39 "[schwedes-Debug] _location: [10264.1,9966.78,13.4601] | getPos _arrow: [10264.1,9966.78,6.73077]" 22:19:40 "[schwedes-Debug] Object getPos: [10264.1,9966.78,157.491] | getPosASL: [10264.1,9966.78,13.46]" SchwEde 1 Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 do you have screenshot of the vehicle, so i have a visual example for the output? Buck0 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 have done all testing same location with same setup Link to comment Share on other sites More sharing options...
0 Guest Posted May 19, 2015 Report Share Posted May 19, 2015 I think SchwEde is on the right way there actually. SchwEde, try spawning the Vehicle with a No Collide and then use setPosition after the vehicle was spawned :) Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 i think that might work, but first i would try a simplier solution replace: _location = getPosATL _arrow; with _location = getPos _arrow; _location = [_location select 0, _location select 1, _location select 2 + 0.2]; if that does not work then we can try it a little bit more complicated ^^ Buck0 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 so, thats an improvement.... its lower, but still far to high SchwEde 1 Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 dang it ^^ I will try something else, can you try to get me screenshot where the arrow is showing before the spawn of the vehicle? Buck0 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 best i could do Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 aaaaaah there it is ;D Thats what i thought ^^ Well give one second then i should get something :) EDIT: try replace this _position = getPosATL _nearestpad; with this _position = getPos _nearestpad; If the Heli is spawning on the ground then try to add this _location = [_position select 0, _position select 1, _position select 2]; after _position = getPos _nearestpad; I will summon Satan for help in the meantime :D Buck0 1 Link to comment Share on other sites More sharing options...
0 Buck0 Posted May 19, 2015 Report Share Posted May 19, 2015 both times, spawned on ground to confirm, this is the code i have used 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 select 0 isKindOf 'Air') then { _SpawnPats = ["Sr_border"]; _Missing = "Helipad"; } else { _SpawnPats = ["HeliHCivil"]; _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 = getPos _nearestpad; _location = [_position select 0, _position select 1, _position select 2]; _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 More sharing options...
0 SchwEde Posted May 19, 2015 Report Share Posted May 19, 2015 whopsie ^^ typo this _location = [_position select 0, _position select 1, _position select 2]; should be _position = [_position select 0, _position select 1, _position select 2]; will check for something else anyway :) is the helipad visible on the metal floor? Link to comment Share on other sites More sharing options...
Question
joe_candy
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
original getvehicle.sqf
Link to comment
Share on other sites
Top Posters For This Question
37
27
27
3
Popular Days
May 21
33
May 18
26
May 19
19
May 20
14
Top Posters For This Question
SchwEde 37 posts
cen 27 posts
Buck0 27 posts
joe_candy 3 posts
Popular Days
May 21 2015
33 posts
May 18 2015
26 posts
May 19 2015
19 posts
May 20 2015
14 posts
Popular Posts
SchwEde
Can you Display what vehicle is? if it's an array ["VehicleName"] then try it with _vehicle select 0 isKindOf 'Air'
SchwEde
ok give some time, i will have a closer look on this then EDIT: Ok, i can only give guessings, because im not really able to test this, so you guys have to give me some ouput from this ^^ any
SchwEde
what about the changed server_spawnvehicle.sqf? any results with it? what about the output in the Rpt? ( search for "Schwede")
103 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now