Jump to content

Recommended Posts

Posted (edited)

Hi, guys.

 

I'm wanting to have a simple script for detecting coalition aircraft within a trigger zone to Group AI On/Off some SAM units.

 

mist.flagFunc.units_in_zones{ 
   units = {'[blue][plane]'}, 
   zones = {'Trip'}, 
   flag = 10001, 
   zone_type = 'cylinder',
   stopflag = 10002,
   toggle = true, 
}

 

I've included a test mission attached with the MIST version I'm using to get the system running using smoke markers and message to all, but I can't get it to work. I've searched through forums, but I can't see what the issue is.

 

What am I doing wrong here?

mistv3_7_51.lua

Tester.miz

Edited by Zomba

I don't test for bugs, but when I do I do it in production.

Posted

A glorious comrade has found the problem. A bug in MIST. He had found this issue several months ago when using MIST for his own mission. Below is the fix he applied to get it functional again.

 

if stopflag == -1 or (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == false) then
   
       local in_zone_units = mist.getUnitsInMovingZones(units, zone_units, radius, zone_type)
   
       -- ZyfrNZ: BUGFIX TO FLAG AS THE ORIGINAL WAS FAILING ON "trigger.misc.getUserFlag(flag) == false"        
       -- if #in_zone_units >= req_num and trigger.misc.getUserFlag(flag) == false then
       if #in_zone_units >= req_num and ((type(trigger.misc.getUserFlag(flag)) == 'number' and trigger.misc.getUserFlag(flag) == 0) or (type(trigger.misc.getUserFlag(flag)) == 'boolean' and trigger.misc.getUserFlag(flag) == false)) then        
           trigger.action.setUserFlag(flag, true)
       elseif #in_zone_units < req_num and toggle then
           trigger.action.setUserFlag(flag, false)
       end        
       -- do another applied fix to function mist.flagFunc.units_in_moving_zones(vars) and function mist.flagFunc.units_in_zones(vars)

I don't test for bugs, but when I do I do it in production.

Posted

??

 

I use this particular script in many instances w/o a problem. What exactly did you find is a problem?

 

Here is an example of what I use:

mist.flagFunc.units_in_zones{ 
   units = {'[red][plane]'}, 
   zones = {'Ready to Attack Ground Units'}, 
   flag = 10007, 
   zone_type = 'cylinder',
   stopflag = 10004,
   toggle = true, 
}

 

I'm using Mist 3.5.37.

 

WC

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

I'll have to ask him when I see him online next. From what I gather he had tried to use it a wee while ago and had the same issue with mist.flagFunc.units_in_moving_zones and upon investigation found what was causing it. He said something about it using a boolean function incorrectly. My guess is perhaps the issue came about in later versions of MIST as all the google results i've found using older versions seemed to work fine. With the fix he applied it's working just fine now.

I don't test for bugs, but when I do I do it in production.

  • 4 years later...
Posted
??

 

I use this particular script in many instances w/o a problem. What exactly did you find is a problem?

 

Here is an example of what I use:

mist.flagFunc.units_in_zones{ 
   units = {'[red][plane]'}, 
   zones = {'Ready to Attack Ground Units'}, 
   flag = 10007, 
   zone_type = 'cylinder',
   stopflag = 10004,
   toggle = true, 
}

 

I'm using Mist 3.5.37.

 

WC

 

This is not working on Mist 4_3_74 im trying to get just a simple flag tu turn on while a single plane enters zone "rocco" and I cant get it to work...

 

mist.flagFunc.units_in_zones{

units = {'eagle'},

zones = {'rocco'},

flag = 6,

zone_type = 'cylinder',

stopflag = 10004,

toggle = true,

}

 

 

 

Any Ideas?

 

Thanks

  • Recently Browsing   0 members

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