jandrews 116 Posted March 22, 2015 (edited) So far I have gotten some great HELP here. Thanks for that. I am attempting to have resupply crates with side specific only supplies for players. I plan on 2 ways to do this, resupply drops with only nato on loop timer and opfor / resistance supplies in ammo trucks. questions 1. My Nato resupply (which I have had some great help making works) but I have to settle with arsenal only, I have tried several crate fillers with no luck, I have gotten it to spawn with a trigger but would like it to loop to random locations with game logic markers every 45 min. code below. Using the loop now only places the marker and spams the script messages with no supply drop. I have tried adding if(isServer)then{}; with no luck. // Use game logic markers // nul = [] execVM "SupplyDrop.sqf"; // random position for supply drop _drop = getPos ([drop1, drop2, drop3, drop4, drop5, drop6, drop7, drop8, drop9, drop10] call BIS_fnc_selectRandom); // add marker _marker = createMarker ["Supply", _drop]; _marker setMarkerType "hd_join"; _marker setMarkerColor "ColorWEST"; _marker setMarkerText "Nato Supply Drop"; _marker setMarkerSize [1,1]; _rndPos = [getMarkerPos _marker,5,10,15,0,0.5,0,[],[]] call BIS_fnc_findSafePos; _rndPos set [2, 0]; _chute = createVehicle ["NonSteerable_Parachute_F",[(_rndPos select 0), (_rndPos select 1), ((_rndPos select 2) + 150)],[], 0, "CAN_COLLIDE"]; _crate = createVehicle ["B_supplyCrate_F",[(_rndPos select 0), (_rndPos select 1), ((_rndPos select 2) + 150)],[], 0, ""]; _crate addAction ["<t color='#ffffff'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}]; _crate attachTo [_chute,[0,0,1]]; clearMagazineCargoGlobal _crate; clearWeaponCargoGlobal _crate; clearItemCargoGlobal _crate; clearBackpackCargoGlobal _crate; _crate allowDamage false; _chemlight = "chemlight_blue" createVehicle (position _crate); _chemlight attachto [_crate, [0,0,0]]; _blueSmoke = "SmokeShellBlue" createVehicle (position _crate); _blueSmoke attachto [_crate, [0,0,0]]; [{systemChat "Nato Supply drop near map marker, blue smoke and chemlight, 30 minutes to locate"},"BIS_fnc_call",true,false] spawn BIS_fnc_MP; hint "Nato Supply drop near map marker, blue smoke and chemlight, 30 minutes to locate"; sleep 35; detach _crate; sleep 1800; // delete marker and vehicles deleteMarker "Supply"; deleteVehicle _chute; deleteVehicle _crate; 2. fixed, kinda. need to resolve veh respawn Thanks for cont'd help! Edited March 22, 2015 by JAndrews1 Share this post Link to post Share on other sites
jandrews 116 Posted March 22, 2015 (edited) Question #2. fixed, a bug with sync module, will not allow me to sync veh's with full init box stuff. once un sync'd it shows up. Edited March 22, 2015 by JAndrews1 Share this post Link to post Share on other sites
demonized 20 Posted March 22, 2015 you call the script with //nul = [this] execVM "AAF_Ammo.sqf"; wich would make the crate _this select 0 in the script itself, but you are using _this wich will actually make _this [this] in the script, wich obviously is wrong Share this post Link to post Share on other sites
jandrews 116 Posted March 22, 2015 Ok, I figured it out for #2, when I load the veh's with the above various _this addItemCargoGlobal AND then sync to module for veh respawn it gets bugged and removes ALL contents except for default. DANG! well now to try something else. ---------- Post added at 19:07 ---------- Previous post was at 18:42 ---------- Ok, SO along with question #1, I am trying to have ammo trucks respawn with this addMagazineCargoGlobal["100_Rnd_762_Mag_Belt_TR",30]; type code.... any way? Or does this need a script? Share this post Link to post Share on other sites
demonized 20 Posted March 22, 2015 https://community.bistudio.com/wiki/addMagazineCargoGlobal upon seeing it will be globally broadcasted, i would think you might need to enclose it to only server. if (isServer) then {this addMagazineCargoGlobal["100_Rnd_762_Mag_Belt_TR",30]}; its all depending on type of "respawn" and if you process init or just run the code in the respawn script. Only run the code once, no matter how you do things. Share this post Link to post Share on other sites
jandrews 116 Posted March 22, 2015 (edited) ok, so I will use whatever vehicle respawn that works, but for this example I am using the spoiler. So my idea is to load each sides ammo trucks with specific side weapons/items/mags, using this addMagazineCargoGlobal["100_Rnd_762_Mag_Belt_TR",30 for each item works like a charm as long as you dont use BIS veh repawn module... But once I blow it up, it respawns empty. I will use whatever works at this point. /* ================================================================================================================== Simple Vehicle Respawn Script v1.81 for Arma 3 by Tophe of �stg�ta Ops [OOPS] Put this in the vehicles init line: veh = [this] execVM "vehicle.sqf" Options: There are some optional settings. The format for these are: veh = [object, Delay, Deserted timer, Respawns, Effect, Dynamic] execVM "vehicle.sqf" Default respawn delay is 30 seconds, to set a custom respawn delay time, put that in the init as well. Like this: veh = [this, 15] execVM "vehicle.sqf" Default respawn time when vehicle is deserted, but not destroyed is 120 seconds. To set a custom timer for this first set respawn delay, then the deserted vehicle timer. (0 = disabled) Like this: veh = [this, 15, 10] execVM "vehicle.sqf" By default the number of respawns is infinite. To set a limit first set preceding values then the number of respawns you want (0 = infinite). Like this: veh = [this, 15, 10, 5] execVM "vehicle.sqf" Set this value to TRUE to add a special explosion effect to the wreck when respawning. Default value is FALSE, which will simply have the wreck disappear. Like this: veh = [this, 15, 10, 5, TRUE] execVM "vehicle.sqf" By default the vehicle will respawn to the point where it first was when the mission started (static). This can be changed to dynamic. Then the vehicle will respawn to the position where it was destroyed. First set all preceding values then set TRUE for dynamic or FALSE for static. Like this: veh = [this, 15, 10, 5, TRUE, TRUE] execVM "vehicle.sqf" If you you want to set the INIT field of the respawned vehicle, first set all other values, then set init commands. Those must be inside quotations. Like this: veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf" Default values of all settings are: veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf" veh = [this, 30, 0, 0, TRUE, FALSE, "this disableTIEquipment true; clearWeaponCargoGlobal this; clearMagazineCargoGlobal this;"] execVM "vehicle.sqf"; // LAND VEHICELS veh = [this, 30, 0, 0, TRUE, FALSE, "this setPosASL [position this select 0, position this select 1, 16];this disableTIEquipment true; clearWeaponCargoGlobal this; clearMagazineCargoGlobal this;"] execVM "vehicle.sqf"; //VEHICLES ON CARRIER Contact & Bugreport: cwadensten@gmail.com ================================================================================================================== */ private ["_hasname","_delay","_deserted","_respawns","_noend","_dead","_nodelay","_timeout","_position","_dir","_effect","_rounds","_run","_unit","_explode","_dynamic","_unitinit","_haveinit","_unitname","_type"]; if (!isServer) exitWith {}; // Define variables _unit = _this select 0; _delay = if (count _this > 1) then {_this select 1} else {30}; _deserted = if (count _this > 2) then {_this select 2} else {120}; _respawns = if (count _this > 3) then {_this select 3} else {0}; _explode = if (count _this > 4) then {_this select 4} else {false}; _dynamic = if (count _this > 5) then {_this select 5} else {false}; _unitinit = if (count _this > 6) then {_this select 6} else {}; _haveinit = if (count _this > 6) then {true} else {false}; _hasname = false; _unitname = vehicleVarName _unit; if (isNil _unitname) then {_hasname = false;} else {_hasname = true;}; _noend = true; _run = true; _rounds = 0; if (_delay < 0) then {_delay = 0}; if (_deserted < 0) then {_deserted = 0}; if (_respawns <= 0) then {_respawns= 0; _noend = true;}; if (_respawns > 0) then {_noend = false}; _dir = getDir _unit; _position = getPosASL _unit; _type = typeOf _unit; _dead = false; _nodelay = false; // Start monitoring the vehicle while {_run} do { sleep (5 + (random 20)); if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true}; // Check if the vehicle is deserted. if (_deserted > 0) then { _nearPlayers = false; { if ((_x distance _unit) < PARAMS_VehicleRespawnDistance) exitWith { _nearPlayers = true; }; } forEach playableUnits; if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8) and !_nearPlayers) then { _timeout = time + _deserted; sleep 0.1; waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0}; if ({alive _x} count crew _unit > 0) then {_dead = false}; if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; if !(alive _unit) then {_dead = true; _nodelay = false}; }; }; // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; deleteVehicle _unit; sleep 2; _unit = _type createVehicle _position; _unit setPosASL _position; _unit setDir _dir; _unit disableTIEquipment true; clearWeaponCargoGlobal _unit; clearMagazineCargoGlobal _unit; _dead = false; // Check respawn amount if !(_noend) then {_rounds = _rounds + 1}; if ((_rounds == _respawns) and !(_noend)) then {_run = false;}; }; }; Looking further into this script perhaps I could place the .sqf after this // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; Perhaps using a loop to define the side of veh then side script?? just a guess below. // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; deleteVehicle _unit; sleep 2; _unit = _type createVehicle _position; _unit setPosASL _position; _unit setDir _dir; _unit disableTIEquipment true; //clearWeaponCargoGlobal _unit; //clearMagazineCargoGlobal _unit; if (_unit Equalto east) then { nul = this execVM "CSAT_Ammo.sqf"; }; else { nul = this execVM "AAF_Ammo.sqf"; }; _dead = false; // Check respawn amount if !(_noend) then {_rounds = _rounds + 1}; if ((_rounds == _respawns) and !(_noend)) then {_run = false;}; }; }; Edited March 22, 2015 by JAndrews1 Share this post Link to post Share on other sites
fight9 14 Posted March 22, 2015 (edited) nul = _unit execVM "AAF_Ammo.sqf"; Same with other one. Also, you have an extra ";" before your "else". Edited March 22, 2015 by Fight9 Share this post Link to post Share on other sites
jandrews 116 Posted March 22, 2015 Am having a hard time trying to get it to follow "east" or veh name, it goes straight to AAF.ammo.sqf, is there something better? tried both. if (_unit isEqualto east) then // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; deleteVehicle _unit; sleep 2; _unit = _type createVehicle _position; _unit setPosASL _position; _unit setDir _dir; _unit disableTIEquipment true; if (_unit isEqualto "O_Truck_03_ammo_F") then { nul = _unit execVM "CSAT_Ammo.sqf"; } else { nul = _unit execVM "AAF_Ammo.sqf"; }; _dead = false; // Check respawn amount if !(_noend) then {_rounds = _rounds + 1}; if ((_rounds == _respawns) and !(_noend)) then {_run = false;}; }; }; Share this post Link to post Share on other sites
fight9 14 Posted March 22, 2015 Oh missed that part side _unit == east // or typeOf _unit == "classname" Share this post Link to post Share on other sites