Jump to content

Deactivate SAM group after all weapons exhausted


Recommended Posts

Posted

Hi folks,

 

I want to deactivate a group after it has launched all of it's missiles.

Tried by setting :

Defined missile in defined Zone > flag 1 increase by 1 (repetitive)

then

Flag 1 value equals 12 > deactivate group

but it does not work.

 

Thanks for any tips.

Posted

The SAM site is inside Zone? Cause maybe it already detect missiles inside.

Try to do  a little debug: under flag increase value add a message to all, so you can check if condition is true.

And move SAM outside zone - maybe surround it with several small zones, one for each direction...

Posted (edited)
10 hours ago, BrzI said:

 

Tried by setting :

Defined missile in defined Zone > flag 1 increase by 1 (repetitive)

then

Flag 1 value equals 12 > deactivate group

but it does not work.


make sure that the zone is not too large, or else if the sam battery fires a second missile while the previous one is still in zone then it wont be counted.

 

Edit: This sample is from one of my missions, you can see that the detection Zone is fairly small .. just enough to count one launch but not the next.

 

o1HRjw4.jpg

Edited by Rudel_chw

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar

Mobile: iPad Pro 12.9" of 256 GB

Posted

Yeah, I figured out that the zone needs to be small. That solution works well for missiles that do not launch vertically (unlike the S300).

 

Then I see exactly what you mention - some launches do not get counted.

 

I am going to try defining really small zones for every launcher in the site...That ought to give more accurate results...

 

Thanks/

Posted

Well, guess there is a bug in here somewhere - I defined a small 20m zone around each S-300 launcher...but it regularly misses registering one or two out of a full complement of 24 missiles. I simply cannot get all 24 flag value changes to register... tried making small changes to zone size and moving zones slightly...no joy...

😟

Thanks

Posted (edited)

Here is a script that will help you accomplish what you're going for....  This will increase the value of Flag 1 by one each time a missile is fired by the units named LAUNCH 1, LAUNCH 2, LAUNCH 3, LAUNCH 4, LAUNCH 5 or LAUNCH 6.

 

The important thing is to make sure you input the UNIT names of the missile launcher(s) into the script, not the group

 

See attached mission file for an example of this script in use.  The flag value will increase by one each time a missile is fired. Once 5 missiles are fired, the group deactivates.

 

(Thanks to Hardcard for helping me with this a while ago)

 

 

 

Handler = {}
function Handler:onEvent(event)
    if event.id == world.event.S_EVENT_SHOT and event.initiator == Unit.getByName('LAUNCH 1') or Unit.getByName('LAUNCH 2') or Unit.getByName('LAUNCH 3') or Unit.getByName('LAUNCH 4') or Unit.getByName('LAUNCH 5') or Unit.getByName('LAUNCH 6') then
                 flag_value = trigger.misc.getUserFlag('1')
                 trigger.action.setUserFlag('1', flag_value + 1)                  
              end
           end
world.addEventHandler(Handler)

 

MISSILE LAUNCH SCRIPT.miz

Edited by Sedlo
  • Like 1
Posted
14 minutes ago, Sedlo said:

Here is a script that will help you accomplish what you're going for.... 


thanks a lot, seems very useful and simple. 

  • Like 1

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar

Mobile: iPad Pro 12.9" of 256 GB

  • Recently Browsing   0 members

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