Jump to content

MOOSE Spawning AI


HawkHunter

Recommended Posts

I have recently made a little script that uses moose to allow me to spawn Enemy AI aircraft from the radio Menu, it uses "Late Activation" Groups and spawns them in a Trigger zone.

 

The one issue I seem to have, is that when the AI Spawn, they just book it to the nearest Airfield and don't try to pursue or fight, even if I give them a Task(such as CAP or Search and Destroy), and i also tried way points but to no avail.

 

If anyone who knows MOOSE or anything about this, is there anyway to fix it so the AI actually try to fight, I would really appreciate it.

Link to comment
Share on other sites

Don't know Moose well enough off the top of my head, but you can accomplish what you want with MIST.

 

 

mist.cloneGroup (string groupName, boolean/number task)

 

 

 

ex. mist.cloneGroup("fighter1", true)

 

 

The true means that it will have the tasks you set it up with in the ME.

Link to comment
Share on other sites

Here is said script.

 

local Flag1 = USERFLAG:New("Flag_1")

local Flag2 = USERFLAG:New("Flag_2")

local Flag3 = USERFLAG:New("Flag_3")

local Flag4 = USERFLAG:New("Flag_4")

 

local Zone1 = ZONE:New("A2A_1")

local Zone2 = ZONE:New("A2A_2")

local Zone3 = ZONE:New("A2A_3")

local Zone4 = ZONE:New("A2A_4")

 

local A2AE = { "A2A_Easy_A", "A2A_Easy_B" }

local A2AN = { "A2A_Norm_A", "A2A_Norm_B" }

local A2AH = { "A2A_Hard_A", "A2A_Hard_B" }

local A2AD = { "A2A_Diff_A", "A2A_Diff_B" }

 

local ClientSet = SET_GROUP:New()

:FilterPrefixes("")

:FilterStart()

 

local A2A_Easy_Set = SET_GROUP:New()

:FilterPrefixes("A2A_Easy")

:FilterStart()

 

local A2A_Norm_Set = SET_GROUP:New()

:FilterPrefixes("A2A_Norm")

:FilterStart()

 

local A2A_Hard_Set = SET_GROUP:New()

:FilterPrefixes("A2A_Hard")

:FilterStart()

 

local A2A_Diff_Set = SET_GROUP:New()

:FilterPrefixes("A2A_Diff")

:FilterStart()

 

 

local function Flag1Set1()

 

Flag1:Set(1)

 

if Flag2:Is(2)

then

A2A_Norm_Set:ForEachGroup(

function( A2A_Norm_Set )

A2A_Norm_Set:Destroy(true)

end

)

 

elseif Flag3:Is(2)

then

A2A_Hard_Set:ForEachGroup(

function( A2A_Hard_Set )

A2A_Hard_Set:Destroy(true)

end

)

 

elseif Flag4:Is(2)

then

A2A_Diff_Set:ForEachGroup(

function( A2A_Diff_Set )

A2A_Diff_Set:Destroy(true)

end

)

end

 

if Flag1:Is(1)

then

 

SpawnA2A_Easy_Master = SPAWN:New( "A2A_Easy_Master" )

:InitLimit( 2, 1 )

:InitRandomizeTemplate( A2AE )

:InitRandomizeRoute( 1, 1, 20000 )

:SpawnScheduled( 5, .5 )

:SpawnInZone(Zone1, true)

 

Flag1:Set(2)

end

end

 

 

local function Flag2Set1()

 

Flag2:Set(1)

 

if Flag1:Is(2)

then

A2A_Easy_Set:ForEachGroup(

function( A2A_Easy_Set )

A2A_Easy_Set:Destroy(true)

end

)

 

elseif Flag3:Is(2)

then

A2A_Hard_Set:ForEachGroup(

function( A2A_Hard_Set )

A2A_Hard_Set:Destroy(true)

end

)

 

elseif Flag4:Is(2)

then

A2A_Diff_Set:ForEachGroup(

function( A2A_Diff_Set )

A2A_Diff_Set:Destroy(true)

end

)

end

 

if Flag2:Is(1)

then

 

SpawnA2A_Norm_Master = SPAWN:New( "A2A_Norm_Master" )

:InitLimit( 2, 1 )

:InitRandomizeTemplate( A2AN )

