Jump to content

MOOSE AI_A2A_Dispatcher SetSquadronLanding() Not Working,help


Recommended Posts

Posted

I find that only the landing setting functions of AI_A2A_Dispatcher is not working

ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\admin\AppData\Local\Temp\DCS\/~mis00006337.lua"]:141027: attempt to index local 'self' (a nil value)
 

I find that in the MOOSE.lua, all the AI_A2G_Dispatcher landing functions is commeted out, so as take off functions. Hoever, only landing method setting gives me the "a nil value error"

 

Here is my script.

All the group names are okay, if I remove the setsquardronlanding method then the script is okay

Detection_SetGroup_Red=SET_GROUP:New():FilterCoalitions("red"):FilterPrefixes({"Red_EWR","Red_AWACS"}):FilterStart()
Detection_from_Red=DETECTION_AREAS:New(Detection_SetGroup_Red,20000)

Red_A2A_Dispatcher=AI_A2A_DISPATCHER:New(Detection_from_Red)
--Red_A2A_Dispatcher.SetSquadronLandingAtEngineShutdown()

Red_A2A_Dispatcher:SetGciRadius(120000)

Red_A2A_Dispatcher:SetSquadron("Maykop_Khanskaya",AIRBASE.Caucasus.Maykop_Khanskaya,{"Red_GCI"},12)
Red_A2A_Dispatcher:SetSquadronGci( "Maykop_Khanskaya", 900, 1200 )
Red_A2A_Dispatcher:SetSquadronTakeoffFromParkingHot("Maykop_Khanskaya")

How to deal with it?

Posted

First of all, the best way to discuss Moose problems is the Moose Discord https://discord.gg/gj68fm969S

Please post the additional lines of the error message. Normally there is a indication in which line of your script the error occurs. From the first look your script looks ok and I can't see any error.

Posted (edited)
14 hours ago, dontcsink said:

I find that only the landing setting functions of AI_A2A_Dispatcher is not working

ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\admin\AppData\Local\Temp\DCS\/~mis00006337.lua"]:141027: attempt to index local 'self' (a nil value)
 

I find that in the MOOSE.lua, all the AI_A2G_Dispatcher landing functions is commeted out, so as take off functions. Hoever, only landing method setting gives me the "a nil value error"

I'm not a Moose expert, but from the way the error message sounds, I'm willing to bet that you accidentally used a period '.' where you should have used a colon ':'

14 hours ago, dontcsink said:
Red_A2A_Dispatcher.SetSquadronLandingAtEngineShutdown()

Is this the offending line? If so, try

Red_A2A_Dispatcher:SetSquadronLandingAtEngineShutdown()

It may resolve the issue. If it does, the distinction between ":" and "." is a fine one, and trips up even experienced mission designers. When you use ":", this signals the Lua language interpreter that you are using implicit syntactic sugar (that probably nobody told you about), and automatically first replaces ':' with '.', and then inserts a new first parameter with a reference to the table itself (the 'self' parameter). If you erroneously use '.', that 'self'-reference to the table is missing, is therefore substituted with nil, and you then get the nil error ('self has nil value').

 

 

Edited by cfrag
  • Thanks 1
Posted (edited)

as above the problems was the incorrect . where it need a :

A2ADispatcher:SetSquadronLandingAtEngineShutdown()



sure that can fix.

Edited by kira_mikamy
Posted
On 4/2/2023 at 6:53 PM, cfrag said:

I'm not a Moose expert, but from the way the error message sounds, I'm willing to bet that you accidentally used a period '.' where you should have used a colon ':'

Is this the offending line? If so, try

Red_A2A_Dispatcher:SetSquadronLandingAtEngineShutdown()

It may resolve the issue. If it does, the distinction between ":" and "." is a fine one, and trips up even experienced mission designers. When you use ":", this signals the Lua language interpreter that you are using implicit syntactic sugar (that probably nobody told you about), and automatically first replaces ':' with '.', and then inserts a new first parameter with a reference to the table itself (the 'self' parameter). If you erroneously use '.', that 'self'-reference to the table is missing, is therefore substituted with nil, and you then get the nil error ('self has nil value').

Thanks...I made that stupid typo again...

It's just weird that even in vscode with lua language server installed with the "intellisense", it still cannot pick out the typos..

 

 

 

  • Recently Browsing   0 members

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