Jump to content

Detect when dynamically added units are present or not


Recommended Posts

Posted

Hi,

 

In a mission I'm bulding, I use mist.cloneInZone to spawn a group of tanks randomally inside a zone.

I'd like to have a message displayed to the players if/when a few of the tanks in the group (i.e. 50%) have been destroyed during the mission.

I know I can't use the simple "GROUP ALIVE LESS THAN" trigger, since the group is dynamically spawned rather than an "original" editor group.

Also tried using the mist.flagFunc.units_in_zones to check the group and once its designated flag goes "false" - trigger the message. But this also doesn't seem to work.

 

Can anyone point me to a simple solution?

(I'm still on a very basic level of experience when it comes to scripts....)

 

Thanks !

Assaf.

Posted

That flagFunc should work because its designed to update the units it checks when new units get spawned. Can you post the mission you tried it with or at least post the code you used and describe the order it works in?

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

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
That flagFunc should work because its designed to update the units it checks when new units get spawned. Can you post the mission you tried it with or at least post the code you used and describe the order it works in?

 

Thanks Grimes,

Attaching the test I've made for this issue.

Group 'TestGroup1' is cloned in the zone 'SpawnZone'

mist.flagFunc.units_in_zones is checking the zone 'DetectZone' and should activate flag-1 once all four trucks are destroyed -> display the message.

 

I think I've found what my mistake was:

In the "units" line at mist.flagFunc.units_in_zones I've originally included the group's original name '[g]TestGroup1' . I realize that since this name isn't maintained for the cloned group, it was not identified by the function and so the flag (1) was not affected - either by the group appearing inside the "DetectZone" or when it was destroyed.

 

Once I've changed the units line to '[red]' , all seems to work OK (however this solution is preventing me from distinguishing specific red groups...

 

Thanks,

Assaf.

Clone test v1.miz

  • Recently Browsing   0 members

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