Blowing up buildings - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 10-08-2020, 09:36 PM   #1
Irishlad200000
Member
 
Irishlad200000's Avatar
 
Join Date: Jul 2012
Posts: 174
Default Blowing up buildings

What is the cleanest way to have an action triggered when a scenery building is destroyed? Have tried various things but looking the cleanest way to do it.

Sent from my SM-G981B using Tapatalk
Irishlad200000 is offline   Reply With Quote
Old 10-08-2020, 10:37 PM   #2
Repth
DCS Ground Crew
 
Repth's Avatar
 
Join Date: Sep 2017
Location: Arizona
Posts: 217
Default

Depends, are you talking scripted mission with specifically assigned ordinance or open type mission?
Repth is offline   Reply With Quote
Old 10-10-2020, 09:59 PM   #3
Pikey
Veteran
 
Pikey's Avatar
 
Join Date: Sep 2009
Location: Reading, UK (GMT)
Posts: 4,670
Default

I don't know of multiple ways, I only know that an event handler looking for th eunit ID would be the most direct.
__________________
___________________________________________________________________________
SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING * PLAYLIST
Pikey is offline   Reply With Quote
Old 10-11-2020, 01:20 AM   #4
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 3,275
Default

Use the handy new right click tool to retrieve the object ID, then write a simple event handler to detect when it is destroyed.
Code:
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)

Last edited by feefifofum; 10-20-2020 at 02:08 AM.
feefifofum is offline   Reply With Quote
Old 10-16-2020, 10:57 AM   #5
Galwran
Member
 
Join Date: Apr 2005
Location: Finland
Posts: 366
Default

Where and how this event handler should be ran?
Galwran is offline   Reply With Quote
Old 10-20-2020, 02:09 AM   #6
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 3,275
Default

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
Attached Files
File Type: miz Static Handler Example using DO SCRIPT.miz (8.3 KB, 4 views)
feefifofum is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:57 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.