Jump to content

Recommended Posts

Posted

I'm trying to detect if a building is destroyed, which I've added within a triggerzone:

image.png

 

At mission startup I load the mist 4.5.126 library

and after 10 seconds I do this script: (ONCE, TIME > 10 seconds)

mist.flagFunc.mapobjs_dead_zones{ zones = {'KirkenesWarehouse'}, flag = 1 }

 

 

I also have a repetitive debugger:

debug = trigger.misc.getUserFlag("1")
zone = {'KirkenesWarehouse'}
objects = #mist.getDeadMapObjsInZones(zone)
trigger.action.outText("Debug flag 1 : " .. debug .. "\nDead objects : " .. objects, 1, true)

 

But neither debug or objects change after the building is bombed:

image.png

 

What am I missing?

I've also attached the mission itself.

F-5-Kola.miz

A-10C, AV-8B, Ka-50, F-14B, F-16C, F-5E, F/A-18C, L-39, Mi-8, MiG-21, MiG-29, SA34, Spitfire, Su-27, Su-33, UH-1H

Posted

This doesn't answer your question, it is an alternate method...

Right-click on the map object, to see 'assign as...', click on that to bring up a Trigger Zone dialog box which should show the definition of a quad-point zone around the building, you will see Object ID and Name in the attributes, for instance. At the very top, in that NAME box, enter in your name: Kirkeneswharehouse.

Now, set up a Once event, with Condition MAP OBJECT IS DEAD (Kirkeneswharehouse), and Action whatever you want.

I've found this method reliable. I hope it helps.

nullnull

  • Like 1

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted

Thanks for your reply! That looked like a very clever way of doing it, but that trigger didn't go off either 😞

 

I know I can "hack it" by putting a cow or a soldier close to the building and check if it's dead, but the less clutter I have in my mission the better. 

A-10C, AV-8B, Ka-50, F-14B, F-16C, F-5E, F/A-18C, L-39, Mi-8, MiG-21, MiG-29, SA34, Spitfire, Su-27, Su-33, UH-1H

Posted
1 hour ago, d0ppler said:

Thanks for your reply! That looked like a very clever way of doing it, but that trigger didn't go off either 😞

I know I can "hack it" by putting a cow or a soldier close to the building and check if it's dead, but the less clutter I have in my mission the better. 

You can actually put the solider INSIDE most or all of the buildings so it's basically invisible.  Not sure if that's what you're meaning by clutter.

Posted

Yeah I know, but it's still not as tidy as I want it to be. 

I'm mostly doing this to learn how to utilize MIST, and there's obviously something I'm missing.

  • Like 1

A-10C, AV-8B, Ka-50, F-14B, F-16C, F-5E, F/A-18C, L-39, Mi-8, MiG-21, MiG-29, SA34, Spitfire, Su-27, Su-33, UH-1H

Posted (edited)

OK.. I don't have the Kola map, so did not look at your mission. Here is another way, and a thread where there was a long discussion about it. It uses the same Object ID from the attributes that I showed above.

 

This is for the Hosta Bridge on the Caucasus Map. It is just north of Sochi.

-- detect if the Hosta bridge is destroyed:
-- Hosta Bridge Destroyed Flag is 91401
local mybridgedest = {}
function mybridgedest:onEvent(event)
 if (event.id == world.event.S_EVENT_DEAD) then
  if(event.initiator ~= nil) then -- Franze — 02/13/2024 3:44 PM
   -- if(event.initiator:getCategory() == 5 and event.initiator.id_ == 73695398) then
   if(Object.getCategory(event.initiator) == 5 and event.initiator.id_ == 73695398) then
    trigger.action.setUserFlag(91401, true)
    trigger.action.outText("Hosta bridge destroyed!  Nice job, Blue.  Word", 10)
   end
  end
 end
end
world.addEventHandler(mybridgedest)

--- This ^^^ works, no initiator errors.  

 

Confounded 02.lua

Edited by Wrecking Crew

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

  • Recently Browsing   0 members

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