Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Hi

 

I use to play a customized version of Surrexen's Snowfox mission with AI aircafts spawned on the ramp. Since yesterday's 2.5.6 update (might be a coincidence, I haven't played since last weekend) when any aircraft spawns on the ground it inmediatelly explodes.

 

This is what I'm doing via F10 menu call:

 

BLUECAP1[value] = SPAWN
               :New( "RT BLUE CAP "..RouteNumber )
               :InitLimit( 2, 2 )
               :InitRandomizeTemplate( { "SQ BLUE CAP F-15C" } )
               :OnSpawnGroup(
                   function( SpawnGroup )                                
                       RTBLUECAPGROUPNAME = SpawnGroup.GroupName
                       RTBLUECAPGROUPID = Group.getByName(RTBLUECAPGROUPNAME):getID()                                                
                   end
               )                
                :SpawnAtAirbase(AIRBASE:FindByName(AIRBASE.PersianGulf.Al_Minhad_AB), SPAWN.Takeoff.Hot )

 

 

I updated Moose file loaded on the mission to the last version 2.5.0 pre-release, with same result.

 

 

Has something changed and this is not the right usage of SpawnAtAirbase anymore?

 

 

Thanks

 

 

 

Complete function:

 

function RequestFighterSupport(CAPSector)

   if (SnowfoxAircraftInterment[7] <= 0) then
       return
   end
   
   if ( trigger.misc.getUserFlag(5001) == 1 ) then    
       value = trigger.misc.getUserFlag(5010)
       if ( value < 4 ) then
           
           local RouteNumber = CAPSector
           
           BLUECAP1[value] = SPAWN
               :New( "RT BLUE CAP "..RouteNumber )
               :InitLimit( 2, 2 )
               :InitRandomizeTemplate( { "SQ BLUE CAP F-15C" } )
               :OnSpawnGroup(
                   function( SpawnGroup )                                
                       RTBLUECAPGROUPNAME = SpawnGroup.GroupName
                       RTBLUECAPGROUPID = Group.getByName(RTBLUECAPGROUPNAME):getID()                                                
                   end
               )                
               :SpawnAtAirbase(AIRBASE:FindByName(AIRBASE.PersianGulf.Al_Minhad_AB), SPAWN.Takeoff.Hot )
           
           trigger.action.outText("Fighter Screen Launched to "..CAPSector..". There are "..SnowfoxAircraftInterment[7].." available flights.",60)
           menuCAP[value] = missionCommands.addCommandForCoalition(coalition.side.BLUE, "Abort Mission CAP "..CAPSector, SupportMenuAbortCAP, function() AbortCAPMission(value) end, nil)
           trigger.action.setUserFlag(5010,value+1)    
           
       elseif ( value == 4) then
           --Check if the spawned Fighter Screen group is still alive or not
           for i=0,3,1 do    
               if ( BLUECAP1[i]:IsAlive() ) then
                   
               else
                   local RouteNumber = CAPSector
           
                   BLUECAP1[i] = SPAWN
                       :New( "RT BLUE CAP "..RouteNumber )
                       :InitLimit( 2, 2 )
                       :InitRandomizeTemplate( { "SQ BLUE CAP F-15C" } )
                       :OnSpawnGroup(
                           function( SpawnGroup )                                
                               RTBLUECAPGROUPNAME = SpawnGroup.GroupName
                               RTBLUECAPGROUPID = Group.getByName(RTBLUECAPGROUPNAME):getID()                                                
                           end
                       )                
                       :SpawnAtAirbase(AIRBASE:FindByName(AIRBASE.PersianGulf.Al_Minhad_AB), SPAWN.Takeoff.Hot )
           
                   trigger.action.outText("Fighter Screen Launched to "..CAPSector..". There are "..SnowfoxAircraftInterment[7].." available flights.",60)
                   missionCommands.removeItemForCoalition(coalition.side.BLUE, menuCAP[i], SupportMenuAbortCAP)            -- TODO: might not exist?
                   menuCAP[i] = missionCommands.addCommandForCoalition(coalition.side.BLUE, "Abort Mission CAP "..CAPSector, SupportMenuAbortCAP, function() AbortCAPMission(i) end, nil)
                   return
               end
           end
           trigger.action.outText("Fighter Screen Is Currently Active, Further Support Is Unavailable",60)
       else
           --Do nothing
       end
   else
       trigger.action.outText("Fighter Screen Unavailable For This Mission",60)        
   end
end

 

Link to comment
Share on other sites

Folks...

 

Moose blew up because ED changed the event id's for some reason. Grimes got his page fixed on Hoggit, but of course it's not obvious from all the noise what was going on.

Example: https://wiki.hoggitworld.com/index.php?title=DCS_event_shooting_start&curid=255&diff=10910&oldid=525

We are working on it, but Moose in 2.5.6 is mostly broken. At least A2A_Dispatcher, RAT, SpawnAtAirbase() - lots of fundamental stuff and events are broken. So don't worry about saying it doesn't work and link people back here so they know why. No ETA, its the weekend when folks are enjoying hteir family etc.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Folks...

 

Moose blew up because ED changed the event id's for some reason. Grimes got his page fixed on Hoggit, but of course it's not obvious from all the noise what was going on.

Example: https://wiki.hoggitworld.com/index.php?title=DCS_event_shooting_start&curid=255&diff=10910&oldid=525

We are working on it, but Moose in 2.5.6 is mostly broken. At least A2A_Dispatcher, RAT, SpawnAtAirbase() - lots of fundamental stuff and events are broken. So don't worry about saying it doesn't work and link people back here so they know why. No ETA, its the weekend when folks are enjoying hteir family etc.

 

It is strange that this problem occured for enumerators. I mean the IDs might have changed, but the identifiers from the enumerator world.event should be the same. Isn't that the case?

Or is MOOSE using the IDs directly? Maybe you guys should create a wrapper for the IDs to make the future maintenance of the code easier. :)

