Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

So I tried the Intercept script

 

DetectionSetGroup = SET_GROUP:New()

DetectionSetGroup:FilterPrefixes( { "IR EWR" } )

DetectionSetGroup:FilterStart()

 

Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 )

 

-- Setup the A2A dispatcher, and initialize it.

A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )

 

-- Initialize the dispatcher, setting up a border zone. This is a polygon,

-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area.

-- Any enemy crossing this border will be engaged.

CapZone_East = ZONE_POLYGON:New( "CapZone East", GROUP:FindByName( "CapZone East" ) )

--A2ADispatcher:SetBorderZone( CCCPBorderZone )

 

-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly

-- without an assignment within 100km radius from a detected target, will engage that target.

A2ADispatcher:SetEngageRadius( 30)

 

 

A2ADispatcher:SetTacticalDisplay( true )

 

-- Test intercept.

A2ADispatcher:SetIntercept( 450 )

 

-- Setup the squadrons.

 

A2ADispatcher:SetSquadron( "Bandar Abbas Intl", AIRBASE.PersianGulf.Bandar_Abbas_Intl, { "BA DEF" },6 )

A2ADispatcher:SetSquadronGrouping( "Bandar Abbas Intl", 2 )

A2ADispatcher:SetSquadronGci( "Bandar Abbas Intl", 900, 1200 )

A2ADispatcher:SetSquadronTakeoffFromRunway( "Bandar Abbas Intl" )

A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Bandar Abbas Intl" )

 

A2ADispatcher:SetSquadron( "Havadarya", AIRBASE.PersianGulf.Havadarya, { "Havadarya Def" },6 )

A2ADispatcher:SetSquadronGrouping( "Havadarya", 2 )

A2ADispatcher:SetSquadronGci( "Havadarya", 800, 1200 )

A2ADispatcher:SetSquadronTakeoffFromRunway("Havadarya")

A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Havadarya" )

 

A2ADispatcher:Start()

 

 

 

Based on my test Bandar should have spawned its' bird as the intruder is much closer to it. Instaed Hav spawns.

[sIGPIC][/sIGPIC]

http://www.Vcw13.com

 

 

Asus Z270 Prime-A | i7-7700k | 32G Corsair Vengeance DDR4 3200 | EVGA RTX 2080ti | 2x 960 EVO M.2 in RAID 0 | 500GB SSD | Thrustmaster Warthog | Pimax 5K Plus

 

 

https://www.youtube.com/c/OverKillSims

Link to comment
Share on other sites

So I tried the Intercept script

 

DetectionSetGroup = SET_GROUP:New()

DetectionSetGroup:FilterPrefixes( { "IR EWR" } )

DetectionSetGroup:FilterStart()

 

Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 )

 

-- Setup the A2A dispatcher, and initialize it.

A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )

 

-- Initialize the dispatcher, setting up a border zone. This is a polygon,

-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area.

-- Any enemy crossing this border will be engaged.

CapZone_East = ZONE_POLYGON:New( "CapZone East", GROUP:FindByName( "CapZone East" ) )

--A2ADispatcher:SetBorderZone( CCCPBorderZone )

 

-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly

-- without an assignment within 100km radius from a detected target, will engage that target.

A2ADispatcher:SetEngageRadius( 30)

 

 

A2ADispatcher:SetTacticalDisplay( true )

 

-- Test intercept.

A2ADispatcher:SetIntercept( 450 )

 

-- Setup the squadrons.

 

A2ADispatcher:SetSquadron( "Bandar Abbas Intl", AIRBASE.PersianGulf.Bandar_Abbas_Intl, { "BA DEF" },6 )

A2ADispatcher:SetSquadronGrouping( "Bandar Abbas Intl", 2 )

A2ADispatcher:SetSquadronGci( "Bandar Abbas Intl", 900, 1200 )

A2ADispatcher:SetSquadronTakeoffFromRunway( "Bandar Abbas Intl" )

A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Bandar Abbas Intl" )

 

A2ADispatcher:SetSquadron( "Havadarya", AIRBASE.PersianGulf.Havadarya, { "Havadarya Def" },6 )

A2ADispatcher:SetSquadronGrouping( "Havadarya", 2 )

A2ADispatcher:SetSquadronGci( "Havadarya", 800, 1200 )

