Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

weird. I went into trigggers and reloaded MIST, CTLD , MOOSE and the mission script and AI planes back to normal.

 

Hello sorry for the stupid question, but MIST MOOSE and CTLD can I stay in the same mission? Do not they create conflicts?

CPU i7 9700K@5ghz | COOLER Corsair H100x | MB Gigabyte Z390 Aorus Elite | RAM 32GB G.Skill Ripjaws V 3200mhz | GPU MSI RTX 3070 Ti Gaming X Trio | SSD OS Samsung M.2 860 EVO 250GB / SSD DCS 860 Evo 500GB| PSU Antec HCG 850W Gold | SO Win 10 pro 64bit | MONITORS LG 27GL850/BENQ GW2780 | PERIFERICHE GAMING TrackIR 5 | Thrustmaster Hotas Warthog | MFG Crosswind + combat pedals + hydraulic damper | TM MFD Cougar | Logitech DFGT

 

"Mai discutere con un idiota, ti trascina al suo livello e ti batte con l'esperienza" cit. Oscar Wilde

Link to comment
Share on other sites

Been trying to figure this for a couple of days and unable to determine whether the following is doable.

 

Spawn cargo static objects (e.g., uh1 cargo, container, ammo) that can be sling loaded, using similar methods to control total number of cargos available at once and redrawn or despawn in certain zones.

 

I can get this working with regular ground units, but not with statics.

Link to comment
Share on other sites

Has anyone tried using the newhornet LMAVs with the JTAC script? When I try, I find it impossible to do an uncage, while if I use the JTAC vanilla everything works perfectly.

 

EDIT: Sorry I saw that it is a bug reported, the MOOSE JTAC works fine, hopefully fix the mav with tomorrow's hotfix


Edited by Viper79

CPU i7 9700K@5ghz | COOLER Corsair H100x | MB Gigabyte Z390 Aorus Elite | RAM 32GB G.Skill Ripjaws V 3200mhz | GPU MSI RTX 3070 Ti Gaming X Trio | SSD OS Samsung M.2 860 EVO 250GB / SSD DCS 860 Evo 500GB| PSU Antec HCG 850W Gold | SO Win 10 pro 64bit | MONITORS LG 27GL850/BENQ GW2780 | PERIFERICHE GAMING TrackIR 5 | Thrustmaster Hotas Warthog | MFG Crosswind + combat pedals + hydraulic damper | TM MFD Cougar | Logitech DFGT

 

"Mai discutere con un idiota, ti trascina al suo livello e ti batte con l'esperienza" cit. Oscar Wilde

Link to comment
Share on other sites

Hi all,

 

I'm sorry if it's already answered, I didn't find anything here or at MOOSE web:

 

anyone knows how to get groups instead isolated aircrafts at GCI and CAP using GCICAP script? I using this code:

 

A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "RED EWR" }, { "enemigo" }, "invasion_FIR", { "CAP" }, 2, nil, nil, nil, 6 )

A2ADispatcher:SetDefaultOverhead( 1.5 )

A2ADispatcher:SetDefaultTakeoff( AI_A2A_Dispatcher.Takeoff.Cold )

A2ADispatcher:SetDefaultGrouping( 2 )

 

and I get individual aircraft groups

 

Thanks!

Link to comment
Share on other sites

Been trying to figure this for a couple of days and unable to determine whether the following is doable.

 

Spawn cargo static objects (e.g., uh1 cargo, container, ammo) that can be sling loaded, using similar methods to control total number of cargos available at once and redrawn or despawn in certain zones.

 

I can get this working with regular ground units, but not with statics.

 

 

It is doable, but a bit of work

METAR weather for DCS World missions

 

Guide to help out new DCS MOOSE Users -> HERE

Havoc Company Dedicated server info Connect IP: 94.23.215.203

SRS enabled - freqs - Main = 243, A2A = 244, A2G = 245

Please contact me HERE if you have any server feedback or METAR issues/requests

Link to comment
Share on other sites

It is doable, but a bit of work

 

