MOOSE - Mission Object Oriented Scripting Framework - Page 167 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 07-18-2019, 09:53 PM   #1661
ReflexArc
Junior Member
 
Join Date: Apr 2018
Posts: 30
Default

I'm perplexed. I'm trying to add simple SEAD evasion behavior to a SAM site in a test mission.

As far as I can tell, the functionality is not working in the Caucasus map.

When I do the same thing (same script, same SAM site) in NTTR, I get a string error but the SEAD evasion functionality works perfectly.

About to test in PG. Will supply NTTR error message shortly.

But hoping maybe this is already a known problem or someone might have a clue what's going on? I'm not familiar enough with the DCS source code to know why different maps would cause totally different MOOSE SEAD behavior.

Edit 1:

To add to the strangeness, I tested on PG, no string error, just didn't work.

Went back to NTTR to try to reproduce SEAD evasion working but getting a weird string error. Now NTTR is just not working like the rest of the maps.

Edit 2:

Suspecting extra weirdness, I quit out of DCS. Reopened the same NTTR mission without making any changes. Started the mission, got the same two string errors. SEAD evasion functionality working perfectly.

Error 1:
Code:
[string
"C:\Users\(myname)\AppData\Local\Temp\DCS\/~mis00007487.lua"]:5:
attempt to index global 'EVENT' (a nil value)
stack traceback:
    [C]: ?
    [string
"C:\Users\(myname)\AppData\Local\Temp\DCS\/~mis00007487.lua"]:5:
in main chunk
Error 2: Same as 1 but "SEAD" and different mis number (000022D0):1

The code I'm using is literally the example code.

Code:
-- CCCP SEAD Defenses
SEAD_RU_SAM_Defenses = SEAD
  :New(
    { 'SAM Test'
    }
  )
Edit 3: Actually, NTTR isn't working now, just throwing error codes.

Very frustrating.

Last edited by ReflexArc; 07-18-2019 at 10:20 PM.
ReflexArc is offline   Reply With Quote
Old 07-18-2019, 10:16 PM   #1662
Delta99
Member
 
Delta99's Avatar
 
Join Date: Jan 2017
Posts: 400
Default

Those errors MIGHT mean you are not loading Moose properly.

Near the start of the dcs.log file when the mission starts you should see Moose messages indicating it is loaded etc. If you don't see those, Moose isn't being loaded.

Quote:
Originally Posted by ReflexArc View Post
I'm perplexed. I'm trying to add simple SEAD evasion behavior to a SAM site in a test mission.

As far as I can tell, the functionality is not working in the Caucasus map.

When I do the same thing (same script, same SAM site) in NTTR, I get a string error but the SEAD evasion functionality works perfectly.

About to test in PG. Will supply NTTR error message shortly.

But hoping maybe this is already a known problem or someone might have a clue what's going on? I'm not familiar enough with the DCS source code to know why different maps would cause totally different MOOSE SEAD behavior.

Edit 1:

To add to the strangeness, I tested on PG, no string error, just didn't work.

Went back to NTTR to try to reproduce SEAD evasion working but getting a weird string error. Now NTTR is just not working like the rest of the maps.

Edit 2:

Suspecting extra weirdness, I quit out of DCS. Reopened the same NTTR mission without making any changes. Started the mission, got the same two string errors. SEAD evasion functionality working perfectly.

Error 1:
Code:
[string
"C:\Users\(myname)\AppData\Local\Temp\DCS\/~mis00007487.lua"]:5:
attempt to index global 'EVENT' (a nil value)
stack traceback:
    [C]: ?
    [string
"C:\Users\(myname)\AppData\Local\Temp\DCS\/~mis00007487.lua"]:5:
in main chunk
Error 2: Same as 1 but "Include" and different mis number (000022D0):1

The code I'm using is literally the example code.

Code:
-- CCCP SEAD Defenses
SEAD_RU_SAM_Defenses = SEAD
  :New(
    { 'SAM Test'
    }
  )
__________________
My Missions: Valley Patrol Mission :: Valley Escort Mission :: A2A Engagements
Delta99 is offline   Reply With Quote
Old 07-18-2019, 10:43 PM   #1663
ReflexArc
Junior Member
 
Join Date: Apr 2018
Posts: 30
Default

Quote:
Originally Posted by Delta99 View Post
Those errors MIGHT mean you are not loading Moose properly.

Near the start of the dcs.log file when the mission starts you should see Moose messages indicating it is loaded etc. If you don't see those, Moose isn't being loaded.
Yes that's exactly it, thank you. For anyone else who runs into my issue, the problem was that I tried to use the MOOSE.lua from the source code download and not the MOOSE.lua that contains the entire source.

As for whether the SEAD function works, I'm testing but it's looking like possibly no?

Is there a way of calling the emissions off action from lua? Might be more reliable than alarm state which doesn't seem to be working.

Last edited by ReflexArc; 07-18-2019 at 11:36 PM.
ReflexArc is offline   Reply With Quote
Old 07-19-2019, 02:38 PM   #1664
Hardcard
Member
 
Hardcard's Avatar
 
Join Date: May 2013
Posts: 607
Default

@ReflexArc

MOOSE SEAD evasion doesn't work (it's already reported, btw).

