Veteran66 Posted November 12, 2020 Share Posted November 12, 2020 (edited) Hi all how i can remove all "Greenhouse" by name or Type is there a script? i will remove all Greenhouses in a Trigger area not other Buildings, is this possible? Edited December 5, 2020 by Veteran66 German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
wraith70 Posted November 13, 2020 Share Posted November 13, 2020 I'm guessing you want to remove an object (ie Greenhouse). Have you tried the action 'Scenery Remove Objects Zone' in ME? Here is a quick video on how it works: I would create a small trigger zone for each building you want to remove. Link to comment Share on other sites More sharing options...
Veteran66 Posted November 13, 2020 Author Share Posted November 13, 2020 hi wraith70 thx for your reply, i know this option i look for a more convortable method to remove the "Greenhouse" Map Objects. a script remove all "Greenhouse" Map Objects in Area (Trigger) will be great. German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Grimes Posted November 14, 2020 Share Posted November 14, 2020 world.searchObjects Search for scenery, use getTypeName() on the object, if its the right string, then use destroy() on the object. Easy way to do it is to make a reference table and list all the object types you want to remove. You might need to first output a list of the object names or make mark panels over an object just so you can get an idea what is what. if searchInclude[obj:getTypeName()] then obj:destroy() end Note. It might not be synced correctly in MP. 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...
Veteran66 Posted November 14, 2020 Author Share Posted November 14, 2020 Hi Grimes, thx for your help but i am not a scripter i not find the DCS name from the Greenhouse German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Veteran66 Posted December 2, 2020 Author Share Posted December 2, 2020 i try this one: StaticObject.getByType('GREENHOUSE2'):destroy() and this: StaticObject.getByName('101089738'):destroy() not work GREENHOUSE2 is the Type i will remove from Map German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Grimes Posted December 2, 2020 Share Posted December 2, 2020 Use :destroy() within the search function. if obj:getTypeName() == 'GREENHOUSE2' then obj:destroy() 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...
Veteran66 Posted December 3, 2020 Author Share Posted December 3, 2020 (edited) 18 hours ago, Grimes said: Use :destroy() within the search function. if obj:getTypeName() == 'GREENHOUSE2' then obj:destroy() end thx Grimes but your scrip will not work local foundUnits = {} local sphere = trigger.misc.getZone('greenhouse') local volS = { id = world.VolumeType.SPHERE, params = { point = sphere.point, radius = sphere.radius } } if obj:getTypeName() == 'GREENHOUSE2' then obj:destroy() end Edited December 3, 2020 by Veteran66 German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Chump Posted December 3, 2020 Share Posted December 3, 2020 Try something like this: local destroyObject = function(obj, val) if obj:getTypeName() == "GREENHOUSE2" then obj:destroy() end return true end local zone = trigger.misc.getZone("greenhouse") local volume = { id = world.VolumeType.SPHERE, params = { point = zone.point, radius = zone.radius } } world.searchObjects(Object.Category.STATIC, volume, destroyObject) Link to comment Share on other sites More sharing options...
Veteran66 Posted December 3, 2020 Author Share Posted December 3, 2020 13 minutes ago, Chump said: Try something like this: local destroyObject = function(obj, val) if obj:getTypeName() == "GREENHOUSE2" then obj:destroy() end return true end local zone = trigger.misc.getZone("greenhouse") local volume = { id = world.VolumeType.SPHERE, params = { point = zone.point, radius = zone.radius } } world.searchObjects(Object.Category.STATIC, volume, destroyObject) don`t work, the Greenhouses in the Trigger greenhouse still there, don`t know what is wrong GREENHOUSE2 maybe? when i find a working script i can remove all unnecessary objects. This will more comfortable like many Triggers and object remove actions. German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Chump Posted December 3, 2020 Share Posted December 3, 2020 Try it with some debug logic to see what's going on: local destroyObject = function(obj, val) local name = obj:getName() local typeName = obj:getTypeName() env.info(string.format("** Object: %s (%s)", name, typeName)) if typeName == "GREENHOUSE2" then obj:destroy() end return true end local zone = trigger.misc.getZone("greenhouse") if not zone then env.info("** Zone not found!") end local volume = { id = world.VolumeType.SPHERE, params = { point = zone.point, radius = zone.radius } } local num = world.searchObjects(Object.Category.STATIC, volume, destroyObject) env.info(string.format("** Found %i objects", num)) 1 Link to comment Share on other sites More sharing options...
Grimes Posted December 3, 2020 Share Posted December 3, 2020 (edited) This is the script used in the attached mission. local foundUnits = {} local deleteThis = {['GREENHOUSE1'] = true, ['GREENHOUSE2'] = true,} local sphere = trigger.misc.getZone('zone') local volS = { id = world.VolumeType.SPHERE, params = { point = sphere.point, radius = sphere.radius } } local ifFound = function(foundItem, val) local tName = foundItem:getTypeName() if deleteThis[tName] then if not foundUnits[tName] then foundUnits[tName] = 0 end foundUnits[tName] = foundUnits[tName] + 1 foundItem:destroy() end end world.searchObjects(Object.Category.SCENERY, volS, ifFound) local msg = {'Removed: \n'} for tName, val in pairs(foundUnits) do env.info(tName .. ' : ' .. val) msg[#msg+1] = tName .. ' : ' .. val .. '\n' end trigger.action.outText(table.concat(msg), 20) remove_hippy_farmers.miz Edited December 3, 2020 by Grimes 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 Link to comment Share on other sites More sharing options...
Veteran66 Posted December 4, 2020 Author Share Posted December 4, 2020 wauu yes it work fine, i just test Grimes Mission work very well. Thx Chump and Grimes. This script is a powerful tool. Now you can desable not needed Objects like Greenhouse, Road Path limitation and Electricity pylons in the Mission environment, so you get (i hope so) better fps. Or you can switch off the Runway lighting (sorry for my bad english) German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
EasyEB Posted December 4, 2020 Share Posted December 4, 2020 Can this script be used to remove the trees in the plantations that ground vehicles have such trouble driving through in the Syria map? Link to comment Share on other sites More sharing options...
Grimes Posted December 4, 2020 Share Posted December 4, 2020 Trees are not accessible to the scripting engine unfortunately. Its one of those highly desirable features requests. 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...
EasyEB Posted December 4, 2020 Share Posted December 4, 2020 12 hours ago, Grimes said: Trees are not accessible to the scripting engine unfortunately. Its one of those highly desirable features requests. That’s a damn shame. Link to comment Share on other sites More sharing options...
Veteran66 Posted December 5, 2020 Author Share Posted December 5, 2020 i make a Test Mission with a MapObject_Detection_in_Zone.lua and MapObject_remove.lua script the MapObject_Detection_in_Zone.lua script show the Map Object Type Name in the "zone" Trigger so you have the Object Name The MapObject_remove.lua script remove the Object you wride in the script and it is in the "zone" Trigger Thx for all who help MapObject_remove_by_TypeName.miz MapObject_Detection_in_Zone.lua MapObject_remove.lua German WW2 Radio calls Mod: https://www.digitalcombatsimulator.com/en/files/2161798/ Link to comment Share on other sites More sharing options...
Recommended Posts