-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with generating Aircraft based weapon lists #12
Comments
You can write a hooks script like this repository uses to export but tailored to export only what you need, here is an example script I've used previously to export the IR and RCS values for all the aircraft. local dumpFolder = "DCS.Lua.Exporter\\" --Relative to lfs.writedir, aka "Saved Games\DCS\"
local function ExportAircraftProperties()
local absoluteDirectory = lfs.writedir()..dumpFolder..""
-- Creates the dumpFolder if it doesn't exist
if not lfs.attributes(absoluteDirectory) then
lfs.mkdir(absoluteDirectory)
end
local filepath = absoluteDirectory.."/Aircraft-RCS-IR-Properties.csv"
local file, error = io.open (filepath, "w")
if error then
log.write("DCS.Lua.Exporter", log.ERROR, "Error writing to disk "..error)
else
for _, unit in ipairs(db.Units.Planes.Plane) do
local rcs = unit["RCS"]
local ir = unit["IR_emission_coeff"]
local ir_ab = unit["IR_emission_coeff_ab"]
-- If aircraft has no afterburner clear ir_ab
if ir == ir_ab or ir_ab == 0 then
ir_ab=''
end
file:write('Airplane,'..unit["DisplayName"] ..','.. rcs ..','.. ir ..','.. ir_ab ..'\n')
end
for _, unit in pairs(db.Units.Helicopters.Helicopter) do
local rcs = unit["RCS"]
local ir = unit["IR_emission_coeff"]
file:write('Helicopter,'..unit["DisplayName"] ..','.. rcs ..','.. ir ..'\n')
end
end
file:close()
end
local status, error = pcall(ExportAircraftProperties)
if error then
log.write("DCS.Lua.Exporter", log.ERROR, "Error in ExportAircraftProperties: "..error)
end Save it as The script already loops through all the planes and helicopters you should just need to modify it to loop through each aircrafts Then you should be able to use that CLSID to lookup the actual launcher definition like so (In the datamine on github the last element of the attributes/wstype is redacted but when you grab via your it you'll get the actual numbers) such as ["wsType"] =
{
[1] = 1,
[2] = 3,
[3] = 43,
[4] = 616,
}, -- end of ["wsType"] |
@Quaggles , this is great info for a project of mine as well. Could you let me know where you found documentation regarding the I didn't see mentions of it anywhere in the |
Very little in DCS is documented unfortunately, I basically just loaded up a connection to the GUI environment (hooks folder) and then used https://github.com/kikito/inspect.lua to browse around what looked interesting. You can use https://dcsfiddle.pages.dev/, certain parts of the environment aren't available from the Saved Games hooks folder instead install -- Put inspect.lua in 'DCS World/Scripts' for this to work
local inspect = require 'inspect'
-- Use this to export the lua tables in a human readable format
return inspect(_G.weapons_table.weapons)
-- Use this to prevent inspect from getting child tables recursively in case you are previewing a high level table
-- return inspect(_G.weapons_table.weapons, {depth = 1}) DCS Fiddle has an "Explorer" function for browsing the environment but for some tables it throws an error when you try to open them, inspect.lua seems to handle pretty much everything (And it's what the dataminer uses to get the human readable files) |
Thanks @Quaggles ! This is already super helpful, and it definitely allowed me to do what I needed: Compile the list of all Planes in DCS, their weapons and their technical specs (Type, Range, etc), and export it out as a JSON. Thanks a lot! |
I am wondering if there is a programmatic way to generate a list of weapon types for each playable Aircraft?
This is primarily so I can add specific aircraft to a FARP object and make sure that only the specific weapons for that aircraft are present.
The text was updated successfully, but these errors were encountered: