wolle Posted August 22, 2013 Posted August 22, 2013 I have been looking for an hour now: what is the scripting command that returns the type of a unit. E.g. if unit MyUnit is a Huey it should return something like "UH-1H". There seems to be a command called Unit.getTypeName but this returns an object type called TypeName rather than a string, and the object type TypeName is described anywhere I can find. Thanks [sIGPIC][/sIGPIC] Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro
Grimes Posted August 22, 2013 Posted August 22, 2013 Works for me using this: Unit.getByName('myUnit'):getTypeName() 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
SNAFU Posted December 18, 2015 Posted December 18, 2015 Is there somewhere a complete list of all unittype names of the scripting environment? Or is there a list of weapon names of the scripting environment? I am asking, because I want to make a kind of point list for every type of unit and weapon, so I can use it in a campaign to evaluate the whole cost/effect ratio. [sIGPIC][/sIGPIC] Unsere Facebook-Seite
ajax Posted December 18, 2015 Posted December 18, 2015 You can get an older list at post #7 in this thread: http://forums.eagle.ru/showthread.php?t=126293
SNAFU Posted December 18, 2015 Posted December 18, 2015 Thank you. :) [sIGPIC][/sIGPIC] Unsere Facebook-Seite
Stonehouse Posted December 19, 2015 Posted December 19, 2015 (edited) @Snafu - Believe you can get a copy of _G for DCS to show you the sort of things you get for a Unit by (been a while since I've done it so going very much by dodgey memory). mist.debug.dump_G (string fileName) Easiest way is probably put a DO SCRIPT on a mission start trigger action after Mist has loaded and run the command. eg do mist.debug.dump_G (_G.lua) end You will need to comment out these two lines below temporarily while you do it so you can write to a file sanitizeModule('io') sanitizeModule('lfs') Find them in file \whatever dcs root folder is\Scripts\MissionScripting.lua. eg for path g:\games\DCS World OpenBeta\Scripts Be sure to put them back afterwards as they are to protect you from hostile lua scripts. The file created will turn up in C:\Users\whatever your username is\Saved Games\DCS\Logs\ Info retrieved looks like; . . ["Unit"]["parentClass_"]["getName"] = "function: 00000000A547BEB0, C function", ["Unit"]["parentClass_"]["__tonumber"] = "function: 00000000A5484BA0, defined in (48-50)", ["Unit"]["parentClass_"]["__lt"] = "function: 00000000A5484B50, defined in (40-46)", ["Unit"]["parentClass_"]["__eq"] = "function: 00000000A5484AB0, defined in (24-30)", ["Unit"]["parentClass_"]["getPoint"] = "function: 00000000A547BF00, C function", ["Unit"]["parentClass_"]["__newindex"] = "function: 00000000A5484C90, defined in (63-65)", ["Unit"]["parentClass_"]["getPosition"] = "function: 00000000A547BFA0, C function", ["Unit"]["parentClass_"]["getVelocity"] = "function: 00000000A547C040, C function", ["Unit"]["parentClass_"]["inAir"] = "function: 00000000A547C0E0, C function", ["Unit"]["parentClass_"]["getTypeName"] = "function: 00000000A547BE10, C function", . . Look in the debug section of Mist doco for more info. Takes a while to run so don't panic and think it has hung. As Ajax says in his referenced thread you can use some of the other debug things to get things like unit type name lists. The above tells you the sort of info you can retrieve for a Unit (plus Groups and all the rest) Edited December 19, 2015 by Stonehouse
SNAFU Posted December 19, 2015 Posted December 19, 2015 Thanks Stonehouse, That is similar to the idea I had. I wanted to place all units in a mission and use script to write all "unittypes" into another file. But if that has already been done. I will see how far I get. :) [sIGPIC][/sIGPIC] Unsere Facebook-Seite
Recommended Posts