A2ADispatcher:SetSquadronTakeoffFromRunway("Havadarya")

A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Havadarya" )

 

A2ADispatcher:Start()

 

 

 

Based on my test Bandar should have spawned its' bird as the intruder is much closer to it. Instaed Hav spawns.

 

 

 

 

Not sure if this is causing what your seeing.

Take a look at the description of the moose command your using....

 

 

A2ADispatcher:SetIntercept( 450 )

 

 

I think Moose attempts to determine where the target aircraft will be based on its speed and direction 450 seconds from when it was detected and then determines what base would then be best to launch from.

Link to comment
Share on other sites

Oh no kidding!!?? Where can I find what each variable means... It's probably in front of my face but I can't find it

[sIGPIC][/sIGPIC]

http://www.Vcw13.com

 

 

Asus Z270 Prime-A | i7-7700k | 32G Corsair Vengeance DDR4 3200 | EVGA RTX 2080ti | 2x 960 EVO M.2 in RAID 0 | 500GB SSD | Thrustmaster Warthog | Pimax 5K Plus

 

 

https://www.youtube.com/c/OverKillSims

Link to comment
Share on other sites

Hi Guys,

 

 

im complet new in LUA stuff so please forgive me my dump question:) I installed the LDT and Java, this works perfekt. And i start one of the Moose tutorial Missions YT videos. But i dont get this variable window like this

Intellisense.JPG

So maybe anyone can tell me how i activate this windows ?

thx and sorry for me englisch :)

 

 

***GOT IT***


Edited by Gandi
Link to comment
Share on other sites

So first off... Thank you to everyone who helped me out yesterday. I really appreciate it

 

Next, thing I'm trying to do is

 

1. Have my interceptors only spawn if other A2A fighters are detected

2. Create a message that will alert players that all the A2A assets at a specific location have been eliminated.

[sIGPIC][/sIGPIC]

http://www.Vcw13.com

 

 

Asus Z270 Prime-A | i7-7700k | 32G Corsair Vengeance DDR4 3200 | EVGA RTX 2080ti | 2x 960 EVO M.2 in RAID 0 | 500GB SSD | Thrustmaster Warthog | Pimax 5K Plus

 

 

https://www.youtube.com/c/OverKillSims

Link to comment
Share on other sites

How do you add an airbase in MOOSE?

 

Kish doesn't seem to be in the database.

 

--- These are all airbases of the Persion Gulf Map:

--

-- * AIRBASE.PersianGulf.Abu_Musa_Island_Airport

-- * AIRBASE.PersianGulf.Bandar_Abbas_Intl

-- * AIRBASE.PersianGulf.Bandar_Lengeh

-- * AIRBASE.PersianGulf.Al_Dhafra_AB

-- * AIRBASE.PersianGulf.Dubai_Intl

-- * AIRBASE.PersianGulf.Al_Maktoum_Intl

-- * AIRBASE.PersianGulf.Fujairah_Intl

-- * AIRBASE.PersianGulf.Tunb_Island_AFB

-- * AIRBASE.PersianGulf.Havadarya

-- * AIRBASE.PersianGulf.Khasab

-- * AIRBASE.PersianGulf.Lar_Airbase

-- * AIRBASE.PersianGulf.Al_Minhad_AB

-- * AIRBASE.PersianGulf.Qeshm_Island

-- * AIRBASE.PersianGulf.Sharjah_Intl

-- * AIRBASE.PersianGulf.Sirri_Island

-- * AIRBASE.PersianGulf.Tunb_Kochak

-- * AIRBASE.PersianGulf.Sir_Abu_Nuayr

-- * AIRBASE.PersianGulf.Kerman_Airport

-- * AIRBASE.PersianGulf.Shiraz_International_Airport

-- * AIRBASE.PersianGulf.Sas_Al_Nakheel_Airport

-- * AIRBASE.PersianGulf.Bandar-e-Jask_airfield

-- * AIRBASE.PersianGulf.Abu_Dhabi_International_Airport

-- * AIRBASE.PersianGulf.Al-Bateen_Airport

-- * AIRBASE.PersianGulf.Kish_International_Airport

-- * AIRBASE.PersianGulf.Al_Ain_International_Airport

-- * AIRBASE.PersianGulf.Lavan_Island_Airport