I got it working with CTLD instead. Silly to be using only piece parts of both, but it works.

 

Now I'm trying to do schedule spawning based on active player count. I set a scheduler up to count the number of clients every 2 minutes and reset a flag value. The I have a switched condition calling the spawn scheduler every time that flag has been reset.

 

Is there a better way to do this? If I call the same spawn scheduler with different values for max number of units, will I run into a lot of problems?

 

Ultimately, I want infinite waves of fighters equal to two times the number of connected clients. But I also want to have a "wait" timer between successive waves. So, scheduler is set to spawn them about 30 seconds apart, but I think I need another flag to kick off player count after a given fighter group has been destroyed.

 

 

--- ETA: thought up something different. Run player count every X minutes. Check how many fighter groups are present, and spawn a corresponding number of new groups to fill whatever shortfall (e.g., if two players -> 4 fighter groups, and 1 fighter group is still active, then spawn 3 fighter groups). If no shortfall, spawn 1 additional fighter group.

 

Here's my code, currently not working for probably a variety of reasons. Need help with syntax on tallying how many groups are active as well as guidance on whether the spawn for loop would work correctly:

 

 

local clientTbl = {

'Client #002',

'Client #003',

'Client #004',

'Client #005',

'Client #006',

'Client #007',

'Client #008',

'Client #009',

'Client #010',

'Client #019',

'Client #020'

}

 

local F5Tbl = {

'F5 #001',

'F5 #002',

'F5 #003',

'F5 #004',

'F5 #005'

}

 

CountScheduler = SCHEDULER:New( nil, function()

 

local count = 0

for i = 1, #clientTbl do

if Unit.getByName(clientTbl) then

count = count + 1

end

end

 

 

local F5count = 0

for j = 1, #F5Tbl do

if Group.getByName(F5Tbl[j]) then

F5count = F5count + 1

end

end

 

local msg = {}

msg.text = count..' players online'

msg.displayTime = 15

msg.msgFor = { coa = {'all'}}

mist.message.add(msg)

 

local msgF5 = {}

msgF5.text = F5count..' F5 Groups Active'

msgF5.displayTime = 15

msgF5.msgFor = { coa = {'all'}}

mist.message.add(msgF5)

 

if F5count < count then

for k = 1, (count - F5count) do

F5 = SPAWN:New("F5")

end

end

 

end, {}, 5, 5, 0.1)

 

 

 

 

Occurring every 5 seconds is intentional for testing purposes. Right now, it gets through the messages and then chokes on the for loop to spawn new F5 groups. Not sure what's wrong there. I also tried putting all of this sans the spawn loop in a .lua file and running it as a script file, and the mission wasn't having any of that either.


Edited by Dino Might
Link to comment
Share on other sites

I don't think the tables should be local.

 

Are those values being carried down?

 

Also, what's it reading, the group or unit name to arrive at 'Client #002' ?

 

 

It's reading through the list of unit names in the table and counting how many are active to get a player count. This works, at least in my testing in single player. The F5 group count also works. All the clients are set to have unit names of Client #XXX in the ME.

 

 

It breaks down at the spawn script portion, and that prevents it from repeating. When I comment out the spawn portion, it correctly counts and displays the appropriate messages every 5 seconds.

 

My understanding is that local variables are accessible to the entire script. I may be wrong.


Edited by Dino Might
Link to comment
Share on other sites

They are not accessible to the entire script by default. It depends a lot on how it's written. Local variables are local to the code block, not the entire script.

 

My next move would be to examine and debug the Client portion of this. This, since you are reporting that there's a difference between SP and MP.

 

e.g.

 

if Unit.getByName(clientTbl) then

(message or log out some debugging input as to what it received)

end

 

Another point is that in the loop, you are repeatedly calling the same declaration.

 

F5 = SPAWN:New("F5")

 

This isn't going to give you (n) of them. You'll only get one since you're reassigning the same var each time in the loop.

 

In the loop, you could do something like:

 

F5name = "F5" .. k

