ED Team BIGNEWY Posted August 16, 2023 ED Team Posted August 16, 2023 Warehouse control functions in DCS Update 2.8.8.43489 on 16th August 2023. We are pleased to include warehouse inventory script functions. Thank you to @Grimes for initial testing and feedback, and overall creative multiplayer and mission content creators community for driving us forward. Airbase get Warehouse example airbase:getWarehouse() local w = airbase:getWarehouse() w:addItem("A-10C",3) -- add 3 w:removeItem("A-10C",1) --remove 1 w:setItem("A-10C",10) --force to have 10 local count = w:getItemCount("A-10C") w:addLiquid(0,300) -- add 300 kg of jet fuel w:removeLiquid(0,100) -- remove 100 kg of jet fuel local amount = w:getLiquidAmount(0) -- current amount w:setLiquidAmount(0,500) local owner = w:getOwner() -- get owner object -- weapon can be managed or using string resource name , or indexed type table w:addItem("weapons.missiles.AIM_120C",3) --or w:addItem({4, 4, 7, 106},3) Warehouse get Inventory example warehouse:getInventory() Usage example: local airbase = Airbase.getByName('Wadi al Jandali') local warehouse = airbase:getWarehouse() local inventory = warehouse:getInventory() local function dump(o) if type(o) == 'table' then local s = ' {\n' for k,v in pairs(o) do if type(k) ~= 'number' then k = '"'..k..'"' end s = s .. '['..k..'] = ' .. dump(v) .. ',\n' end return s .. '} \n' else return tostring(o) end end env.info(dump(inventory)) inventory = { liquids = {}, – map of [enum_of_liquid] = numeric_current_amout in kg, weapon = {}, – map of ["string key"] = numeric_current_amout, aircraft = {}, – map of ["string key"] = numeric_current_amout, } out sample : 10:15:16:245 2023-08-07 07:15:15.225 INFO SCRIPTING (Main): { 10:15:16:245 ["liquids"] = { 10:15:16:245 [1] = 100000, 10:15:16:245 [2] = 100000, 10:15:16:245 [3] = 100000, 10:15:16:245 [0] = 100000, 10:15:16:245 } 10:15:16:245 , 10:15:16:245 ["weapon"] = { 10:15:16:245 ["weapons.nurs.SNEB_TYPE253_F1B"] = 100, 10:15:16:245 ["weapons.bombs.BDU_45LGB"] = 100, 10:15:16:245 ["weapons.missiles.AGM_65H"] = 100, 10:15:16:245 ["weapons.missiles.P_24T"] = 100, 10:15:16:245 ["weapons.missiles.AGM_154"] = 100, 10:15:16:245 ["weapons.bombs.British_GP_500LB_Bomb_Mk5"] = 100, 10:15:16:245 ["weapons.nurs.SNEB_TYPE252_F1B"] = 100, Warehouse get ResourceMap example Warehouse.getResourceMap() getResourceMap - return string to wstype mapping for weapon and objects in DCS ! note ! - wstype can be NULL for some objects (like shells or some categories of static objects ) local resource_map = Warehouse.getResourceMap() – ["string_key"] = {lev1,lve2,lev3,lev4} for k,o in pairs(resource_map) do env.info(string.format('[\"%s\"]\t\t\t= {%d,%d,%d,%d} ,',k,o[1],o[2],o[3],o[4])) end 27 10 Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, PIMAX Crystal
Dzsekeb Posted August 16, 2023 Posted August 16, 2023 Is it possible to stop AI from decreasing warehouse supply when they spawn ? I'd like only players to affect it for gameplay reasons. 2
eaglefirefly Posted August 16, 2023 Posted August 16, 2023 This is amazing! Thank you team! I was just finishing up some code that could hook into something like this so now lets see if it works! 2
Enigma89 Posted August 16, 2023 Posted August 16, 2023 (edited) Celebrate Core Changes Nice to see this in the patch notes Edited August 16, 2023 by Enigma89 14
funkyfranky Posted August 16, 2023 Posted August 16, 2023 Big thanks to ED! 6 A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
Blackfyre Posted August 16, 2023 Posted August 16, 2023 It is the greatest addition since clouds. Probably even greater one! 2 You don't know what you don't know. Ты не знаешь то, чего не знаешь. Скрытый текст Hardware: AMD 5900x, 64Gb RAM@3200MHz, NVidia RTX3070 8Gb, Monitor 3440x1440(21:9), Samsung 980pro 1Tb NVMe SSD, VKB Gunfighter+MCGU, Virpil Throttle CM3, VKB T-Rudder, TrackIR.
Wing Posted August 16, 2023 Posted August 16, 2023 Great to see new ME core changes... thankyou. Keep it up! 4 www.v303rdFighterGroup.com | v303 FG Discord
tae. Posted August 16, 2023 Posted August 16, 2023 Thank you so much for adding this much requested feature, this is a huge game changer. I can't wait to see what the community does with this new functionality. 2
Pikey Posted August 16, 2023 Posted August 16, 2023 Thanks ED, definitely a big directional change to support the foundations of the core things people love to use out there. ALready written a persistent warehouse system from this: https://github.com/thebgpikester/SWS SImple Warehouse Saving. 8 2 ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Wrench Posted August 16, 2023 Posted August 16, 2023 Heck yeah! That's a feature we've been missing, happy to see ED add it! My thanks to the ED team for working on it. 3 Carrier Script.
OzDeaDMeaT Posted August 16, 2023 Posted August 16, 2023 Can we refer to FARPs with these commands as well? 2 1 CPU: i9-12900K @ 4.9Ghz M/B: MSI MEG z690 Ace RAM: 128GB Video Card: MSI RTX 4090 Suprim Liquid X VR: Varjo Aero
Dzsekeb Posted August 16, 2023 Posted August 16, 2023 12 minutes ago, OzDeaDMeaT said: Can we refer to FARPs with these commands as well? Yes, just use the unit name of the FARP object as the airbase name. 4 1
Why485 Posted August 16, 2023 Posted August 16, 2023 This is a pretty big deal for mission makers and a welcome direction for ED to move in. 3
OzDeaDMeaT Posted August 16, 2023 Posted August 16, 2023 Its a MASSIVE addition to the game. Complete game changer to the logistics of DCS. 3 CPU: i9-12900K @ 4.9Ghz M/B: MSI MEG z690 Ace RAM: 128GB Video Card: MSI RTX 4090 Suprim Liquid X VR: Varjo Aero
Dzsekeb Posted August 16, 2023 Posted August 16, 2023 Can we have a checkbox for groups that prevents them from affecting warehouse stocks when they spawn despawn? This way AI can be set to ignore warehouses, but players can have limited weapons. Also an issue with Unit.getAmmo(). The typeName returned in that function for the unit weapons in the unit loadout does not match the ones the unit uses when it spawns from the warehouse in all cases. AIM-9M is one example of this. 1
Pikey Posted August 16, 2023 Posted August 16, 2023 44 minutes ago, Dzsekeb said: Can we have a checkbox for groups that prevents them from affecting warehouse stocks when they spawn despawn? This way AI can be set to ignore warehouses, but players can have limited weapons. Also an issue with Unit.getAmmo(). The typeName returned in that function for the unit weapons in the unit loadout does not match the ones the unit uses when it spawns from the warehouse in all cases. AIM-9M is one example of this. Technically you can add the weapons and fuel at spawn time to keep AI going when there is nothing left in the WH, but really the better option is to granularly handle the players pylon by pylon which has been requested a long time back. I'm hopeful that if we all say thanks, then we might get such a gift again and some sort of pylon checking will eventually come. 2 1 ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Schmidtfire Posted August 16, 2023 Posted August 16, 2023 Can we get this to work with ME triggers without using scripts? Long term it would be nice with a supply UI (like the rearming menu) to deliver or pick up inventory when playing a mission. 1
Maverick87Shaka Posted August 16, 2023 Posted August 16, 2023 This is an amazing step forward thought a core ME feature, I want really say Thanks to ED! It will be amazing have this feature in place when will be time to play with C-130 and CH-47 FlySafe! 3 FlighRIG => CPU: RyZen 5900x | RAM: 64GB Corsair 3000Mhz | GPU: nVIDIA RTX 4090 FE | OS Storage: SSD NVMe Samsung 850 Pro 512GB, DCS Storage: SSD NVMe Sabrent 1TB | Device: Multipurpose-UFC, VirPil T-50, TM WARTHOG Throttle, TrackHat, MFD Cougar with screen. Our Servers => [ITA] Banshee | Krasnodar - PvE | PersianConquest PvE Live Map&Stats | Syria Liberation PvE Conquest Support us on twitch subscribing with amazon prime account linked, it's free!
Dzsekeb Posted August 16, 2023 Posted August 16, 2023 5 minutes ago, Pikey said: Technically you can add the weapons and fuel at spawn time to keep AI going when there is nothing left in the WH, but really the better option is to granularly handle the players pylon by pylon which has been requested a long time back. I'm hopeful that if we all say thanks, then we might get such a gift again and some sort of pylon checking will eventually come. You could do that if Unit:getAmmo() returned the exact weapon names that the warehouse api uses, and if it returned pods and fuel tanks and such. As it stand its not really viable unless you want to hand currate all weapon types, track all AI spawns and despawns to correct the stocks and you dont care about tracking pods and fuel tanks at all.
Pikey Posted August 16, 2023 Posted August 16, 2023 6 minutes ago, Schmidtfire said: Can we get this to work with ME triggers without using scripts? Long term it would be nice with a supply UI (like the rearming menu) to deliver or pick up inventory when playing a mission. These, like many API commands aren't mirrored in the Trigger actions. Trigger actions pertain to DCS Worlds standard mission-as-a-session format. With extended missions it reaches beyond your typical one session scenario and I would say this is aimed at long running or multiplayer missions to make the best use of it. For the Airbase API commands that werent mentioned in the change logs, you can use the TRIGGER DO SCRIPT and write the command directly, thereby using the same mechanism of having no script file (albeit, its the same thing) You can also copy scripts into these triggers to make them a trigger, so its a bit of a blurred line. 7 minutes ago, Dzsekeb said: You could do that if Unit:getAmmo() returned the exact weapon names that the warehouse api uses, and if it returned pods and fuel tanks and such. As it stand its not really viable unless you want to hand currate all weapon types, track all AI spawns and despawns to correct the stocks and you dont care about tracking pods and fuel tanks at all. Unit:getAmmo() returns wsTypes() afaik? If so then then the wsTypes is an enumeration that misbehaves and changes so its not good for use. However, may I introduce you to getResourceMap() released today which translates wsType to friendly name and makes your life much easier? If you use getInventory() on the warehouse you will get friendly names like SWS.SimpleWarehouse["Kobuleti"]["weapon"]["weapons.bombs.AB_250_2_SD_10A"] = 100 the wsTypes is a 4 letter code where the last two aren't always the same. That API feature can fix this issue you speak of. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Grimes Posted August 16, 2023 Posted August 16, 2023 Wiki articles for functions added with this patch: https://wiki.hoggitworld.com/view/Category:Game_Patch_2.8.8 7 2 The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Dzsekeb Posted August 16, 2023 Posted August 16, 2023 27 minutes ago, Pikey said: These, like many API commands aren't mirrored in the Trigger actions. Trigger actions pertain to DCS Worlds standard mission-as-a-session format. With extended missions it reaches beyond your typical one session scenario and I would say this is aimed at long running or multiplayer missions to make the best use of it. For the Airbase API commands that werent mentioned in the change logs, you can use the TRIGGER DO SCRIPT and write the command directly, thereby using the same mechanism of having no script file (albeit, its the same thing) You can also copy scripts into these triggers to make them a trigger, so its a bit of a blurred line. Unit:getAmmo() returns wsTypes() afaik? If so then then the wsTypes is an enumeration that misbehaves and changes so its not good for use. However, may I introduce you to getResourceMap() released today which translates wsType to friendly name and makes your life much easier? If you use getInventory() on the warehouse you will get friendly names like SWS.SimpleWarehouse["Kobuleti"]["weapon"]["weapons.bombs.AB_250_2_SD_10A"] = 100 the wsTypes is a 4 letter code where the last two aren't always the same. That API feature can fix this issue you speak of. It returns a list of weapon descriptions, out of which the best identifier you have is a typeName, which does not match the getInventory returned types in all cases. AFAIK wsType is not included in this
Pikey Posted August 16, 2023 Posted August 16, 2023 6 minutes ago, Dzsekeb said: It returns a list of weapon descriptions, out of which the best identifier you have is a typeName, which does not match the getInventory returned types in all cases. AFAIK wsType is not included in this the string is weapons.missiles.AIM_9 for the 9M. It's an anomaly for sure. Once you have a look at the print out from the warehouse it should be easy to use. hth. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
eaglefirefly Posted August 16, 2023 Posted August 16, 2023 (edited) If it helps anyone this is the table in the liquids part of the warehouse and what they are if anyone wants to add it to some docs (if not already) -- [1] = 4999000 -- AV GAS -- [2] = 4998000 -- WATER METH -- [3] = 4997000 -- DIESEL FUEL -- [0] = 5000000 --JET FUEL Edited August 16, 2023 by eaglefirefly 1
Recommended Posts