-- * AIRBASE.PersianGulf.Jiroft_Airport

-- @field PersianGulf

AIRBASE.PersianGulf = {

["Abu_Musa_Island_Airport"] = "Abu Musa Island Airport",

["Bandar_Abbas_Intl"] = "Bandar Abbas Intl",

["Bandar_Lengeh"] = "Bandar Lengeh",

["Al_Dhafra_AB"] = "Al Dhafra AB",

["Dubai_Intl"] = "Dubai Intl",

["Al_Maktoum_Intl"] = "Al Maktoum Intl",

["Fujairah_Intl"] = "Fujairah Intl",

["Tunb_Island_AFB"] = "Tunb Island AFB",

["Havadarya"] = "Havadarya",

["Khasab"] = "Khasab",

["Lar_Airbase"] = "Lar Airbase",

["Al_Minhad_AB"] = "Al Minhad AB",

["Qeshm_Island"] = "Qeshm Island",

["Sharjah_Intl"] = "Sharjah Intl",

["Sirri_Island"] = "Sirri Island",

["Tunb_Kochak"] = "Tunb Kochak",

["Sir_Abu_Nuayr"] = "Sir Abu Nuayr",

["Kerman_Airport"] = "Kerman Airport",

["Shiraz_International_Airport"] = "Shiraz International Airport",

["Sas_Al_Nakheel_Airport"] = "Sas Al Nakheel Airport",

["Bandar-e-Jask_airfield"] = "Bandar-e-Jask airfield",

["Abu_Dhabi_International_Airport"] = "Abu Dhabi International Airport",

["Al-Bateen_Airport"] = "Al-Bateen Airport",

["Kish_International_Airport"] = "Kish International Airport",

["Al_Ain_International_Airport"] = "Al Ain International Airport",

["Lavan_Island_Airport"] = "Lavan Island Airport",

["Jiroft_Airport"] = "Jiroft Airport",

}

[sIGPIC][/sIGPIC]

Primary Computer

ASUS Z390-P, i7-9700K CPU @ 5.0Ghz, 32GB Patriot Viper Steel DDR4 @ 3200Mhz, ZOTAC GeForce 1070 Ti AMP Extreme, Samsung 970 EVO M.2 NVMe drives (1Tb & 500 Gb), Windows 10 Professional, Thrustmaster Warthog HOTAS, Thrustmaster Warthog Stick, Thrustmaster Cougar Throttle, Cougar MFDs x3, Saitek Combat Rudder Pedals and TrackIR 5.

 

-={TAC}=-DCS Server

Gigabyte GA-Z68XP-UD3, i7-3770K CPU @ 3.90GHz, 32GB G.SKILL Ripjaws DDR3 @ 1600Mhz, ZOTAC GeForce® GTX 970.

Link to comment
Share on other sites

--- These are all airbases of the Persion Gulf Map:

--

-- * AIRBASE.PersianGulf.Abu_Musa_Island_Airport

-- * AIRBASE.PersianGulf.Bandar_Abbas_Intl

-- * AIRBASE.PersianGulf.Bandar_Lengeh

-- * AIRBASE.PersianGulf.Al_Dhafra_AB

-- * AIRBASE.PersianGulf.Dubai_Intl

-- * AIRBASE.PersianGulf.Al_Maktoum_Intl

-- * AIRBASE.PersianGulf.Fujairah_Intl

-- * AIRBASE.PersianGulf.Tunb_Island_AFB

-- * AIRBASE.PersianGulf.Havadarya

-- * AIRBASE.PersianGulf.Khasab

-- * AIRBASE.PersianGulf.Lar_Airbase

-- * AIRBASE.PersianGulf.Al_Minhad_AB

-- * AIRBASE.PersianGulf.Qeshm_Island

-- * AIRBASE.PersianGulf.Sharjah_Intl

-- * AIRBASE.PersianGulf.Sirri_Island

-- * AIRBASE.PersianGulf.Tunb_Kochak

-- * AIRBASE.PersianGulf.Sir_Abu_Nuayr

-- * AIRBASE.PersianGulf.Kerman_Airport

-- * AIRBASE.PersianGulf.Shiraz_International_Airport

-- * AIRBASE.PersianGulf.Sas_Al_Nakheel_Airport