F5name = SPAWN:New("F5")

 

So you don't keep overwriting/reassigning the same variable name.

 

Banner EDForum2020.jpg

Have fun. Don't suck. Kill bad guys. 👍

https://discord.gg/blacksharkden/

Link to comment
Share on other sites

Possibly dumb question but if I already have Moose how do I upgrade to the latest version? When I go to the github page with the latest download the “Moose.lua” file linked is very limited in contents (like maybe 20 lines), so I downloaded the whole source code zip, copied it to the same directory and overwrote existing files. Seemed to work, but then there are commands that don’t have intellisense. Is there a way to update my eclipse intellisense or do some newer commands just not have that yet?

Link to comment
Share on other sites

Here's the revised script, now working. I forgot that defining the variable for spawn does not actually spawn the aircraft (unless you are putting it in scheduler). This now works like a charm.

 

 

clientTbl = {

'Client #002',

'Client #003',

'Client #004',

'Client #005',

'Client #006',

'Client #007',

'Client #008',

'Client #009',

'Client #010',

'Client #019',

'Client #020'

}

 

F5Tbl = {

'F5#001',

'F5#002',

'F5#003',

'F5#004',

'F5#005'

}

 

F5 = SPAWN:New("F5")

 

CountScheduler = SCHEDULER:New( nil, function()

 

count = 0

for i = 1, #clientTbl do

if Unit.getByName(clientTbl) then

count = count + 1

end

end

 

F5count = 0

for j = 1, #F5Tbl do

if Group.getByName(F5Tbl[j]) then

F5count = F5count + 1

end

end

 

local msg = {}

msg.text = count..' players online'

msg.displayTime = 15

msg.msgFor = { coa = {'all'}}

mist.message.add(msg)

 

local msgF5 = {}

msgF5.text = F5count..' F5 Groups Active'

msgF5.displayTime = 15

msgF5.msgFor = { coa = {'all'}}

mist.message.add(msgF5)

 

if F5count < count then

for k = 1, (count - F5count) do

F5:Spawn()

end

end

 

end, {}, 5, 10, 0.1)

 

 

 

My plan is to set the scheduler player/AI count checks every 5-6 minutes, and then respawn the difference in aircraft at that time. This does a few things:

1) updates the number of AI aircraft to accommodate new players who have joined

2) prevents immediate spawning of replacement AI in accordance with set timer

3) maintains the AI number cap that the normal spawn scheduler does (that this script does not take advantage of)

 

 

Thanks for the help, Fargo!

Link to comment
Share on other sites

Possibly dumb question but if I already have Moose how do I upgrade to the latest version? When I go to the github page with the latest download the “Moose.lua” file linked is very limited in contents (like maybe 20 lines), so I downloaded the whole source code zip, copied it to the same directory and overwrote existing files. Seemed to work, but then there are commands that don’t have intellisense. Is there a way to update my eclipse intellisense or do some newer commands just not have that yet?

 

Usually people sync using GitHub desktop or something like that but downloading the entire .zip source code is alright too. Usually you need to hit F5 in Eclipse to update. Or close the LDT and reload it. I find that one minute intellisense can work properly and the next it doesn't. F5 to update or close and reopen usually fixes things.

 

You shouldn't need to do much else if it worked previously.

Link to comment
Share on other sites

Very cool Dino Might!

 

It occurs - Maybe a SET_CLIENT would be a cleaner way to come at this. A client set is updated automatically.

 

SET_CLIENT:FilterActive(Active)

 

start the filter:

 

SET_CLIENT:_FilterStart()

 

Then you can step through the alive clients with a user-defined function and do whatever you want.

 

SET_CLIENT:ForEachClient(IteratorFunction, ...)

 

Hey it's a two way street. I got some good ideas from looking at what you are up to here as well.

 

Banner EDForum2020.jpg

Have fun. Don't suck. Kill bad guys. 👍

https://discord.gg/blacksharkden/

Link to comment
Share on other sites

Found an error in the way I set up my code in our testing session tonight.