Link to comment
Share on other sites

Or is MOOSE using the IDs directly? Maybe you guys should create a wrapper for the IDs to make the future maintenance of the code easier. :)

Moose is using the enumerators not the IDs. Still each event that occurs is processed and needs to be defined in Moose.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

EventMeta is nil due to the new event types being unknown to do the table lookup. Simple error handling in the ELSE could catch this in the future.

if not EventMeta then [define new EventMeta of type UNKNOWN or something] end

The largest problem most scripts are going to see is the new Airbase IDs: https://forums.eagle.ru/showpost.php?p=4210874&postcount=14

 

Right now, MOOSE and other scripts that rely on Airbase ID are spawning planes on top of each other!

Link to comment
Share on other sites

EventMeta is nil due to the new event types being unknown to do the table lookup. Simple error handling in the ELSE could catch this in the future.

if not EventMeta then [define new EventMeta of type UNKNOWN or something] end

The largest problem most scripts are going to see is the new Airbase IDs: https://forums.eagle.ru/showpost.php?p=4210874&postcount=14

 

Right now, MOOSE and other scripts that rely on Airbase ID are spawning planes on top of each other!

SpawnAtAirbase() is also broken and for some reason fires off an event error but here is the event section of moose, feel free to consider a PR on it, it's too confusing for me to understand, I'm not sure if just populating the rest of the EH's into the metatable will be all it needs and I dont have dev environment setup to just try it out. https://github.com/FlightControl-Master/MOOSE/blob/develop/Moose%20Development/Moose/Core/Event.lua

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Update:

Spawning Aircraft in DCS direct to the parking causes them to explode. All other parts of getParking() and Airbase.id is perfectly fine as far as I can tell. This doesnt happen with late activated units at a specific parking point.

The modules that use this advanced spawning are Rat, A2A_Dispatcher, parts of airboss like the helo and tanker scripts (both if you configure runway or parking starts) and any module with spawns that are not using a predesigned template with it's own routes (ie the AI adjusts the routing dynamically itself as part of the class.

 

As far as I can tell this is a DCS induced change, but I'd appreciate anyone reproducing by spawning an AI directly onto the ground cold with the basic SSE lua methods rather than using MOOSE.

 

If we can do that, then we can open a ticket as I see it as a crippling defect for many advanced scripting things.

 

On the event side, it's not a huge deal, we can silence the errors by adding the new events, but that would be published with a more stable version of DCS 2.5.6+ as long as the other issues can be solved.

 

The impact of not solving the spawning at airbase bug are quite huge to MOOSE.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

As far as I can tell this is a DCS induced change, but I'd appreciate anyone reproducing by spawning an AI directly onto the ground cold with the basic SSE lua methods rather than using MOOSE.

 

If we can do that, then we can open a ticket as I see it as a crippling defect for many advanced scripting things.

First very basic test, we can spawn a vehicle with basic FuncAddGroup().

Moving on to aircraft.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

It is the airbase ID that is ****ed up in DCS 2.5.6. Providing the airbase:getID() value to the airdromeID field of the spawn template causes the aircraft to explode.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

It is the airbase ID that is ****ed up in DCS 2.5.6. Providing the airbase:getID() value to the airdromeID field of the spawn template causes the aircraft to explode.

