chromium Posted January 28, 2015 Posted January 28, 2015 Hello, Is it possibile to build up a table of building Id's within a zone without having them to be blown up in an explosion ( that way there already is a valuable mist DB )? I have nearly 200 zones placed over buildings which I would like to retrieve id's... to track them as objectives. I tried to look at _G dump to see if some functions are there, or into some lua files to understand if there is an enormmous table somewhere... but i didn't find anything interesting. Thank you in advance... 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.
Grimes Posted January 28, 2015 Posted January 28, 2015 You can use world.searchObjects() Its input parameters allow you to search for world objects and get assorted data on them. If you have a specific building type or location you can filter out targets quite easily. :) 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
chromium Posted January 28, 2015 Author Posted January 28, 2015 Thanks! I simply need to build a table of not dead buildings within "zonerange" of any of my zones. :). I'll give a try :) 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.
vicx Posted January 28, 2015 Posted January 28, 2015 You can. And you can even export them to Tacview.
chromium Posted January 28, 2015 Author Posted January 28, 2015 How the hell did you made that, vicx? :p 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.
chromium Posted January 28, 2015 Author Posted January 28, 2015 Tried this but doesn't work :( local AddObjectsTable = function(zoneName,TargetArea,TargetType,TargetName) local volS = { id = world.VolumeType.SPHERE, params = { point = {x = TargetX, y = land.getHeight({x = TargetX, y = TargetY}), z = TargetY}, radius = TargetArea } } local function handler(object) [color="Red"]local ObjId = Object.getId(object)[/color] local ObjType = object:getTypeName() local Status = "alive" BuildingList = BuildingList .. tss .. ObjId .. TargetType .. tss .. TargetName .. tss .. ObjType .. tss .. Status .. "\n" end world.searchObjects(Object.Category.SCENERY, volS, handler ); end (after this chunk of code the buildinglist string is writed down to a file... but the file is void). I suppose the issue is the red part. But I strongly need the map object ID... How can I get that? 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.
FSFIan Posted January 28, 2015 Posted January 28, 2015 Use object:getName() instead, it returns an integer in this case. getId() does not work on map objects for some reason. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
Grimes Posted January 29, 2015 Posted January 29, 2015 local ObjId = object.id_ 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
vicx Posted January 29, 2015 Posted January 29, 2015 (edited) Chrom, that picture is only days old. This picture and others like it I have been posting to a Tacview thread. It is fitting that Ian AND Grimes answered your question promptly. I run DCS Witchcraft at all times AND I use MIST so they both help me all the time. Note. I used object.id_ notation as per Grimes post. As for how I export 3D objects, I'll neaten up the LUA and post it later. Bascially I use userhitbox information IF it is available or export a 1x1x1 cube. I have not compiled a list of which objects have and do not have available a userhitbox but this gives me an idea for a visualisation which will show this pretty quickly. I think visually so I see Tacview as having a lot of potential as a tool for mission scripting. I am in PM's with Vyrt about generalising some features in future versions of Tacview to allow for more customised visualizations. If any you have ideas for features that can help DCS mission makers or modders then perhaps we could start a thread 'Tacview for scripting' and work on this. Edited January 29, 2015 by vicx addition
chromium Posted January 29, 2015 Author Posted January 29, 2015 Ian;2305141']Use object:getName() instead, it returns an integer in this case. getId() does not work on map objects for some reason. Can't, cause I need the Id To destroy that object in a different part of the script which already work as intended. I may go that way only if strictly necessary. Thanks Grimes, I'll give a try. Thanks Vicx also, I was interested only for debriefing purposes as today, cause it's (it was) impossible to visually check hits on a map building before using tacview :). 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.
vicx Posted January 29, 2015 Posted January 29, 2015 Chrom, OK I see. :thumbup: Right now if you want I can share some LUA which is only a partial solution. Up till now my only goal was to explore the idea of what new visualizations could be made from data exported from the "mission scripting' environment in addition to the "export" environment. I just had an idea and wanted to test it. It turns out that both environments have interesting data of their own so that the key to creating new visualizations in Tacview relies on interleaving data as it is recorded from each source or to post-process two separate logs and match up object ID's and timestamps. This matching up looks like it can be done without too much trouble. Truly. For my own explorations I have been happy to manually interleave limited amounts of data instead of writing my own parsing tool but I have thought recently of making a parser so that I can do much more ambitious demos. Once you connect the data from a 'mission' LUA environment to a polished viz tool like Tacview many interesting things are possible. (I do know that Ian has ideas above and beyond visualization for using 'mission data' in external apps and we get closer with the help of his tools) I have mentioned in the Tacview thread and to Frantz in a PM that for a really cool Tacview debrief we really need objects that can be customised. I would like to define objects for explosions that allow me to display the size of blast-cloud that matches the explosivemass of a warhead and an object for a building that displays labels. If objects are custom then extensions can be custom. A new building type could have a child object smoke cloud that emits based on the damage status of it's parent. You see the idea. Anyway Frantz is working right now on a Tacview 2.0 BIG update and he is inviting suggestions. Imagine it, draw a picture in paint dot net and post it to the Tacview 2.0 thread. Also I think that object:getName() and object.id_ may both have a use. Ian or Grimes may know of the cases.
FSFIan Posted January 29, 2015 Posted January 29, 2015 Have you tried if that integer happens to be the correct ID? DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
vicx Posted January 29, 2015 Posted January 29, 2015 Ian I just tested this quickly so it will need to be confirmed by someone else. --- For objects returned via World.searchObjects() In the case of search by type Object.Category.SCENERY object:getTypeName() is valid object:getName() is valid object.id_ is valid object:getName() == object.id_ true object:getID() is invalid sample - getTypeName=UKRYTIE, getName=280148, _id=280148 --- In the case of search by type Object.Category.STATIC object:getTypeName() is valid object:getName() is valid object.id_ is valid object:getName() == object.id_ false object:getID() is valid object:getID() == object.id_ false getTypeName=Barracks 2, getName=barstat, id_=8000987, getID=85 There may be unusual statics and scenery that have missing fields but I haven't noted them yet.
chromium Posted January 29, 2015 Author Posted January 29, 2015 (edited) Sadly it's not the object ID, it seems to be the ID that identify the type of objective. i.e. 3816;Military;Tinihidi armybase;MOST(ROAD)BIG-KA;alive 3817;Military;Tinihidi armybase;MOST(ROAD)SMALL-A;alive 3818;Military;Tinihidi armybase;MOST-FERMA-A;alive 3819;Military;Tinihidi armybase;MOST-FERMA-KA;alive 3816;Military;Algyt armybase;MOST(ROAD)BIG-KA;alive 3817;Military;Algyt armybase;MOST(ROAD)SMALL-A;alive 3818;Military;Algyt armybase;MOST-FERMA-A;alive 3819;Military;Algyt armybase;MOST-FERMA-KA;alive 3816;Military;Kurchanskaya armybase;MOST(ROAD)BIG-KA;alive 3817;Military;Kurchanskaya armybase;MOST(ROAD)SMALL-A;alive 3818;Military;Kurchanskaya armybase;MOST-FERMA-A;alive 3819;Military;Kurchanskaya armybase;MOST-FERMA-KA;alive 3816;Military;Troickaya ammo depot;MOST(ROAD)BIG-KA;alive 3817;Military;Troickaya ammo depot;MOST(ROAD)SMALL-A;alive 3818;Military;Troickaya ammo depot;MOST-FERMA-A;alive 3819;Military;Troickaya ammo depot;MOST-FERMA-KA;alive 3816;Military;Troickaya armybase;MOST(ROAD)BIG-KA;alive 3817;Military;Troickaya armybase;MOST(ROAD)SMALL-A;alive 3818;Military;Troickaya armybase;MOST-FERMA-A;alive 3819;Military;Troickaya armybase;MOST-FERMA-KA;alive 3816;Military;Troitskoye ammo depot;MOST(ROAD)BIG-KA;alive 3817;Military;Troitskoye ammo depot;MOST(ROAD)SMALL-A;alive 3818;Military;Troitskoye ammo depot;MOST-FERMA-A;alive 3819;Military;Troitskoye ammo depot;MOST-FERMA-KA;alive object:getID() is effectively invalid. I'm looking for a different way to interface mist dead objects db. with the table builded on those data. Edited January 29, 2015 by chromium 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.
vicx Posted January 30, 2015 Posted January 30, 2015 There will be more than one way to do what you want to do. What is you want to do?
chromium Posted January 30, 2015 Author Posted January 30, 2015 Ok let's explain a bit Objective: archieve tactical objectives status (alive, dead) and building destroy status persistence from one mission to the next one, becoming able to carry scenery situation in a sequential mission campaign whitout mission editor input from one mission to another. Instrument 1: archieve map object destroyed building persistence from mission to mission. Status: Done, in a weird way but it works. I use mist dead objects DB to build a csv files, which is then readed when the next mission is started and it make an explosion at the position of each object. (when object: Destroy() will be fixed I'll find a different solution, like removing the building and replacing it with a destroyed building 3D object if possibile) Instrument 2 Filling a void mission template with zones, which are named with a particoular pattern and sized in the way any of them have wanted target map building inside the range, create a csv files that contain a list of objectives & their position. Then, using this thread functions, build a csv file that contains any of the building included in any target map range. This way I have: 1. a written table (csv) of target objectives 2. a written table (csv) of building that is included in each objective 3 a written table (csv) of destroyed building from first mission till current one 3. an already reliable function that will check when a building is destroyed and when all building of a target is destroyed. The problem was: As Mist DB provide as unique value the ID of the destroyed object, it's the best solution to use that value to understand which building behave of which target, and track their status with mist DB. I said was cause: 1. maybe using getName I found the ID value. 2. I can try to use position instead of id or name, cause each building surely have unique VEC coordinates :) I'll let you know asap (this night I believe) 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.
vicx Posted February 2, 2015 Posted February 2, 2015 (edited) Chrom hope the new idea has panned out. You might have to use ugly hacks but what you want to do IS possible. The players won't care how you did it. Anyway that code I shared with you for exporting scenery and static objects to Tacview will need some review. I found that the orientation of scenery was not what I was expecting. I had errors until I (rotated the object by 90 degrees and then applied NorthCorrection ). Happy to have gone from crooked bridges to straight bridges. This is going to be a big deal. Tacview supports 3D objects in *.obj format. So we could start replacing some of the HITBOXES for strategic scenery and statics with meshes that look more like the real deal. Tacview playbacks are going to be really powerful once we get this ball rolling. *Note Working on moving trains - where there is a will there is a way. Edited February 5, 2015 by vicx clarity
chromium Posted February 2, 2015 Author Posted February 2, 2015 Sadly I don't have the time I would like to have to investigate in details your code, as I already have to prioritize squadron needs in the coming weeks. But you should know that, IMHO, being able to see al the maps object in Tacview would be an extremely important upgrade. 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.
chromium Posted February 4, 2015 Author Posted February 4, 2015 (edited) there was an error in my script that I'm already tracking, so it's possibile that the getName and id_ (they print the same result) gave duplicates cause effectively the object were duplicates. I'll update this asap. Solved: it works like a charm either using id_ or getName :) Edited February 4, 2015 by chromium 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.
Recommended Posts