:InitRandomizeRoute( 1, 1, 20000 )

:SpawnScheduled(5, .5)

:SpawnInZone(Zone2, true)

 

Flag2:Set(2)

end

end

 

local function Flag3Set1()

 

Flag3:Set(1)

 

if Flag1:Is(2)

then

A2A_Easy_Set:ForEachGroup(

function( A2A_Easy_Set )

A2A_Easy_Set:Destroy(true)

end

)

 

elseif Flag2:Is(2)

then

A2A_Norm_Set:ForEachGroup(

function( A2A_Norm_Set )

A2A_Norm_Set:Destroy(true)

end

)

 

elseif Flag4:Is(2)

then

A2A_Diff_Set:ForEachGroup(

function( A2A_Diff_Set )

A2A_Diff_Set:Destroy(true)

end

)

end

 

 

if Flag3:Is(1)

then

 

SpawnA2A_Hard_Master = SPAWN:New( "A2A_Hard_Master" )

:InitLimit( 2, 1 )

:InitRandomizeTemplate( A2AH )

:InitRandomizeRoute( 1, 1, 20000 )

:SpawnScheduled(5, .5)

:SpawnInZone(Zone3, true)

 

Flag3:Set(2)

end

end

 

local function Flag4Set1()

 

Flag4:Set(1)

 

if Flag1:Is(2)

then

A2A_Easy_Set:ForEachGroup(

function( A2A_Easy_Set )

A2A_Easy_Set:Destroy(true)

end

)

 

elseif Flag2:Is(2)

then

A2A_Norm_Set:ForEachGroup(

function( A2A_Norm_Set )

A2A_Norm_Set:Destroy(true)

end

)

 

elseif Flag3:Is(2)

then

A2A_Hard_Set:ForEachGroup(

function( A2A_Hard_Set )

A2A_Hard_Set:Destroy(true)

end

)

end

 

 

if Flag4:Is(1)

then

 

SpawnA2A_Diff_Master = SPAWN:New( "A2A_Diff_Master" )

:InitLimit( 2, 1 )

:InitRandomizeTemplate( A2AD )

:InitRandomizeRoute( 1, 1, 20000 )

:SpawnScheduled(5, .5)

:SpawnInZone(Zone4, true)

 

Flag4:Set(2)

end

end

 

 

local function RefreshClientMenus()

 

_SETTINGS:SetPlayerMenuOff()

 

ClientSet:ForEachGroup(

function( ClientSet )

AirMenuStart = MENU_GROUP:New(ClientSet,"Air to Air Spawn Menu")

AirFlag1Set1 = MENU_GROUP_COMMAND:New(ClientSet, "Spawn Air to Air Easy", AirMenuStart, Flag1Set1)

AirFlag2Set1 = MENU_GROUP_COMMAND:New(ClientSet, "Spawn Air to Air Normal", AirMenuStart, Flag2Set1)

AirFlag3Set1 = MENU_GROUP_COMMAND:New(ClientSet, "Spawn Air to Air Hard", AirMenuStart, Flag3Set1)

AirFlag4Set1 = MENU_GROUP_COMMAND:New(ClientSet, "Spawn Air to Air Extreme", AirMenuStart, Flag4Set1)

end

)

end

 

MenuRefresher = SCHEDULER:New( nil,

function()

RefreshClientMenus()

end, {}, 1, 5

)

Link to comment
Share on other sites

What you have already for menus, but use the MOOSE CAP GCI AI-A2A_Dispatcher, and stop start squadrons with your menu functions. Then you can go up against enemy CAP or GCI interceptors.

Windows 10 64bit, Intel i7 6700K, 32GB Corsair 2400Mhz, 970 NVMe 500Gb SSD, GeForce 2080 super, HP Reverb, VKB GF PRO, Thrustmaster Warthog throttle, Thrustmaster Pendular rudders, Windows + DCS :thumbup:

 

My youtube channel

Link to comment
Share on other sites

  • 9 months later...

Sounds like its the plane templates that are faulty, the missions Task is copied from those. if there is none, planes do nothing. I would ask if there are any errors, but I'm terrified you might post it ;) :)

___________________________________________________________________________

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

Link to comment
Share on other sites

  • Recently Browsing   0 members

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