-- * AIRBASE.PersianGulf.Bandar-e-Jask_airfield

-- * AIRBASE.PersianGulf.Abu_Dhabi_International_Airport

-- * AIRBASE.PersianGulf.Al-Bateen_Airport

-- * AIRBASE.PersianGulf.Kish_International_Airport

-- * AIRBASE.PersianGulf.Al_Ain_International_Airport

-- * AIRBASE.PersianGulf.Lavan_Island_Airport

-- * AIRBASE.PersianGulf.Jiroft_Airport

-- @field PersianGulf

AIRBASE.PersianGulf = {

["Abu_Musa_Island_Airport"] = "Abu Musa Island Airport",

["Bandar_Abbas_Intl"] = "Bandar Abbas Intl",

["Bandar_Lengeh"] = "Bandar Lengeh",

["Al_Dhafra_AB"] = "Al Dhafra AB",

["Dubai_Intl"] = "Dubai Intl",

["Al_Maktoum_Intl"] = "Al Maktoum Intl",

["Fujairah_Intl"] = "Fujairah Intl",

["Tunb_Island_AFB"] = "Tunb Island AFB",

["Havadarya"] = "Havadarya",

["Khasab"] = "Khasab",

["Lar_Airbase"] = "Lar Airbase",

["Al_Minhad_AB"] = "Al Minhad AB",

["Qeshm_Island"] = "Qeshm Island",

["Sharjah_Intl"] = "Sharjah Intl",

["Sirri_Island"] = "Sirri Island",

["Tunb_Kochak"] = "Tunb Kochak",

["Sir_Abu_Nuayr"] = "Sir Abu Nuayr",

["Kerman_Airport"] = "Kerman Airport",

["Shiraz_International_Airport"] = "Shiraz International Airport",

["Sas_Al_Nakheel_Airport"] = "Sas Al Nakheel Airport",

["Bandar-e-Jask_airfield"] = "Bandar-e-Jask airfield",

["Abu_Dhabi_International_Airport"] = "Abu Dhabi International Airport",

["Al-Bateen_Airport"] = "Al-Bateen Airport",

["Kish_International_Airport"] = "Kish International Airport",

["Al_Ain_International_Airport"] = "Al Ain International Airport",

["Lavan_Island_Airport"] = "Lavan Island Airport",

["Jiroft_Airport"] = "Jiroft Airport",

}

 

I don't have a few of those in mine. I just downloaded that latest version from the website last night... I don't get it.

[sIGPIC][/sIGPIC]

http://www.Vcw13.com

 

 

Asus Z270 Prime-A | i7-7700k | 32G Corsair Vengeance DDR4 3200 | EVGA RTX 2080ti | 2x 960 EVO M.2 in RAID 0 | 500GB SSD | Thrustmaster Warthog | Pimax 5K Plus

 

 

https://www.youtube.com/c/OverKillSims

Link to comment
Share on other sites

Ive got an air to air training mission for our group where I’m using an F10 menu with SpawnInZone to bring in a variety of air to air threats.

 

Is there a way to get the spawned aircraft to stay in the zone? I tried :PatrolZones() but that doesn’t keep them corralled.

 

I like the flexibility of SpawnInZone to move the spawn zone around with out moving/editing a bunch of waypoints or SearchEngageInZone (through advanced waypoints) but having the AI scatter isn’t ideal either.

 

Suggestions?

 

Edit to add - destroying those same units after they land....I’ve tried :InitCleanup(60) but it just respawns them back in the zone. How do I get them to disappear/destroy?


Edited by TonyG
Link to comment
Share on other sites

Correct syntax?

 

Question:

What is the correct syntax for using a function as a parameter to a function call... i.e.

 

 

EVENTHANDLER:HandleEvent(EventData, function)

 

 

How would one go about placing a function in that parameter list?

 

 

EDIT: I think I have it sorted out... the function does not require a name. i.e.

 

EVENTHANDLER:HandleEvent(EventData, function (EventData) ... end )

 

 

would that be the correct syntax?


Edited by A101Wayz

Wayz Out

 

 

Intel Core i9 9900K | ASUS ROG Strix Z390E Gaming MB | G.Skill Ripjaws V 32gb DDR4-3200 | GeForce RTX 2080 Ti | Samsung 970 EVO Plus NVMe