Spawning groups through Moose assigns a new number to the group name without reusing numbers.

 

 

So, we start with F5#001, F5#002, etc. and eventually get to F5#006 instead of recycling to F5#001 (well after that group was destroyed). Then the count function stops working as intended, because the existing units are outside the table. I figured this all out around the time I clicked on a unit in F10 and saw "F5#076."

 

 

I was thinking of two options, both of which I do not know how to do:

1) Count function goes through all active groups and checks if group name is "F5" .. * (wildcard). If yes, then add to count.

2) F5 spawn function forces newly spawned unit to take relinquished name from the table.

 

 

I think the first option makes more sense, but I'm not sure if it's doable and how to do it. I have been pouring through the wiki trying to find how to input wildcards, to no avail.

 

By the way, this error did make tonight's test pretty fun. SM-2s flying through the air on final approach, CIWS going off right overhead as we're catching wires. MiGs strafing statics and players on the carrier. It was nuts. Then, someone hops on as GCI and says "You have a 10-ship coming at you, 000 for 15 miles. And another 10 or so behind that. good luck." :doh:


Edited by Dino Might
Link to comment
Share on other sites

Yes, I have looked at those, but with the Spawn scheduler, the periodicity value sets the time between spawns for each group. I would like to set a time between spawns for all groups that will spawn.

 

 

For example, I want spawns to occur every 4 minutes. If player numbers dictate that 3 new groups should spawn when the timer ticks over, then I want all 3 of those groups spawning at once.

 

With spawn scheduler, if I schedule spawn every 4 minutes for that group, one of those groups will spawn every 4 minutes, up to the limit. Is there a way to tell the spawn scheduler to spawn multiple copies of the same group? My issue is that spawn scheduler is supposed to be called once, and then left alone. I would need to be updating the number of groups to spawn every time the scheduler initiates a spawn.

 

I could set a spawn scheduler for each group and turn the schedulers on and off depending on player count, but I rather prefer the wildcard solution if it's possible, in part because it will be useful for other things I'm going to want to do.

 

 

Ultimately, I need a robust way to count all groups of a certain type.


Edited by Dino Might
Link to comment
Share on other sites

You can set the limit with :initLimit(n,n), use a SpawnScheduler(2400,1) and STILL spawn that group manually in between with :Spawn().

 

Another possible way to handle this is to take a count of the alive groups by defining another SET_GROUP with a filter based on that groups name and use the iterator function to collect a count.

 

Then compare the count of alive clients to alive groups and spawn according to the desired ratio.

 

Or, you could put the entire declaration of the enemy (and the numbers in :InitLimit(n,n) ) inside your loop so you are defining what n, and n are based on your counts of clients and then let the SpawnScheduler populate the enemies accordingly.

 

The existing ones may disappear and reappear somewhere else though. Not sure how that behavior will shake out but it may work for you.

 

Banner EDForum2020.jpg

Have fun. Don't suck. Kill bad guys. 👍

https://discord.gg/blacksharkden/

Link to comment
Share on other sites

I'd go the SET_GROUP + iterator way too (combining it with checks and flags, in order to manage scheduler activation, specific number of units to spawn, and all that stuff).

 

If you haven't already, join the MOOSE Discord channel. People over there will help you crack this, ask the MOOSE contributors over there (Pikes and funkyfranky should be able to help you with this)


Edited by Hardcard
Link to comment
Share on other sites

Just joined the Discord.

 

Recoded to use SET_CLIENT and SET_GROUP, but I bet I'm missing some very simple syntax that is breaking my script before it even starts. I threw in a bunch of debug messages so I could see where it breaks, and apparently:

clients = SET_CLIENT:New()

:FilterActive()

:FilterStart()

the first block is causing a hiccough. Posted in Discord, but throwing it up here because I'm sitting here questioning my sanity for the past hour messing with this.

 

Thank you guys for the SET suggestion though - looks to be exactly what I've been trying to find.

 

 

