Wychmaster Posted June 24, 2021 Posted June 24, 2021 I wonder if there is any way to check if a specific point is blocked by a building or has trees close by. Any ideas?
Grimes Posted June 24, 2021 Posted June 24, 2021 Buildings yes, trees no*. You have to use world.searchObjects to find the buildings. Unfortunately there isn't really any data on the area of the building aside for the "box" entry returned via getDesc(). It'll only tell you the total space it takes up and you'd have to do the math to offset the points to figure out a no place zone relative to a specific object. Alternatively you can manually catalog useful info about a given object. For instance I've done that on a few objects on Syria so I can dynamically place vehicles in the defensive burms scattered throughout the map. *Every object on the map has a unqiue id even if it can't directly be queried via world.searchObjects, thus if you have the id specific trees can technically be accessed. Only reason I figured this out was in testing the annoying aspect of the object Ids for everything change when a map was updated. Anyhow I had some Ids stored from an early Syria release and the objects representing a given id changed from a couple of bunkers next to each other to trees halfway across the map. 1 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
Wychmaster Posted June 24, 2021 Author Posted June 24, 2021 Wow, thanks for the rapid answer. This helps a lot. I am currently programming a python based mission generator and need the data to find reasonable routes (automatically). Since I just gather all useful data and process it "offline", changing IDs do not matter much. Only if something gets added or removed, I need to update my dataset. Guess I will just run over all IDs and write the relevant data to my hard drive.
Coupon4Coffin Posted October 18, 2022 Posted October 18, 2022 On 6/24/2021 at 12:06 PM, Grimes said: Buildings yes, trees no*. You have to use world.searchObjects to find the buildings. Unfortunately there isn't really any data on the area of the building aside for the "box" entry returned via getDesc(). It'll only tell you the total space it takes up and you'd have to do the math to offset the points to figure out a no place zone relative to a specific object. Alternatively you can manually catalog useful info about a given object. For instance I've done that on a few objects on Syria so I can dynamically place vehicles in the defensive burms scattered throughout the map. Could you please confirm that hitbox entries can be found for scenery objects as well? Whenever I query a scenery object on Syria map, this is all I get: { ["life"] = 0, ["attributes"] = table: 00000296DC374920 { ["attributes"]["Buildings"] = true, }, ["_origin"] = "", ["category"] = 4, ["typeName"] = "179602178", ["displayName"] = "", } This is what I get by calling {SceneryObject.getDescByName(foundItem:getName())}
Grimes Posted October 18, 2022 Posted October 18, 2022 I think some have it, but it might be limited to the ones that are also static objects that can be placed. So only objects from the Caucuses map. Also box doesn't represent a hitbox at all. Its just two points representing opposite corners of the area the object takes up. 1 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
Recommended Posts