chromium Posted June 20, 2014 Share Posted June 20, 2014 Hi, I know that using MIST I can know when a certain map object is dead. But if I want to set dead some object at mission start, is there a function that could allow that to me? PS given that I know the object ID. Thanks 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. Link to comment Share on other sites More sharing options...
dooom Posted June 20, 2014 Share Posted June 20, 2014 just place an explosion on it for mission start.... easiest way. ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 "This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL Link to comment Share on other sites More sharing options...
chromium Posted June 20, 2014 Author Share Posted June 20, 2014 No sorry, i mean by script, whitout desteoying it at missione stare T.. Cause if i will have hundreds of objects... :( 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. Link to comment Share on other sites More sharing options...
ENO Posted June 20, 2014 Share Posted June 20, 2014 Probably a little easier if you explained the desired end result- I'm not sure you can show existing Mao objects as destroyed without actually destroying them with an explosion or just using "dead" statics in close proximity. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
chromium Posted June 20, 2014 Author Share Posted June 20, 2014 Yes you're right: To obtain some sort of "persistence" of map objects destroyed in a sequential mission campaign, I'm going to use MIST to retrieve a table of destroyed map object for every mission. Then I print out a csv file with objects' IDs. At the start of the next mission, this file is read and parsed into a table of destroyed objects' IDs, which I would like to use to set those objects "dead". As dooom suggested, My first thought was to set up an explosion trigger for every map objects position, but this way I'm going to have three potential issues: - Object producing smoke every time (even it has been destroyed some mission ago) - Some performance concern regarding multiple explosions and smoke drawing at mission start. - Possibity of unwanted collateral damage to sorrounding map object due to explosion power). Given those limitation, which could leave me with the idea of a potential "no go" issues, I'm trying to avoid the explosion by setting the objects dead at mission start. Thanks in advance for your suggestions :) PS: I obviously have sanitize module disabled for this purposes. 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. Link to comment Share on other sites More sharing options...
Grimes Posted June 20, 2014 Share Posted June 20, 2014 For sure it is something that has been request as a feature, for precisely the reason you want to do it. But I am not sure there is a practical way to do it quite yet. The only plausible method, which is completely untested on my part, is to remove the world object and spawn in a static object replacing it in a "dead" state. There are a few problems with this, for instance not every world object has a static object equivalent. Also I'm not 100% sure the objectIDs are constant from mission to mission or if they are changed if the map changes. 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...
chromium Posted June 20, 2014 Author Share Posted June 20, 2014 So, for the moment, there isn't a way to set a map object dead by script during a mission. Understood :). 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. Link to comment Share on other sites More sharing options...
xcom Posted June 20, 2014 Share Posted June 20, 2014 If you have the information of the dead unit and are able to spawn it, you could possible do this by getting the location of the destroyed units. For example - 1. Get position of destroyed units by event handler. 2. Write a table to a file of the unit category + position. 3. Create a script that would respawn a dead unit object (Same category if possible) and position it on the same position in the file. [sIGPIC][/sIGPIC] BuddySpike Website | Live Map & Statistics BuddySpike Twitch Channel Buddyspike Discord Buddyspike Facebook Link to comment Share on other sites More sharing options...
chromium Posted June 20, 2014 Author Share Posted June 20, 2014 Yes, but it's not about units but scenery map objects. Do you think it's possible anyway? Destroyed obj position (and heading, if i'm right) can be retrieved by MIST DB. By Grimes way, insted (after I figured out how I could remove a map object in mission environment), I may replace a obj map... but I have to decide what "destroyed building" model using: if I destroy a bridge or a Factory it would be needed to be replaced with something correct. 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. Link to comment Share on other sites More sharing options...
ENO Posted June 20, 2014 Share Posted June 20, 2014 I totally understand what you're trying to do also and agree it would really heighten immersion. Hope we get that ability in the future. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
chromium Posted October 20, 2014 Author Share Posted October 20, 2014 Well, finally I found a way to destroy any map objects that was destroyed last mission at mission start, using those two functions: (the first is scheduled every "n" minutes, the second is launched some seconds after mission start) -- this function store in a file the destroyed map objects table DGWS.deadMapObjCollect = function() local deadOBJ = "" -- add to the previous data stored in "deadOBJ" string the new data for deadId,deadData in pairs(mist.DBs.deadObjects) do if deadData.objectType == "building" then -- filter map Objects local Id = deadId local Pos = deadData.objectPos deadOBJ = deadOBJ .. Id .. tss .. Pos.x .. tss .. Pos.y .. tss .. Pos.z .. tss .. OPdate .. "\n" end end -- now overwrite the old file (erase previous data) local o = io.open(lfs.writedir() .. tabledirectory .. "deadobjects" .. exportfiletype, "w") o:write(deadOBJ) o:close() end -- this function will destroy objects indicated in the DGWS.deadMapObjDestroy = function() local destroyMethod = 1 -- 0 means by destroy, 1 by explosion local u = io.open(lfs.writedir() .. tabledirectory .. "deadobjects" .. exportfiletype, "r") for line in io.lines(u) do local rdeadID, rdeadPosX, rdeadPosY, rdeadPosZ, rdeadDate = line:match("(%d-)"..tss.."(.-)"..tss.."(.-)"..tss.."(.-)"..tss.."(.-)$") if (rdeadID) then DeadMapObjects[#DeadMapObjects + 1] = { deadID = rdeadID, deadPosX = rdeadPosX, deadPosY = rdeadPosY, deadPosZ = rdeadPosZ, deadDate = rdeadDate} end end u:close() for id, DeadData in pairs(DeadMapObjects) do local deadX = tonumber(DeadData.deadPosX) local deadY = tonumber(DeadData.deadPosY) local deadZ = tonumber(DeadData.deadPosZ) local ExpPos = { x = deadX, y = deadY, z = deadZ } [color="Red"]if destroyMethod == 0 then if id then SceneryObject.GetById(DeadData.deadID):destroy() end[/color] [color="SeaGreen"] elseif destroyMethod == 1 then if id then trigger.action.explosion(ExpPos, 3000) end[/color] end end end But I'm forced to use the green method (that will create an explosion to re-destroy the object), cause I'm clearly doing something wrong with the other method, which should make disappear the building (that may is my preffered solution actually...). Can you give some advice? thanks :) PS: if you want to try this scripts, you may need to modify some lines cause they are part of a bigger table of functions (DGWS), and it will be necessary to set the sanitize module off. 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. Link to comment Share on other sites More sharing options...
chromium Posted October 20, 2014 Author Share Posted October 20, 2014 Ok given that this could seems crazy but... do you think it's possibile to disable smoke and fire effects in the first 30 minutes since mission start? (This is a pure crazy brainstorming idea... :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. Link to comment Share on other sites More sharing options...
FSFIan Posted October 21, 2014 Share Posted October 21, 2014 I don't know for sure, but the IDs of map objects may be non-deterministic, i.e. the ID of a building might change between mission restarts. If that is the case, the solution would be to enumerate all buildings within, say, five meters of the building position, find the one that matches the position exactly, and destroy() that. I have working code for enumerating buildings lying around somewhere, I'll post it later when I have some time to dig it up (have to go to a lecture in a few minutes). DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
chromium Posted October 21, 2014 Author Share Posted October 21, 2014 That could be a good solution ... 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. Link to comment Share on other sites More sharing options...
FSFIan Posted October 21, 2014 Share Posted October 21, 2014 The following function (untested) should destroy scenery objects around a point (x, y, z) within the given radius. function destroySceneryObjects(x, y, z, radius) local volume = { id = world.VolumeType.SPHERE, params = { point = {x = x, y = y, z = z}, radius = radius } } local function handler(object, data) object:destroy() end world.searchObjects({Object.Category.SCENERY}, volume, handler, nil) end Try using something like destroySceneryObjects(deadX, deadY, deadZ, 0.2) to destroy the map object. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
piXel496 Posted October 21, 2014 Share Posted October 21, 2014 I have not tested it and I am here just for "scriptReadingAmusement" but I like your compact simple solution. Good thinking, [FSF]Ian :thumbup: old stuff I made Link to comment Share on other sites More sharing options...
chromium Posted October 21, 2014 Author Share Posted October 21, 2014 Ian, I'll test it this evening or Tomorrow evening. Thanks so much :) 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. Link to comment Share on other sites More sharing options...
shagrat Posted October 21, 2014 Share Posted October 21, 2014 All(!) Map objects are available as a model and can be inserted! They hide in the depth of the bazar directory... if you can "deactivate" a map object aka make-it-disappear you could replace it with a destroyed building model of the same type. If you just need to track strategic targets, e.g. a chemical plant that was destroyed, you could place it on the map. After destruction place a model of the same plant (destroyed). I'll look for that script I ripped from mudspikes mission "General helicopter operations 1.1" Shagrat - Flying Sims since 1984 - Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore) Link to comment Share on other sites More sharing options...
shagrat Posted October 21, 2014 Share Posted October 21, 2014 (edited) Here we go: the original mission that uses this as part of its Initialization Script is HERE The script as I use it places a "Mosque" with stone Tower and a stone building at the position of Trigger Zone "towerMosque"... It can be easily adapted, or just use the "coalition.addStaticObject" command with the correct objects. So where are these nice Map objects? Have a look here: "C:\Program Files\Eagle Dynamics\DCS World\Bazar\Terrain\Structures\" ...and to better find what you're looking for, have a look at the "Preview" folder! :thumbup: EDIT If you need destroyed buildings look for the "_crash" or "_crush" .EDM files... -- initialize everything function initialize() customItems() end -- initial script startup delay timer.scheduleFunction(initialize, nil, timer.getTime() + 1) --custom static items function customItems() local _trgZone1 = trigger.misc.getZone("towerMosque") local staticBuilding1 = { ["shape_name"] = "bashnja-stena", -- "StoneTower" ["type"] = "bashnja-stena", ["unitId"] = math.random(999, 99999), ["rate"] = 100, ["y"] = _trgZone1.point.z - 10, ["x"] = _trgZone1.point.x + 13, ["name"] = "stonetoweritem", ["category"] = "Fortifications", ["canCargo"] = false, ["heading"] = 0.25, } coalition.addStaticObject(country.id.RUSSIA, staticBuilding1) local _trgZone2 = trigger.misc.getZone("towerMosque") local staticBuilding2 = { ["shape_name"] = "mechet", -- "Mosque" ["type"] = "mechet", ["unitId"] = math.random(999, 99999), ["rate"] = 100, ["y"] = _trgZone2.point.z, ["x"] = _trgZone2.point.x, ["name"] = "mosquebldg", ["category"] = "Fortifications", ["canCargo"] = false, ["heading"] = 0.20, } coalition.addStaticObject(country.id.RUSSIA, staticBuilding2) local _trgZone3 = trigger.misc.getZone("towerMosque") local staticBuilding3 = { ["shape_name"] = "s3", -- "Barrack", ["type"] = "s3", ["unitId"] = math.random(999, 99999), ["rate"] = 100, ["y"] = _trgZone3.point.z - 15, ["x"] = _trgZone3.point.x, ["name"] = "barrackMosqueitem", ["category"] = "Fortifications", ["canCargo"] = false, ["heading"] = 1.80, } coalition.addStaticObject(country.id.RUSSIA, staticBuilding3) --local _trgZone4 = trigger.misc.getZone("rock") --local staticBuilding4 = { --["shape_name"] = "gold_gate", --["type"] = "gold_gate", --["unitId"] = <YOUR ID HERE>, --["rate"] = 100, --["y"] = _trgZone4.point.z, --["x"] = _trgZone4.point.x, --["name"] = "rockItem", --["category"] = "Fortifications", --["canCargo"] = false, --["heading"] = 6.74, --} --coalition.addStaticObject(country.id.RUSSIA, staticBuilding4) end --trigger.action.outTextForCoalition(coalition.side.BLUE, string.format("###debug### "), 3) Edited October 21, 2014 by shagrat Shagrat - Flying Sims since 1984 - Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore) Link to comment Share on other sites More sharing options...
chromium Posted October 21, 2014 Author Share Posted October 21, 2014 Ian;2209792']The following function (untested) should destroy scenery objects around a point (x, y, z) within the given radius. function destroySceneryObjects(x, y, z, radius) local volume = { id = world.VolumeType.SPHERE, params = { point = {x = x, y = y, z = z}, radius = radius } } local function handler(object, data) object:destroy() end world.searchObjects({Object.Category.SCENERY}, volume, handler, nil) end Try using something like destroySceneryObjects(deadX, deadY, deadZ, 0.2) to destroy the map object. Doesn't work, while if I sobstitute the destroy command with a message, it works. There is something not working properly about the destroy() actions... :( 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. Link to comment Share on other sites More sharing options...
Grimes Posted October 21, 2014 Share Posted October 21, 2014 Object.destroy() is currently bugged for world objects, sadly its been like that for a few patches I think. 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...
chromium Posted October 21, 2014 Author Share Posted October 21, 2014 (edited) Object.destroy() is currently bugged for world objects, sadly its been like that for a few patches I think. Sad news.... Since I can get the "life" level using SceneryObject.getLife(object), is it possibile to set the life of the object <1.0 to get it dead? (or it will explode?) Edited October 21, 2014 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. Link to comment Share on other sites More sharing options...
Grimes Posted October 21, 2014 Share Posted October 21, 2014 There is not any way to set the life of anything. You have to damage it with an explosion. 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...
chromium Posted October 22, 2014 Author Share Posted October 22, 2014 Well, since destroy() bug isn't solved I guess I don't have any other solution... 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. Link to comment Share on other sites More sharing options...
chromium Posted October 22, 2014 Author Share Posted October 22, 2014 Are you all interested in a standalone version of the script? It will work only with explosion and with sanitization module disable. PS I'm sure that everyone that helped me in this thread are more than able to do that... I'm asking for Others :) 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. Link to comment Share on other sites More sharing options...
Recommended Posts