Jump to content

Check "Does destroyed unit belong to group?" in ME condition


Recommended Posts

Hey all,

 

Is there a way to check if a destroyed unit belongs to a specific group within an ME condition? I know it can obviously be done using MIST or MOOSE, but I'm not sure how to do it within an ME-created trigger.

Do events such as ON DESTROY return a value within an ME condition? If so, can anyone give an example of how to access the returned value, please?

Thanks in advance.

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

Nope. The events don't really do anything other than limit whenever a condition can be evaluated. However the group a specific unit belongs to can't change anyway. Since you are adding a trigger for that specific unit then you know that it belongs to a specific group to do whatever you want with it. 

 

The question seems to be more phrased in terms of how the scripting engine does events where its just an object that causes a given event and it could be almost anything in the game where you might have to figure out the object type and group to do something specific. 

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects: Scripting Wiki, Something...

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Thanks for the response, Grimes. The specific use-case I'm trying to solve for is really simple:

 

  • I have group TGT Group West that consists of 15 units
  • Any time a unit within that group gets destroyed, I want to increment a flag

 

What I obviously want to avoid is the need for 15 virtually identical ON DESTROY triggers with conditions that are just variations of Unit Dead "TGT GROUP West Unit 1", etc. It seems like such a common use-case that there must be a simple way to increment a counter whenever a unit belonging to a specific group gets killed, but I can't figure out how to do it within the ME.

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

Posted (edited)

As Grimes says, ON DESTROY isn't really relevant in this case. 

 

1 ONCE (TGT vehicle killed, NO EVENT)

==

UNIT DEAD (Vehicle 1)

==

FLAG INCREASE (1,1)

 

Press the "Clone" button, select the next unit from the drop down menu, and off you go to the races.

 

The alternative would involve an event handler, checking whenever S_EVENT_DEAD occurs, and comparing the name of the event initiator to a table of units in the group. If you haven't already started fooling around in the scripting engine, though, the former approach is probably going to involve less effort.

 

 


Edited by feefifofum
  • Like 1
Link to comment
Share on other sites

Great. Thanks for your help, guys.

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...