Setting SAM radar to alarm state green when SEAD missiles target them should do the trick (this is what I did when I wrote my own SEAD evasion script)

Last edited by Hardcard; 07-19-2019 at 02:41 PM.
Hardcard is offline   Reply With Quote
Old 07-19-2019, 10:45 PM   #1665
ReflexArc
Junior Member
 
Join Date: Apr 2018
Posts: 30
Default

Thanks @Hardcard, I'm looking through your old posts on the topic. I see you might have tried changing the weapon names to the correct values--did that work for you?

EDIT: Well, I think I figured out the issue in the SEAD function. I enabled a bunch of tracing and it turns out this was the error:

2019-07-19 23:21:06.560 INFO SCRIPTING: stack traceback:
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:6062: in function 'round'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:726: in function 'groupToRandomPoint'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:780: in function 'groupToRandomZone'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:752: in function 'groupRandomDistSelf'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:40642: in function 'EventFunction'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:6377: in function <[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:6376>
[C]: in function 'xpcall'
[string "C:\Users\\AppData\Local\Temp\DCS\/~mis00001105.lua"]:6375: in function 'onEvent'
[string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>

So I commented out this line

--routines.groupRandomDistSelf(_targetMimgroup,300,'Diamond',250,20) -- move randomly

And now the SAMs correctly change alarm state.

I haven't quite been able to figure out how things are getting improperly passed to the round util function but I'm sure someone with more familiarity with the code base than myself could figure that out pretty quickly...

Last edited by ReflexArc; 07-19-2019 at 11:35 PM.
ReflexArc is offline   Reply With Quote
Old 07-20-2019, 12:51 AM   #1666
Hardcard
Member
 
Hardcard's Avatar
 
Join Date: May 2013
Posts: 607
Default

@ReflexArc

Did you modify the SEADWeaponName values, like I suggested in the other posts?
That didn't solve the issue for me, but looks like a necessary modification nonetheless.

Also, that last error that you posted, was it also?:
Code:
attempt to index global 'EVENT' (a nil value)
Hardcard is offline   Reply With Quote
Old 07-20-2019, 01:46 AM   #1667
ReflexArc
Junior Member
 
Join Date: Apr 2018
Posts: 30
Default

I got the 'EVENT' error in that first post because I was loading in the wrong moose.lua (the small one that builds from source and not the standalone one that you include with missions).

Yes, I added the weapon names from your script.

It turns out routines.utils.round is not defined anywhere in the MOOSE code. It is called in a number of places, including as part of the function to get SAMs to change places within the SEAD class. I replaced routines.utils.round with math.floor and now the whole SEAD function is working just fine.

Later, instead of using math.floor, I added the snippet below to the moose.lua and everything works.

Code:
routines.utils.round = function(number, decimals)
    local power = 10^decimals
    return math.floor(number * power) / power
end
In case anyone wants the weapon names provided by Hardcard:

Code:
SEADWeaponName == "weapons.missiles.X_58" --Kh-58U anti-radiation missiles fired
    or 
    SEADWeaponName == "weapons.missiles.Kh25MP_PRGS1VP" --Kh-25MP anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.X_25MP" --Kh-25MPU anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.X_28" --Kh-28 anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.X_31P" --Kh-31P anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.AGM_45A" --AGM-45A anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.AGM_45" --AGM-45B anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.AGM_88" --AGM-88C anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.AGM_122" --AGM-122 Sidearm anti-radiation missiles fired
    or
    SEADWeaponName == "weapons.missiles.ALARM" --ALARM anti-radiation missiles fired then -- Check if the missile is a SEAD

Last edited by ReflexArc; 07-20-2019 at 02:45 AM.
ReflexArc is offline   Reply With Quote
Old 07-20-2019, 10:35 AM   #1668
Hardcard
Member
 
Hardcard's Avatar
 
Join Date: May 2013
Posts: 607
Default

@ReflexArc

If you haven't already, join the MOOSE Discord channel

Share this info with the MOOSE community there.

Also, please, report the issue (including your findings) here.

Thanks for the nice detective work!
Hardcard is offline   Reply With Quote
Old 07-20-2019, 01:11 PM   #1669
Delta99
Member
 
Delta99's Avatar
 
Join Date: Jan 2017
Posts: 400
Default

Yeah, nice work @ReflexArc

I saw your issue entered and hopefully someone will incorporate into Moose soon.
__________________
My Missions: Valley Patrol Mission :: Valley Escort Mission :: A2A Engagements
Delta99 is offline   Reply With Quote
Old 07-22-2019, 01:13 AM   #1670
A101Wayz
Member
 
Join Date: Feb 2019
Posts: 106
Default

I'm afraid I'm stuck again...
Trying to capture when a SPAWN group passes an ME waypoint. Or, optionally, a way to capture the next waypoint in it's mission. I need to execute a state change in an FSM object at a particular waypoint.

Any way to do this in scripting?
__________________
Wayz Out


Intel Core i9 9900K | ASUS ROG Strix Z390E Gaming MB | G.Skill Ripjaws V 32gb DDR4-3200 | GeForce GTX 1070 Ti FTW2 | Samsung 970 EVO Plus NVMe
HTC Vive Pro VR | Logitech G x56 HOTAS | Logitech G PRO Pedals
A101Wayz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 09:18 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.