HTC Vive Pro VR | Logitech G x56 HOTAS | Logitech G PRO Pedals

Link to comment
Share on other sites

Is there a way to get the spawned aircraft to stay in the zone?

 

Suggestions?

 

How do I get them to disappear/destroy?

 

You could try getting a random point within the zone, then order the spawned aircraft to orbit around it (or to run a kind of circuit between the spawn point and the random point), for instance.

 

Here's how I'd script the orbit task:

 

 

local SpawnGroup = Group.getByName("name of the spawn group in ME")

 

local OrbitTask = {

id = 'Orbit',

params = {

pattern = -- Can be either "Race-Track" or "Circle",

point = initial vec2, -- If pattern is "Race-Track", then this is the initial point of the circuit. If pattern is "Circle", then this is the desired orbit point. Remember, it must be a 2D coordinate

point2 = destination vec2, -- If pattern is "Race-Track", then this is the destination point of the circuit. Remember, it must be a 2D coordinate

speed = -- speed in meters per second,

altitude = -- desired altitude in meters

}

}

SpawnGroup:getController():pushTask(OrbitTask)

 

 

 

Now, I guess you could combine that with a zone (from which you'd get the random point) and with :OnSpawnGroup().

 

Race-Track option:

 

 

local Zone = ZONE:New("name of the zone in ME")

 

local SpawnTemplate = SPAWN:New("name of the late activated group in ME")

:OnSpawnGroup(

function(SpawnedGroup)

 

local SpawnGroupLeaderPos = SpawnedGroup:GetDCSObject():getUnit(1):getPosition()

local SpawnGroupLeaderVec2 = { x = SpawnGroupLeaderPos.p.x, y = SpawnGroupLeaderPos.p.z } -- 2D coordinates of the group leader

 

local OrbitRaceTask = { id = 'Orbit', params = { pattern = "Race-Track", point = SpawnGroupLeaderVec2, point2 = Zone:GetRandomVec2(), speed = speed, altitude = altitude }}

SpawnedGroup:GetDCSObject():getController():pushTask(OrbitRaceTask)

 

end

)

:SpawnFromVec2(Zone:GetRandomVec2(),MinHeight,MaxHeight)

 

 

 

 

Circle option:

 

 

local Zone = ZONE:New("name of the zone in ME")

 

local SpawnTemplate = SPAWN:New("name of the late activated group in ME")

:OnSpawnGroup(

function(SpawnedGroup)

 

local RandomOrbitVec2 = Zone:GetRandomVec2()

 

local OrbitCircleTask = { id = 'Orbit', params = { pattern = "Circle", point = RandomOrbitVec2, point2 = RandomOrbitVec2, speed = speed, altitude = altitude }}

SpawnedGroup:GetDCSObject():getController():pushTask(OrbitCircleTask)

 

end

)

:SpawnFromVec2(Zone:GetRandomVec2(),MinHeight,MaxHeight)

 

 

 

 

I haven't tested this with spawned groups, might need tweaking and polishing... also, I'm guessing that this will interfere with normal AI behaviour/ME tasks.

 

 

As for unit destruction after landing, try adding this at the end of the :OnSpawnGroup() function:

 

local Event_Handler = {}

 

function Event_Handler:onEvent(Event) -- This will run every time an event happens

 

if Event.id == 4 -- Event id check. 4 = landing event

then

if Event.initiator == SpawnedGroup:GetDCSObject():getUnit(1) then -- If the unit that landed is the spawned group leader

SpawnedGroup:GetDCSObject():getUnit(1):destroy() -- Removes spawned group leader

end

 

elseif Event.initiator == SpawnedGroup:GetDCSObject():getUnit(2) then -- If the unit that landed is the spawned group wingman

SpawnedGroup:GetDCSObject():getUnit(2):destroy() -- Removes spawned group wingman

 

end

end

 

world.addEventHandler(Event_Handler) -- Creates a "universal" event handler

 

 

 

Link to comment
Share on other sites

EVENTHANDLER:HandleEvent(EventData, function (EventData) ... end )

 

would that be the correct syntax?

 

Yup, I think so.

 

 

When using the Intercept script how would I alert players that all available aircraft have been destroyed?

 

Include all available aircraft in a set and then perform an object count on dead events.

If the object count is less than 1, then send a message to all.

 

Here's an example:

 

local AvailableAircraftSET = SET_UNIT:New()

:FilterPrefixes(aircraft unit name prefixes in ME)

:FilterStart()

 

AvailableAircraftSET:HandleEvent(EVENTS.Dead)

 

function AvailableAircraftSET:OnEventDead(EventData)

 

if AvailableAircraftSET:Count() < 1 then

 

MESSAGE:New("All aircraft have been destroyed",10):ToAll()

end

end

 


Edited by Hardcard
Link to comment
Share on other sites

Is InitSkill(String) not functional in Moose? https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/Core.Spawn.html##(SPAWN).InitSkill

 

TRMiG23 = SPAWN:New("AIMiG23"):InitLimit(1,1):InitSkill("Average")

gives

attempt to call method 'InitSkill' (a nil value)

 

Hoping it's syntax.. :|

DCS World 2.5.x | F-14 | F/A-18C | AV-8B | AJS-37 | A10C | M-2000C | F-15C | MiG-21 | Hawk | FW190 | BF109K | Spitfire Mk. IX | P-51D | Gazelle | UH-1H | MI-8 | BS | CA | Persian Gulf | Normandy | NTTR

Win10-x64 | ASUS Strix Z270H Gaming | Intel i7-7700K | Gigabyte GeForce GTX 1080 Ti Gaming OC | Corsair Vengeance LPX 32 GB DDR4 | SSD Samsung 850 | TM Hotas Warthog | Saitek Pro Flight Pedals | Oculus Rift CV1

Link to comment
Share on other sites

Is InitSkill(String) not functional in Moose? https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/Core.Spawn.html##(SPAWN).InitSkill

 

TRMiG23 = SPAWN:New("AIMiG23"):InitLimit(1,1):InitSkill("Average")

gives

attempt to call method 'InitSkill' (a nil value)

 

Hoping it's syntax.. :|

 

 

This is where separating the method calls onto their own line will come in handy... I think you'll find that the problem isn't with InitSkill(), It's with InitLimit() - it seems to be returning a nil value. Since it's set for 1 and 1, try taking it out and see if that fixes the problem.

Wayz Out

 

 

Intel Core i9 9900K | ASUS ROG Strix Z390E Gaming MB | G.Skill Ripjaws V 32gb DDR4-3200 | GeForce RTX 2080 Ti | Samsung 970 EVO Plus NVMe

HTC Vive Pro VR | Logitech G x56 HOTAS | Logitech G PRO Pedals

Link to comment
Share on other sites

I think you'll find that the problem isn't with InitSkill(), It's with InitLimit() - it seems to be returning a nil value. Since it's set for 1 and 1, try taking it out and see if that fixes the problem.

 

:InitLimit(1,1) simply means "spawn 1 unit at a time, spawn it just the once", there's nothing wrong with it.

 

Again, I've tested it, the script worked fine for me, no errors (which means that the problem is probably elsewhere).

 

Same results with both versions:

 

[color="Blue"]-- SEPARATE LINES[/color]
Plane = SPAWN:New("Plane")
Plane:InitLimit(1,1)
Plane:InitSkill("Average")
Plane:Spawn()

[color="blue"]-- TRAIN WRECK[/color]
Plane = SPAWN:New("Plane"):InitLimit(1,1):InitSkill("Average")
Plane:Spawn()


Edited by Hardcard
Link to comment
Share on other sites

:InitLimit(1,1) simply means "spawn 1 unit at a time" and "spawn it just the once", there's nothing wrong with it.

 

Again, I've tested it, the script worked fine for me, no errors (which means that the problem is probably elsewhere).

 

 

It worked fine for me as well, and I copied and pasted the script. But the error stated that InitSkill() was a nil value, therefore InitSkill() isn't getting called. The error has to precede that call.

 

As you stated, the InitLimit(1,1) is valid... But, it's unnecessary. And that's the first thing I look at when debugging - taking out the unnecessary code/calls. I think that's a holdover from learning to program on 1Mhz CPUs with 4K of RAM. :-)

 

 

 

Without the mission file and full script to look at, that's all there is to go on ATM.


Edited by A101Wayz

Wayz Out

 

 

Intel Core i9 9900K | ASUS ROG Strix Z390E Gaming MB | G.Skill Ripjaws V 32gb DDR4-3200 | GeForce RTX 2080 Ti | Samsung 970 EVO Plus NVMe

HTC Vive Pro VR | Logitech G x56 HOTAS | Logitech G PRO Pedals

Link to comment
Share on other sites

It seems to be working fine on my end.

 

Thanks for the check guys, it was something as dumb as not using the latest version of Moose. Apparently my Moose.lua from 2018-04-24 had a problem with that function..

 

As you stated, the InitLimit(1,1) is valid... But, it's unnecessary.

 

I find it useful for my training missions/spawns using switched conditions. This way there is no chance of another AI plane to spawn accidentally as I want to be able to use the trigger zone unlimited times.

 

Sharing this small example anyways, the problem was setting the skill through the f10 menu :)

