Gracey Posted December 31, 2024 Posted December 31, 2024 Hey, seems I am back with another round of issues I would like to report. I have worked on a script to change the warehouse item values so that we can save what was in the warehouse at the mission restart, etc. However, I have come across and issue where some of the items are not being given to the script when using Warehouse.getInventory( ) so we are being left with items in the warehouse, or not being able to change the values that the warehouse has of the items. I set the warehouse values to 100 using the Fill Col in the mission editor. Then I will make sure Dynamic spawns etc is available. Doubt this would matter, but I did it. In my case , I am using "DCS Lua Runner" in Visual Studio Code to run the script this way I can make faster iterations when the script fails. Also, keep in mind, this script will save a few files to your disk, and you will need to set the location you want them to be saved to inside the script. Otherwise, obviously this will fail. First the script will make a small text file so that it knows for later that every other run afterwards is no longer the "First Run" since we do not want to loose the initial set values we started with. Then after each server or mission restart, when run it will then clear the entire warehouse inventory and then set all the values to what is in the CSV file. In this image you can see that certain items are not set to 5000 like the CSV should be. And no, this is not because it is more than the max value, even if I set it to 5 it doesn't make a difference. Anyways, back to the issue... It seems that, when the script asks for the entire inventory of the airbase it is not getting everything that is in the airbase. Some items seem to be omitted, and as far as I can see it is new-er aircraft like the KIOWA, CH-47, and F-5? Of course this is completely breaking any possibility of having a dynamic, warehouse/supply based mission for the time being. I would attach the mission file, however you will need to have your DCS environment sanitized and make some light modifications to the script for it to function. So, instead I will attach a blank mission that's ready to go and you will have to modify and load the script on your own. I attached the CSV's for an example of what the script gets when it is first run. Both on an airfield with items set from the mission editor to 100, and one where it is set to 0 for everything. Hopefully something can be figured out with this, and maybe I am super confusing with what I wrote. I hope not null Warehouse Test Cauc.miz unit and warehouse saving.lua Senaki-Kolkhi_Blue.csv Kutaisi_Blue.csv Gracey's Village Always be yourself ~ Unless your can be a Unicorn, then be a Unicorn
chromium Posted December 31, 2024 Posted December 31, 2024 For DSMC, which does track along everything else also the warehouses, I did not saw that issue, but in the first iteration of the script (which works quite different cause I do all the update and comparison in plugin enviroment) I had some issues trying to associate items, that eventually lead to being unable to correctly update certain items (mostly 3rd party ones). I've been able to solve the association issue by using the wsType table instead of the unique name or worse the typeName. (PS: if you use typename, also be sure to escape LUA special characters, like "-", esle it won't find the value) Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Gracey Posted December 31, 2024 Author Posted December 31, 2024 Thank you for your reply, I am not sure how I can get the wsType rather than the typeName. When I am dumping the warehouse out into a txt file without any form of formatting I am unable to get all the items that are in the warehouse, and I am not getting any wsType. This makes it impossible to work with as even if I did have a wsType, they change often as far as I know. I have attached the simple script and output. Since the game is giving me the typeName, I would consider it a bug that it is unable to output everything that is in the warehouse to the log, or whatever you put that information in. I am unsure of what I am supposed to do, when the information the game gives isn't even usable. whdump.lua warehouse_output.lua Gracey's Village Always be yourself ~ Unless your can be a Unicorn, then be a Unicorn
Gracey Posted December 31, 2024 Author Posted December 31, 2024 Little update, So I now have all the wsTypes but I am not sure how this is supposed to help me. The warehouse is simply just not giving the amounts of some of these items at all, and that would be a bug no? There doesn't seem to be a work around, and even if there was its still broken as far as I can see. The fact is, if I can't save what is in the warehouse by asking the warehouse what it has, there is no point in having the wsType, or even the name for that matter because there is not way to know what the warehouse has because it won't give that information for those certain items. Gracey's Village Always be yourself ~ Unless your can be a Unicorn, then be a Unicorn
NeedzWD40 Posted December 31, 2024 Posted December 31, 2024 1 hour ago, Gracey said: I am not sure how I can get the wsType rather than the typeName. Not every item in the warehouse has a friendly name associated with it; generally speaking, most of your missiles, bombs, and rockets have a name that they can be grabbed by, but a number of equipment items and others have only a wsType table. This has been detailed in this thread. Unfortunately, wsType has a tendency to change with every update, so it can be a pain to stay current. My current go-to is to just put a unique amount number in a unique warehouse, then open the warehouses file and find that unique amount to get the wsType code. This is tedious and not ideal, but until every item gets a unique friendly name associated with it (or I complete a util to parse the warehouses file), it's the only way forward.
Gracey Posted December 31, 2024 Author Posted December 31, 2024 @NeedzWD40 Hmm, I think the initial post of the topic doesn't make sense maybe. All I am trying to do is get the count of the items in the warehouse. It doesn't matter if the item has as friendly name or not because the game should be giving me the item(wsType or typeName) and the amount stored in the warehouse. This is not the case. When I as the warehouse what it has with warehouse:getInventory() is is giving me SOME, not ALL of the inventory. It doesn't matter to me, or my script if it is a wsType or a typeName. For some reason the game is just simply omitting certain objects in the warehouse such as stuff for the F4E and Kiowa. I can however, get all of the wsTypes from the warehouse using Airbase.getResourceMap() which is all well and good, but completely pointless as there is no count. This makes that completely pointless to have. With warehouse:getInventory() there should not be any need for me to guess the quantity that the warehouse has. It should simple give all of the quantities that are in it. Gracey's Village Always be yourself ~ Unless your can be a Unicorn, then be a Unicorn
NeedzWD40 Posted December 31, 2024 Posted December 31, 2024 3 minutes ago, Gracey said: All I am trying to do is get the count of the items in the warehouse. It doesn't matter if the item has as friendly name or not because the game should be giving me the item(wsType or typeName) and the amount stored in the warehouse. This is not the case. That's the crux of the problem, and one that hopefully ED will address. The scripts will only return items with friendly names, so your gunpods, AO 2.5 bomblets for KMGU dispensers, and so on can never be grabbed and queried via scripting. We can add these items with some initial count, but we won't be able to find out exactly how many are present until ED modifies the scripting.
Recommended Posts