Pikes on Discord hooked me up - turns out I had an outdated version of MOOSE, and he cleaned up my code a lot. It's now working perfectly!

-- SET DYNAMIC GROUP LISTING

 

clients = SET_CLIENT:New()

:FilterActive()

:FilterStart()

 

F5_active = SET_GROUP:New()

:FilterPrefixes("F5")

:FilterActive()

:FilterStart()

 

MiG_29_active = SET_GROUP:New()

:FilterPrefixes("MiG_29")

:FilterActive()

:FilterStart()

 

Anti_Ship = SET_GROUP:New()

:FilterPrefixes("Anti_Ship")

:FilterActive()

:FilterStart()

 

-- SET SPAWN GROUP DEFINITIONS

F5 = SPAWN:New("F5")

MiG_29 = SPAWN:New("MiG_29")

AS = SPAWN:New("Anti_Ship")

 

 

 

CountScheduler = SCHEDULER:New( nil, function()

 

num_clients = clients:Count()

num_F5 = F5_active:Count()

num_29 = MiG_29_active:Count()

num_as = Anti_Ship:Count()

env.info("Count of clients is " .. num_clients)

 

local msgClients = {}

msgClients.text = num_clients..' Clients Active \n'..

num_F5..' F5 Groups Active \n'..

num_29..' MiG 29 Groups Active \n'..

num_as..' Anti-Ship Groups Active'

msgClients.displayTime = 15

msgClients.msgFor = { coa = {'all'}}

mist.message.add(msgClients)

 

if num_F5 < num_clients then

for k = 1, (num_clients - num_F5) do

F5:Spawn()

end

end

 

if (num_29*2) < num_clients then

for k = 1, (num_clients - num_29*2) do

MiG_29:Spawn()

end

end

 

end, {}, 240, 240, 0.1)


Edited by Dino Might
Link to comment
Share on other sites

Hi @all...

 

WoW...i dont know where to start...i try to get into MOOSE aswell.

Its so awesome what we can do with it. Makes DCS such a better game.

But for ppl with no coding experience it can be quite a huzzle to get the head around this.

 

I already got some simple A2G and A2A tasking up and running wich i am currently testing and playing around with values and things.

 

Now got to a point where i could use some help of some experts, wich leads me to my first problem.

 

No matter what i try "Eclipse LDT" wont start on my system. I tryed all Fixes/Solutions i could find on google but with no success.

Really would like to have "Intelli sense" funktion.

 

I got "Eclipse Photon" running with no problems but it seems not to have the Intelli Sense funktion so i rather stick with notepad++ for now.

Or i just set it up the wrong way, i dont know its all so complicated.

 

Maybe someone can help?

 

0/

Link to comment
Share on other sites

@Skippa

 

I had a similar issue with LDT some months back.

If I remember correctly, I solved it by doing this:

 

-Uninstall Java using this tool

 

-Remove all traces of any previous LDT installations from your system

 

-Download/Install Java 8 from here

 

-Use this LDT build

 

-Then simply follow the rest of instructions from

 

PS. I'm assuming you have a 64bit version of Windows, btw.


Edited by Hardcard
Link to comment
Share on other sites

Hi all.

 

I have a question/problem with a mission i created.

 

I created a WWII intercept mission where players and AI work together as interceptors.

I have a working GCICAP script. I setup A2ADispatcher:SetSquadronOverhead and A2ADispatcher:SetSquadronGrouping so that there is not a 1 on 1 but lesser GCI plane spawn. This way the human players can fill the gap.

This script works great.

 

Now for the problem.

When the enemy bombers are in range, the script spawns the GCI planes and they take off.

After take off all the GCI planes go after 1 enemy plane till it gets shot down. Wich results that the rest of the bombers follow the route without getting intercepted only till the first plane get shot down. then it all repeats for the second plane.

 

Am i doing something wrong? or is this a flaw within DCS/Moose?

 

I tought that the spawned GCI planes would go after different targets and not all after one target.

 

Is there a solution for this?

 

Greetings Naj-Treg

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