Not sure if it's actually makes a difference yet though, too useless in the tomcat to be sure yet ;)

 

Is there a way to get the skill from a Moose-spawned unit or group? AI.Skill?

F-14_dogfight.miz


Edited by Itzo
updated .miz, misunderstood 2nd argument of InitLimit - now (1,0).

DCS World 2.5.x | F-14 | F/A-18C | AV-8B | AJS-37 | A10C | M-2000C | F-15C | MiG-21 | Hawk | FW190 | BF109K | Spitfire Mk. IX | P-51D | Gazelle | UH-1H | MI-8 | BS | CA | Persian Gulf | Normandy | NTTR

Win10-x64 | ASUS Strix Z270H Gaming | Intel i7-7700K | Gigabyte GeForce GTX 1080 Ti Gaming OC | Corsair Vengeance LPX 32 GB DDR4 | SSD Samsung 850 | TM Hotas Warthog | Saitek Pro Flight Pedals | Oculus Rift CV1

Link to comment
Share on other sites

Can anyone tell me what I need to do to get the behaviour to respawn and return to their cap?

 

Try adding :InitCleanUp(), see what happens.

 

Btw, I don't think you should remove posts that contain interesting questions/problems, if you do, there will be no record left in the thread.

 

Imagine someone stumbles with the same problem next week... your post will be gone, along with the solution to the problem.

 

