Jump to content

Blowing up buildings


Recommended Posts

Use the handy new right click tool to retrieve the object ID, then write a simple event handler to detect when it is destroyed.

StaticHandler = {}
function StaticHandler:onEvent(event)
if event.id == world.event.S_EVENT_DEAD and event.initiator:getName() == 72455195 then
trigger.action.setUserFlag('1', true) 
end
end
world.addEventHandler(StaticHandler)


Edited by feefifofum
Link to comment
Share on other sites

  • 1 month later...

I think the buildings need to be more interactive, perhaps even making more building objects so you can build a small village of friendly and hostile buildings youself so you can attack on and not damage others.

 

Also, buildings that cars can enter, so perhaps a UAV tracking a UAZ or Ural triggers to attack this building in so many minutes before the target leaves.

 

I suppose a mission scripter could have a checkpoint defended by Bluefor with attacking Redfor who they need defend or resupply with troops in helo mission...

 

I just think the aircraft are solid, the weapons are awesome but the ground interaction is somewhat missing for us CAS and Ground Pounders!

Link to comment
Share on other sites

  • 4 months later...
On 10/20/2020 at 4:09 AM, feefifofum said:

Paste that text into a DO SCRIPT container, and replace the object and flag IDs with the desired value.

 

You can also create a .lua file using Notepad++ with that text, and use DO SCRIPT FILE instead.

 

Here's an example using a building at Sukhumi

Static Handler Example using DO SCRIPT.miz 8.29 kB · 38 downloads

 

Thank you @feefifofum for kindly providing that example. I loaded it up to analyze and learn, only to find out that it does not work; after the building explodes there is no message. I added a plane so I could receive Message To All as player or client, but it seems that flag 1 is never set, i.e. the event handler is not executed. I'm running the latest DCS open beta. Thanks for any pointers what I'm doing wrong. 

 

 

Link to comment
Share on other sites

I ran more test. After some back and forth, I discovered that the object ID was a mismatch. In my version, that object has the ID 78385155 instead of 72455195. This has me worried - are object IDs subject to change? That would make writing missions for other people impossible.

 

-ch

 

Link to comment
Share on other sites

This is probably a bug; I remember an instance recently where airfield IDs were accidentally swapped around.

 

In the editor, you can right click on the object and click "assign as." This will show you the object ID.

I'll fiddle around some more when time allows, only had 2 minutes to quickly run the existing .miz and begin wild speculation 😉

  • Like 1
Link to comment
Share on other sites

Thank you! That is exactly what I did and how I discovered the ID mismatch. The question is now: is the mismatch specific to my copy of DCS, or is that object's ID different for all who have my version. 

 

Note: the building is destroyed (the explode action does that) - but it does not trigger the script since the ID with your kindly provided script mismatches. hence no setting flag to 1, hence no message to all.

 


Edited by cfrag
Link to comment
Share on other sites

On my end, the object ID did match with the one in the script, but the script still didn't function properly due to the apparent absence of the object ID passed to the engine, as shown in my screenshot. Previously the ID number given by the "assign as" function in the ME would match the display in the after-action report in the "Initiator" field.

 

Either something fundamental has changed with the SSE, or there is a bug in the current build. Given the active development state of the DCS core engine, either is a possibility! I also have a ton of mods enabled in my OB installation so I'd need to do some thorough prodding before I could definitively make a bug report. The fact that both of us are seeing some strange behavior here, though, is telling, and this definitely worked when I posted it!


Edited by feefifofum
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...