this is what I have now and it still doesn't spawn on a ded. server with ammo:
MHQ init:
Code:
_mhqHandler = this execVM "respawn_scripts\mhq_respawn.sqf";
mhq_respawn.sqf:
Code:
if (isServer) then {
_vcl = _this;
_vclname = vehicleVarName _vcl;
call compile format["%1 execVM 'respawn_scripts\mhq_equip.sqf';",_vclname];
//specify the respawn wait times destroyed vehicles in the following 2 lines
_respawndelay = 10;
_dir = Getdir _vcl;
_pos = Getpos _vcl;
_type = typeOf _vcl;
_unit = driver _vcl;
while {!missionComplete} do {
_delay = Time + _respawndelay;
while {canMove _vcl && count crew _vcl > 0 && ({damage _x}forEach crew _vcl)!= 1} do {sleep 5.0};
while {canMove _vcl && count crew _vcl < 1} do {sleep 5.0};
while {canMove _vcl && {damage _x} forEach crew _vcl >= 1} do {sleep 5.0};
while {!canMove _vcl && Time < _delay} do {sleep 5.0};
if ((count crew _vcl) < 1) then {
deleteVehicle _vcl;
_vcl = _type createVehicle _pos;
_vcl SetVehicleVarName _vclname;
Call Compile Format ["%1=_vcl; PublicVariable ""%1"";",_vclname];
_vcl setvelocity [0,0,0];
_vcl setdir _dir;
if (forwardFarpSpawn == 1) then {_pos=Getpos forwardFarpGL};
_vcl setpos _pos;
//##########_mhqEquipHandle = _vcl execVM "respawn_scripts\mhq_equip.sqf";
call compile format["%1 execVM 'respawn_scripts\mhq_equip.sqf';",_vclname];
[] spawn {
_cone = createVehicle ["RoadCone",[0,0,0], [], 0, "FLY"];
_cone setVehicleInit "hint 'Our MHQ has been damaged too much. A new one respawned'";
processInitCommands;
deleteVehicle _cone;
};
};
};
};
if (true) exitWith {};
mhq_equip.sqf:
Code:
sleep 1.0;
private ["_vcl"];
_vcl = _this;
clearMagazineCargo _vcl;
clearWeaponCargo _vcl;
_vcl = _this;
_vcl addMagazineCargo ["30Rnd_556x45_StanagSD",30];
_vcl addMagazineCargo ["30Rnd_556x45_G36",30];
_vcl addMagazineCargo ["15Rnd_9x19_M9",20];
_vcl addWeaponCargo ["M8_compact",2];
_vcl addWeaponCargo ["M8_sharpshooter",2];
_vcl addMagazineCargo ["PipeBomb",10];
_vcl addAction ["Viewdistance +", "setViewDist.sqf", [500], -1,false, true, ""];
_vcl addAction ["Viewdistance -", "setViewDist.sqf", [-500], -1,false, true, ""];
sleep 1.0;
if (true) exitWith {};