Coolinator 10 Posted November 18, 2014 is there a script or code that make boxes reload stocks? i just really dont like the idea that there only 1 available each type of scopes in ammo box :( theyy ran out quickly. How do i make the reload stocks by using script or code? For example, every 5 minutes ammo box will reload stocks? i Share this post Link to post Share on other sites
Lala14 135 Posted November 18, 2014 is there a script or code that make boxes reload stocks? i just really dont like the idea that there only 1 available each type of scopes in ammo box :( theyy ran out quickly. How do i make the reload stocks by using script or code? For example, every 5 minutes ammo box will reload stocks? i Are you talking about a vehicle like a tank or the hmg/gmgs? Share this post Link to post Share on other sites
dreadedentity 278 Posted November 18, 2014 //USAGE: _handle = [crateObject, timeInMinutes] execVM "scriptName.sqf"; //EXAMPLE: 0 = [this, 5] execVM "boxRefiller.sqf"; _crate = (_this select 0); _type = typeOf (_this select 0); _pos = getPosATL _crate; _dir = direction _crate; while {true} do { deleteVehicle (_this select 0); _obj = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; _obj setPosATL _pos; _obj setDir _dir; sleep ((_this select 1) * 60); }; Share this post Link to post Share on other sites
Coolinator 10 Posted November 18, 2014 Are you talking about a vehicle like a tank or the hmg/gmgs? im talking about the ammo boxes. not vehicles,units,statics, just talking about regular ammo boxes :) how to refill them:) ---------- Post added at 09:10 ---------- Previous post was at 09:09 ---------- //USAGE: _handle = [crateObject, timeInMinutes] execVM "scriptName.sqf"; //EXAMPLE: 0 = [this, 5] execVM "boxRefiller.sqf"; _crate = (_this select 0); _type = typeOf (_this select 0); _pos = getPosATL _crate; _dir = direction _crate; while {true} do { deleteVehicle (_this select 0); _obj = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; _obj setPosATL _pos; _obj setDir _dir; sleep ((_this select 1) * 60); }; THank you so much!!!! Share this post Link to post Share on other sites
Coolinator 10 Posted November 18, 2014 //USAGE: _handle = [crateObject, timeInMinutes] execVM "scriptName.sqf"; //EXAMPLE: 0 = [this, 5] execVM "boxRefiller.sqf"; _crate = (_this select 0); _type = typeOf (_this select 0); _pos = getPosATL _crate; _dir = direction _crate; while {true} do { deleteVehicle (_this select 0); _obj = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; _obj setPosATL _pos; _obj setDir _dir; sleep ((_this select 1) * 60); }; omg i jsut tested it, the ammo box shoots another ammo box then they both exploded and dissapeard???? T_T Share this post Link to post Share on other sites
iceman77 19 Posted November 19, 2014 (edited) There's a few reasons this could happen. 1) Locality issue. Are you on a dedicated server? Because createVehicle array is a global command. It will create one ammo box for the server and all clients. You need to only create vehicles on the server. 2) Collision issue.You are deleting the old crate and creating a new crate almost at the exact same time. Causing the explosion. You need to add a sleep 1; right after after you delete the crate. 3) Script issue Edited November 19, 2014 by Iceman77 Share this post Link to post Share on other sites
Jigsor 176 Posted November 19, 2014 (edited) If I am reading this correctly, Coolinator is asking for help refilling ammo box not replacing them. This will replenish the inventory of the box with what ever contents it has at script run time and continue to do so by looping every x minutes. Maybe a good idea to not allow boxes to take damage as well. I have not implemented any code for crates containing backpacks yet but give this a try. It is working well in my Insurgency mission. //SimpleCrateRefill.sqf by Jigsor //Refills ammo crates with contents inventoried at script run time. // run via script example: //_nul = [CrateObject,DelayMinutes] execVM "scripts\SimpleCrateRefill.sqf"; // run via init field of ammo box in editor example: //_nul = [this,10] execVM "scripts\SimpleCrateRefill.sqf"; if (!isServer) exitWith {}; waitUntil {time > 0}; sleep (random 10); private ["_crate","_delay","_all_mags","_all_weps","_all_items","_has_items"]; _crate = _this select 0; _delay = (_this select 1) * 60; _has_items = false; _all_mags = magazineCargo _crate; _all_weps = WeaponCargo _crate; _all_items = ItemCargo _crate; //_backpacks = getBackpackCargo _crate; if (count _all_items > 0) then {_has_items = true;}; while {true} do { clearMagazineCargoGlobal _crate; sleep 0.3; clearWeaponCargoGlobal _crate; sleep 0.3; if (_has_items) then {clearItemCargoGlobal _crate;}; sleep 0.3; {_crate addMagazineCargoGlobal [_x, 1];} foreach _all_mags; sleep 0.3; {_crate addWeaponCargoGlobal [_x, 1];} foreach _all_weps; sleep 0.3; if (_has_items) then {{_crate addItemCargoGlobal [_x, 1];} foreach _all_items;}; sleep _delay; }; Edited November 19, 2014 by Jigsor Share this post Link to post Share on other sites
Coolinator 10 Posted November 19, 2014 If I am reading this correctly, Coolinator is asking for help refilling ammo box not replacing them.This will replenish the inventory of the box with what ever contents it has at script run time and continue to do so by looping every x minutes. Maybe a good idea to not allow boxes to take damage as well. I have not implemented any code for crates containing backpacks yet but give this a try. It is working well in my Insurgency mission. //SimpleCrateRefill.sqf by Jigsor //Refills ammo crates with contents inventoried at script run time. // run via script example: //_nul = [CrateObject,DelayMinutes] execVM "scripts\SimpleCrateRefill.sqf"; // run via init field of ammo box in editor example: //_nul = [this,10] execVM "scripts\SimpleCrateRefill.sqf"; if (!isServer) exitWith {}; waitUntil {time > 0}; sleep (random 10); private ["_crate","_delay","_all_mags","_all_weps","_all_items","_has_items"]; _crate = _this select 0; _delay = (_this select 1) * 60; _has_items = false; _all_mags = magazineCargo _crate; _all_weps = WeaponCargo _crate; _all_items = ItemCargo _crate; //_backpacks = getBackpackCargo _crate; if (count _all_items > 0) then {_has_items = true;}; while {true} do { clearMagazineCargoGlobal _crate; sleep 0.3; clearWeaponCargoGlobal _crate; sleep 0.3; if (_has_items) then {clearItemCargoGlobal _crate;}; sleep 0.3; {_crate addMagazineCargoGlobal [_x, 1];} foreach _all_mags; sleep 0.3; {_crate addWeaponCargoGlobal [_x, 1];} foreach _all_weps; sleep 0.3; if (_has_items) then {{_crate addItemCargoGlobal [_x, 1];} foreach _all_items;}; sleep _delay; }; Yes ur right!! i justt want to refill the ammo box. Thanks!!! i will test it, then let you know how it goes :) btw how do i add silencers in ammo box? im making a night mission. Share this post Link to post Share on other sites
iceman77 19 Posted November 19, 2014 Maybe you can see how to fill the crate with silencers with any of the following scripts http://lmgtfy.com/?q=arma+3+crate+filler+script Share this post Link to post Share on other sites
Coolinator 10 Posted November 19, 2014 If I am reading this correctly, Coolinator is asking for help refilling ammo box not replacing them.This will replenish the inventory of the box with what ever contents it has at script run time and continue to do so by looping every x minutes. Maybe a good idea to not allow boxes to take damage as well. I have not implemented any code for crates containing backpacks yet but give this a try. It is working well in my Insurgency mission. //SimpleCrateRefill.sqf by Jigsor //Refills ammo crates with contents inventoried at script run time. // run via script example: //_nul = [CrateObject,DelayMinutes] execVM "scripts\SimpleCrateRefill.sqf"; // run via init field of ammo box in editor example: //_nul = [this,10] execVM "scripts\SimpleCrateRefill.sqf"; if (!isServer) exitWith {}; waitUntil {time > 0}; sleep (random 10); private ["_crate","_delay","_all_mags","_all_weps","_all_items","_has_items"]; _crate = _this select 0; _delay = (_this select 1) * 60; _has_items = false; _all_mags = magazineCargo _crate; _all_weps = WeaponCargo _crate; _all_items = ItemCargo _crate; //_backpacks = getBackpackCargo _crate; if (count _all_items > 0) then {_has_items = true;}; while {true} do { clearMagazineCargoGlobal _crate; sleep 0.3; clearWeaponCargoGlobal _crate; sleep 0.3; if (_has_items) then {clearItemCargoGlobal _crate;}; sleep 0.3; {_crate addMagazineCargoGlobal [_x, 1];} foreach _all_mags; sleep 0.3; {_crate addWeaponCargoGlobal [_x, 1];} foreach _all_weps; sleep 0.3; if (_has_items) then {{_crate addItemCargoGlobal [_x, 1];} foreach _all_items;}; sleep _delay; }; I just tested it and it works great!!! Thank you so much!!! :) ---------- Post added at 06:19 ---------- Previous post was at 05:32 ---------- Maybe you can see how to fill the crate with silencers with any of the following scriptshttp://lmgtfy.com/?q=arma+3+crate+filler+script Too advanced for me lol sorry. I just found out cargo net [nato] has some suppressors in it. Im just gonna use that. Thanks for your help anyways :) Share this post Link to post Share on other sites