dlder 13 Posted September 6, 2020 Dear community, when I use my addon to open the Virtual Garage in SP or MP, I can spawn any vehicle I want and use it. BUT: for some reason, in MP my friend won't see the vehicle; and if I drive in said vehicle, he just sees me kinda floating over the ground. -> for me that means that the vehicle is spawned client side only; which shouldn't happen and is kinda weird, as the AI - which would run server side - CAN interact and enter my spawned vehicle... so maybe it's just other player-clients? Without further ado, here's the code I'm using: _keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((inputAction 'User16') > 0) then { if (serverCommandAvailable '#kick') then { if (isNil 'HS_PG_Opened') then { HS_PG_Opened = 1; _pos = player getPos [20, getDir player]; BIS_fnc_garage_center = createVehicle ['Land_HelipadEmpty_F', _pos, [], 0, 'NONE']; ['Open', true] call BIS_fnc_garage; } else { hint format ['Sorry %1, but in MP, the Virtual Garage is only available once every respawn!', profileName]; {sleep 5; hintSilent '';} spawn BIS_fnc_spawn; }; } else { hint format ['Sorry %1, but you are not an admin!', profileName]; {sleep 5; hintSilent '';} spawn BIS_fnc_spawn; }; };"]; And I've tried the following; executing the code on the server: ['Open', true] call BIS_fnc_garage; ------------------------------------------------------------------ ['Open', true] remoteExec ['BIS_fnc_garage', 2]; "2" is the target; in this case it's executed only on the server: doesn't work "0" doesn't work either -> this time the spawned vehicle will (of course) spawn for every player, but neither sees the vehicle of the other player So, what am I doing wrong? How am I able to spawn vehicles from the Virtual Garage in multiplayer? Thanks in advance for any help/pointers etc.!! cheers Share this post Link to post Share on other sites
7erra 629 Posted September 6, 2020 The Virtual Garage function spawns the vehicle only locally with createVehicleLocal. It might be necessary to replace the local vehicle with one that spawns globally when the player closes the garage. There is a scripted eventhandler that you might be able to use. 1 Share this post Link to post Share on other sites
dlder 13 Posted September 6, 2020 2 hours ago, 7erra said: The Virtual Garage function spawns the vehicle only locally with createVehicleLocal. That's it! I now created an eventhandler and it spawns a vehicle which is visible in MP 🙂 Now I "only" have to figure out how to select the spawned vehicle; so I can delete it and spawn the same type on the server... (unfortunately there is no return variable from "BIS_fnc_garage" 😒 Share this post Link to post Share on other sites
7erra 629 Posted September 6, 2020 BIS_fnc_garage_center contains the selected vehicle when the scripted EH fires 1 Share this post Link to post Share on other sites
dlder 13 Posted September 6, 2020 Really? Doesn't it contain "Land_HelipadEmpty_F"? Nope, you are absolutely right! Again! 🙂 Thank you very much!! Share this post Link to post Share on other sites
dlder 13 Posted September 6, 2020 YES, it worketh^^ Thanks again mate! Share this post Link to post Share on other sites
CharlzGamingYT 0 Posted June 20, 2021 what did you use as the scripted event handler, are you able to drop it here so i can use it on something im working on? @dlder Share this post Link to post Share on other sites
kibaBG 53 Posted November 9 Someone please help, I am trying to spawn globally what is chosen in Virtual Garage. [missionNamespace, "garageClosed", { hint "I am dumb"; }] call BIS_fnc_addScriptedEventHandler; How to get the vehicle reference? Share this post Link to post Share on other sites
pierremgi 4851 Posted Wednesday at 07:35 AM No need for remote executing something if you delete a re-create the vehicle (and crew) with global effect command createVehicle and createUnit So you garageClosed EH could be: [missionNamespace, "garageClosed", { private _type = typeof BIS_fnc_garage_center; private _pos = getPos BIS_fnc_garage_center; private _dir = getDir BIS_fnc_garage_center; private _crew = +fullCrew BIS_fnc_garage_center; private _typeOfCrew = getText (configfile / "CfgVehicles" / _type / "crew"); _crew apply {_x set [0,_typeOfCrew]}; deleteVehicleCrew BIS_fnc_garage_center; deleteVehicle BIS_fnc_garage_center; private _veh = _type createVehicle _pos; _veh setVariable ["BIS_enableRandomization", false]; if (_crew isNotEqualTo []) then { private "_ cr"; { _cr = group player createUnit [_typeOfCrew, [0,0,0], [], 0, "none"]; switch (_x #1) do { case "driver": {_cr moveInDriver _veh}; case "commander": {_cr moveInCommander _veh}; case "gunner": {_cr moveInGunner _veh}; case "turret": {_cr moveInTurret [_veh,_x#3]}; case "cargo": {_cr moveInCargo [_veh,_x#2,false]}; }; } forEach _crew; }; _veh setdir _dir; }] call BIS_fnc_addScriptedEventHandler; Share this post Link to post Share on other sites