spinter Posted July 4, 2013 Share Posted July 4, 2013 function Object.destroy(Object self) how can I use the Object.destroy can you help? I have to destroy a tank with the script! sorry for my eng ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net Link to comment Share on other sites More sharing options...
Grimes Posted July 4, 2013 Share Posted July 4, 2013 Weapons, Units, Static Objects, Scenery Objects, and even airbases all inherit the functions of the "object" class. Therefore the following will work just fine. Unit.getByName('whatever'):destroy() 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 Link to comment Share on other sites More sharing options...
spinter Posted July 4, 2013 Author Share Posted July 4, 2013 (edited) thank you!!! Edited July 4, 2013 by spinter ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net Link to comment Share on other sites More sharing options...
spinter Posted July 4, 2013 Author Share Posted July 4, 2013 units ok Static Objects ok I have problems to destroy Scenery Objects! can you help me? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net Link to comment Share on other sites More sharing options...
spinter Posted July 6, 2013 Author Share Posted July 6, 2013 I can not remove a Scenery Objects with the same method as a static object! please help me ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net Link to comment Share on other sites More sharing options...
Grimes Posted July 6, 2013 Share Posted July 6, 2013 You have to use world.searchObjects() to define a search zone and to search for world objects. world.searchObjects() calls another function for each object it finds, from there you can do whatever you want with each object. This will destroy all objects with the name "house1' within a defined search volume. do local ifFound = function(foundItem, val) -- generic search for all scenery if foundItem:getTypeName() == 'house1' then foundItem:destroy() end end world.searchObjects(Object.Category.SCENERY, volume, ifFound) end 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 Link to comment Share on other sites More sharing options...
spinter Posted July 7, 2013 Author Share Posted July 7, 2013 You have to use world.searchObjects() to define a search zone and to search for world objects. world.searchObjects() calls another function for each object it finds, from there you can do whatever you want with each object. This will destroy all objects with the name "house1' within a defined search volume. do local ifFound = function(foundItem, val) -- generic search for all scenery if foundItem:getTypeName() == 'house1' then foundItem:destroy() end end world.searchObjects(Object.Category.SCENERY, volume, ifFound) end I'm sorry but I do not understand how to pass volume Volume is not specified good or I do not understand, as this variable step? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net Link to comment Share on other sites More sharing options...
Grimes Posted July 7, 2013 Share Posted July 7, 2013 Sorry, I didn't include that bit as I simply paraphrased how the script works. Volume is just a variable you must define earlier. Check the wiki for the types of volumes you can do, but here his how you can create a spherical volume based on a trigger zone. local sphere = trigger.misc.getZone('zone') local newPoint = {x = sphere.point.x, y = land.getHeight({x = sphere.point.x, y = sphere.point.z}), z = sphere.point.z} local volS = { id = world.VolumeType.SPHERE, params = { point = newPoint, radius = sphere.radius } } When you call the search you would use: world.searchObjects(Object.Category.SCENERY, volS, ifFound) 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 Link to comment Share on other sites More sharing options...
Snacko Posted February 8, 2019 Share Posted February 8, 2019 I know this is an old thread, but I was also trying to make a Static Object disappear, and this didn't work. Weapons, Units, Static Objects, Scenery Objects, and even airbases all inherit the functions of the "object" class. Therefore the following will work just fine. Unit.getByName('whatever'):destroy() So, I wanted to post how I did get it to work... StaticObject.getByName('Static F16 #001'):destroy(); Intel I9-10850K (OC @ 5.0ghz) │ Asus Maximus XII Hero │ G.Skill Ripjaws 64GB (4x16GB) DDR4 3200 │ Thermaltake Water 360mm Gigabyte RTX 4090 Gaming OC 24gb │ 2TB M.2 EVO Pro; 1T M.2 EVO; Sandisk SSD Drives │ 49" Samsung Curved Widescreen │ 28" Touchscreen - ҉ - Blackshark Cockpit Trainer - ҉ - ♣ Thread | ♥ Download Link to comment Share on other sites More sharing options...
Recommended Posts