And answers on a postcard for why DCS explodes it, even if it was in the right place!!!

 

So , some good news for today. we will have it fixed... cough.. I mean Frank. :)

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

And answers on a postcard for why DCS explodes it, even if it was in the right place!!!

 

So , some good news for today. we will have it fixed... cough.. I mean Frank. :)

Good news indeed. Aircraft spawn works, as well via FuncAddGroup (), just took me a while to get all the required parameters... in the end I did a copy paste from the mission Lua.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Dev hot push

 

Frank, is so good to us.

 

2.5.6 hotfix for MOOSE on dev branch.

https://github.com/FlightControl-Master/MOOSE_INCLUDE/blob/develop/Moose_Include_Static/Moose.lua

 

Anyone wanting to run MOOSE on 2.5.6 will need to use this version

BASE - Added new DCS 2.5.6 events for docs/intellisense.

DATABASE - Used world.getAirbases() to get new airbase ID for DCS 2.5.6.

EVENT - Added new DCS 2.5.6 events. - Added nil check for EVENTMETA in case of unknown events. Produces a warning in the logs.

POINT - Added WaypointNaval(). Can have depth parameter for submarines.

SPAWN - Added optional parameter TerminalType to SPAWN:InitAirbase() function.

USERFLAG - Added GetName() function.

RANGE v2.2.2 - Added range name to radio queue.

ATIS v0.6.3 - Wind from 0° is reported as from 360°.

ENUMS - Added some weapon flags.

AIRBASE - Adjusted GetID function to be compatible with DCS 2.5.5 and DCS 2.5.6.

CONTROLLABLE - Added some tasks, - Added default parameters for tasks.

GROUP - Added generalized attributes.

UNIT - Added function to easily get the template, template payload and template pylons.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Frank, is so good to us.

 

2.5.6 hotfix for MOOSE on dev branch.

https://github.com/FlightControl-Master/MOOSE_INCLUDE/blob/develop/Moose_Include_Static/Moose.lua

 

Anyone wanting to run MOOSE on 2.5.6 will need to use this version

 

Thanks a lot, to both of you .. I dont do scripting, but use RAT a lot :)

 

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 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Thanks a lot, to both of you .. I dont do scripting, but use RAT a lot :)

All I did was bug the poor man. But the changes are good, there's some future proofing and preparation for the changes, so the timing was kindda good.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Frank, is so good to us.

 

2.5.6 hotfix for MOOSE on dev branch.

https://github.com/FlightControl-Master/MOOSE_INCLUDE/blob/develop/Moose_Include_Static/Moose.lua

 

Anyone wanting to run MOOSE on 2.5.6 will need to use this version

BASE - Added new DCS 2.5.6 events for docs/intellisense.

DATABASE - Used world.getAirbases() to get new airbase ID for DCS 2.5.6.

EVENT - Added new DCS 2.5.6 events. - Added nil check for EVENTMETA in case of unknown events. Produces a warning in the logs.

POINT - Added WaypointNaval(). Can have depth parameter for submarines.

SPAWN - Added optional parameter TerminalType to SPAWN:InitAirbase() function.

USERFLAG - Added GetName() function.

RANGE v2.2.2 - Added range name to radio queue.

ATIS v0.6.3 - Wind from 0° is reported as from 360°.

ENUMS - Added some weapon flags.

AIRBASE - Adjusted GetID function to be compatible with DCS 2.5.5 and DCS 2.5.6.

CONTROLLABLE - Added some tasks, - Added default parameters for tasks.

GROUP - Added generalized attributes.

UNIT - Added function to easily get the template, template payload and template pylons.

Love you guys! This makes my day, so happy it could be fixed so quickly.

:)

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Frank, is so good to us.

 

DATABASE[/b] - Used world.getAirbases() to get new airbase ID for DCS 2.5.6.

 

Will we need to edit our code that references airbases prior to 2.5.6? Or does the updated Moose.lua work with the older IDs?

 

Thanks.

 

Markeebo

 

Sent from my SM-G975U1 using Tapatalk

Link to comment
Share on other sites

Will we need to edit our code that references airbases prior to 2.5.6? Or does the updated Moose.lua work with the older IDs?

 

Thanks.

 

Markeebo

 

Sent from my SM-G975U1 using Tapatalk

Seems to work fine! Just changed the Moose.lua and ran my latest project with RAT and A2A.Dispatcher and looks like it works fine. Only thing is the F10 Map no longer showing spawned planes, but need to check if they are not hidden etc. EDIT: Yeah, I did hide them completely, so this was my "fault".

After Franky's patch, all runs smooth, again.

Thank you! :notworthy:


Edited by shagrat

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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