HC_Official Posted April 27, 2019 Posted April 27, 2019 Say I wanted to spawn a vech at a random location , is it possible to check the coords I want to use to see if a building exists there ? Just want to make sure I do not spawn on top of a building No more pre-orders Click here for tutorials for using Virpil Hardware and Software Click here for Virpil Flight equipment dimensions and pictures. .
Backy 51 Posted April 27, 2019 Posted April 27, 2019 Short of confirming coordinates with SAT or ALT map views, I don't believe so. I don't need no stinkin' GPS! (except for PGMs :D) [sIGPIC][/sIGPIC]
HC_Official Posted April 27, 2019 Author Posted April 27, 2019 was hoping for a scripted solution ... still working on this and trying No more pre-orders Click here for tutorials for using Virpil Hardware and Software Click here for Virpil Flight equipment dimensions and pictures. .
Hardcard Posted April 27, 2019 Posted April 27, 2019 (edited) I guess you could create a zone around the building (MOOSE allows you to set inner and outer zone radius for several methods) and get a random coordinate from it, which you could use to spawn the unit/group. Here's a MOOSE script example: local Spawn_Zone = ZONE:New("Zone name in ME") local Random_Point = Spawn_Zone:GetRandomPointVec2(inner radius in meters, outer radius in meters) -- Set the desired inner and outer radius of the zone, from which to get the random spawn point local Group_Spawn = SPAWN:New("name of the late activated group in ME") Group_Spawn:SpawnFromPointVec2(Random_Point) If you want to do this for hundreds of buildings, though, I don't think this is a realistic solution :D Edited April 27, 2019 by Hardcard [sIGPIC][/sIGPIC]
Grimes Posted April 28, 2019 Posted April 28, 2019 You can use world.searchObjects() to return all objects near a given point. If no object is returned then the area is clear. There are a few issues potentially with doing that however. First among which is that the size and shape of the object isn't fully known. Some objects don't have a "box" defined of the overall area they take up, and that box value isn't useful for odd shaped objects. Additionally not all objects are returned, like trees, bushes, and assorted other objects. Last of all it is "expensive" to compute as searching a large area can have hundreds if not thousands of objects returned. 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
HC_Official Posted April 28, 2019 Author Posted April 28, 2019 I guess you could create a zone around the building (MOOSE allows you to set inner and outer zone radius for several methods) and get a random coordinate from it, which you could use to spawn the unit/group. Here's a MOOSE script example: local Spawn_Zone = ZONE:New("Zone name in ME") local Random_Point = Spawn_Zone:GetRandomPointVec2(inner radius in meters, outer radius in meters) -- Set the desired inner and outer radius of the zone, from which to get the random spawn point local Group_Spawn = SPAWN:New("name of the late activated group in ME") Group_Spawn:SpawnFromPointVec2(Random_Point) If you want to do this for hundreds of buildings, though, I don't think this is a realistic solution :D Thanks , this method would not work well You can use world.searchObjects() to return all objects near a given point. If no object is returned then the area is clear. There are a few issues potentially with doing that however. First among which is that the size and shape of the object isn't fully known. Some objects don't have a "box" defined of the overall area they take up, and that box value isn't useful for odd shaped objects. Additionally not all objects are returned, like trees, bushes, and assorted other objects. Last of all it is "expensive" to compute as searching a large area can have hundreds if not thousands of objects returned. Thanks for the tip Grimes managed to figure out a quick n dirty solution to this problem No more pre-orders Click here for tutorials for using Virpil Hardware and Software Click here for Virpil Flight equipment dimensions and pictures. .
Hardcard Posted April 29, 2019 Posted April 29, 2019 Thanks for the tip Grimes managed to figure out a quick n dirty solution to this problem Could you share it? [sIGPIC][/sIGPIC]
Backy 51 Posted April 29, 2019 Posted April 29, 2019 Could you share it? +1 I don't need no stinkin' GPS! (except for PGMs :D) [sIGPIC][/sIGPIC]
Recommended Posts