gospadin Posted January 16, 2016 Share Posted January 16, 2016 So to go along with my USN Mi-8 skins, I am trying to create a new lightweight torpedo model, skin it, and use it in designed missions. I am fine with just treating it as a bomb (Mk-82) for now. So far, I've made the following changes: 1) Bazar/BombTable.sht: New entry name = "mk-54" with matching file name, index=94, otherwise same values as the mk-82 entry 2) Bazar/Config/Weapons/bombs_data.lua: added a new entry with name = Mk_54, using the Mk_82 warhead. type=0. 3) Bazar/Config/Weapons/bombs_table.lua: added a new declare_bomb("Mk_54",...) call of wsType_Bomb_a, "bomb-common", etc. matching the Mk-82 definition 4) Scripts/Database/db_weapons_data.lua: added a new entry for the Mk-54 torpedo, attribute 4,5,9,94 (94 was the index in BombTable.sht above) The problem I am having seems to be the declare_bomb() call. My call has 7 arguments, matching the Mk-82. However, declare_bomb() calls form_bomb() which uses the name in the first argument ("Mk_54" in my case) to set wstype_name = _G[name], which then builds it into a ws_type tuple { wsType_Bomb, level3, wstype_name } on line 16 of bombs_table.lua. Every time I try to actually load a mission with my new weapon attached to a plane, I get a crash because ws_type.3 is not a number... the _G[] apparently didn't resolve. If I explicitly pass in this argument as a number, it still crashes with the same error. So... does anyone know how this is supposed to be resolved or what I am missing? Is there a better (easier?) way to add a new weapon to the game? I've been trying to search the forums with no luck, most threads that might even be slightly relevant are multiple years old and/or talk about retired .lua structures. thanks! --gos Oh, and since people like pictures: My liveries, mods, and missions for DCS:World M-2000C English Cockpit | Extra Beacons Mod | Nav Kneeboard | Community A-4E Link to comment Share on other sites More sharing options...
gospadin Posted January 16, 2016 Author Share Posted January 16, 2016 BTW, the exact function that seems to be the problem is this: declare_bomb("Mk_54", _("Mk-54 Lightweight Torpedo"), "mk-54", wsType_Bomb_A, "bomb-common", { fm = { mass = 232.000000, caliber = 0.273000, cx_coeff = {1.000000, 0.290000, 0.710000, 0.140000, 1.280000}, L = 2.210000, I = 94.425933, Ma = 2.746331, Mw = 2.146083, wind_time = 1000.000000, wind_sigma = 80.000000, }, warhead = warheads["Mk_82"], }, { char_time = 20.320000 }, nil, 0 ); Which results in this error: 00035.781 ERROR DCS: Cannot load information: bombs.13.name is not a number But if I just remove arguments 8/9, to match the Mk-82 declaration, I get this error: 00036.095 ERROR wInfo: While loading weapons.bombs.Mk_54: weapons_table.weapons.bombs.Mk_54.ws_type.3 is not a number Any ideas? My liveries, mods, and missions for DCS:World M-2000C English Cockpit | Extra Beacons Mod | Nav Kneeboard | Community A-4E Link to comment Share on other sites More sharing options...
Recommended Posts