How did you solve it anyway?

Link to comment
Share on other sites

Hi all,

 

I'm trying to make a script with multiple scenarios of AI planes spawned via a command menu.

 

the idea is that the client could call the SCENARIO 1, then if he wants he can skip to SCENARIO 2.

 

The two scenarios have different plane groups and when he selects a new scenario the already spawned planes are removed (despawned) even if still alive or airborne.

 

I'm able to get the player select the scenario he wants and spawn the planes of various groups. If he selects the same Scenario the groups are reset, but groups spawned with another scenario are not removed (i.e. I'm not able to de-spawn the groups).

 

I think it is something related to the GROUP_FIND method, but I'm not sure how to achieve what I want...

 

here's my script so far.

 

local function SpawnScenario(scenarioID)

   GROUP:FindByName("GRP1-1"):Destroy()
   GROUP:FindByName("GRP1-2"):Destroy()
   GROUP:FindByName("GRP1-3"):Destroy()
   GROUP:FindByName("GRP2-1"):Destroy()

 if scenarioID == 1 then
   SPAWN:New( "GRP1-1" ):InitKeepUnitNames():Spawn() -- pair of MIG21
   SPAWN:New( "GRP1-2" ):InitKeepUnitNames():Spawn() -- single TU160
   SPAWN:New( "GRP1-3" ):InitKeepUnitNames():Spawn() -- three MIG29
 end
 
 if scenarioID == 2 then
   SPAWN:New( "GRP2-1" ):InitKeepUnitNames():Spawn() -- pair of Blue F15
 end

end

MenuCoalitionBlue = MENU_COALITION:New( coalition.side.BLUE, "Spawning Scenario" )
MenuCoalitionCommand = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Scenario 1", MenuCoalitionBlue,SpawnScenario, 1)
MenuCoalitionCommand = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Scenario 2", MenuCoalitionBlue,SpawnScenario, 2)
MenuCoalitionCommand = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Scenario 3", MenuCoalitionBlue,SpawnScenario, 3)

 

Thanks for help

AID_test.miz

aid_test.lua

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...