Narsiph 3 Posted October 30, 2018 Hello, i am starting with scripting and have some ideas and a point where i want to start. The basics to multiplayer scripting are known to me and i made a couple scripts already for the purpose what i wanted to have (a personal arsenal for people). We are a merc-based group and we really liked antistasi but it has too many flaws for us so i decided to finally start our merc-based campaign. Now i started with my roadmap for the arsenal: 01: Check the amount of loot/equipment in a specific box (!) 02: Add the specific items in the box to an ace-arsenal (!) 03: Check if the amount of items in the ace-arsenal exceeds 20 (!) 04: Make items, that exceed the amount 20, unlimited. (!) 05: Save all the data so it can be restored after a server-restart/restart (!?) (!) = Figured it out (?) = Still trying to figure it out (!?) = I know where to look for this. I discussed it already with a friend of mine and we decided to go with the 'while' to keep on checking a specific inventor, a box, called "merc_arsenal_box", either with a onaction activation on the arsenal-box, or with a sleep timer of roughly 15 minutes or so. Thats practically not really hard either way. But the real problem i face now is, that i am able to put stuff int he ace arsenal without problems - unlimited already. Thats one of the basic functions i can go. Put things in the ace arsenal already unlimited available. And i dont have a clue how i can achive the same, but with a limited availability like 19 items of weapon x. Do i oversee something, a function as example? Or does the ace arsenal not have any method of having a limited amount of items in it? Please dont post any working code, just directions where i should look and specific snippets (Example: Look on ace arsenal framework, the function fnc_thisisit_lookhere [1,2,3,4];) Thank you all in advance for your help & time Narsiph. Share this post Link to post Share on other sites
Narsiph 3 Posted October 30, 2018 Heya, strangely, in the weapon_cache_temp it returns always an empty array, but the weapon was cleary added into it. Here is the code: // First, check the inventory of the "merc_arsenal_box". If it has 20 of an Item, it should be deleted and added to the // general ace arsenal. unlimited = 2; // secure temporary weapons in the box "weapon_cache_temp" // If the array is needed _itemarray = getItemCargo merc_arsenal_box; // _itemarray = getWeaponCargo merc_arsenal_box; // multi array (haupt + sub) // array 0 (waffe0,waffe1) array 1 (feld 0: 12, feld 1: 3) // anzahlitems = count array 0 // a loop repeating 10 times // for [{_i=0}, {_i<anzahlitems}, {_i=_i+1}] do _weaponnames = count (_itemarray select 0); clearWeaponCargo weapon_cache_temp; for [{_loop=0}, {_loop<_weaponnames}, {_loop=_loop+1}] do { _weaponamount = (_itemarray select 1) select _loop; _weaponname = (_itemarray select 0) select _loop; if (_weaponamount > unlimited) then { [merc_arsenal_box, [_weaponname]] call ace_arsenal_fnc_addVirtualItems; } else { weapon_cache_temp addWeaponCargo [_weaponname,_weaponamount]; }; }; sleep 1; clearWeaponCargo merc_arsenal_box; sleep 1; _itemarray = getItemCargo weapon_cache_temp; hint str _itemarray; sleep 3; _weaponnames = count (_itemarray select 0); for [{_loop=0}, {_loop<_weaponnames}, {_loop=_loop+1}] do { _weaponamount = (_itemarray select 1) select _loop; hint str _weaponamount; sleep 3; _weaponname = (_itemarray select 0) select _loop; hint _weaponname; sleep 3; merc_arsenal_box addWeaponCargo [_weaponname,_weaponamount]; }; If anyone has any idea why it is happening that i get an empty array from my weapon_cache_temp, would be nice to know (the box has a weapon in it. It uses the same code as the main box to transfer its item). Share this post Link to post Share on other sites
Narsiph 3 Posted October 30, 2018 Solved. I had 'getITEMcargo' instead of getWeaponCargo :) Share this post Link to post Share on other sites