Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

My guess is your are defining the zones incorrectly. Should work and works in my missions.

 

here is the code:

 

SZ1=ZONE_POLYGON:New("SAM1",GROUP:FindByName("SAMZONE1"))

SZ2=ZONE_POLYGON:New("SAM2",GROUP:FindByName("SAMZONE2"))

SZ3=ZONE_POLYGON:New("SAM3",GROUP:FindByName("SAMZONE3"))

SAMZones={SZ1,SZ2,SZ3}

Spawn_SAM1=SPAWN:New("SA6"):InitLimit(6,10):InitRandomizeZones(SAMZones):SpawnScheduled(14400,0.5)

 

the randomization of the zones works as expected, but whatever zone gets chosen on start the location within the zone always seems to be on the same spot per zone. i even write down the coordinates and sure enough after a few restarts it spawns on the exact same corrdinates again. this is true for all 3 zones. could it be a coincidence?

Link to comment
Share on other sites

here is the code:

 

SZ1=ZONE_POLYGON:New("SAM1",GROUP:FindByName("SAMZONE1"))

SZ2=ZONE_POLYGON:New("SAM2",GROUP:FindByName("SAMZONE2"))

SZ3=ZONE_POLYGON:New("SAM3",GROUP:FindByName("SAMZONE3"))

SAMZones={SZ1,SZ2,SZ3}

Spawn_SAM1=SPAWN:New("SA6"):InitLimit(6,10):InitRandomizeZones(SAMZones):SpawnScheduled(14400,0.5)

 

the randomization of the zones works as expected, but whatever zone gets chosen on start the location within the zone always seems to be on the same spot per zone. i even write down the coordinates and sure enough after a few restarts it spawns on the exact same corrdinates again. this is true for all 3 zones. could it be a coincidence?

 

Very strange. Try it with a regular Spawn() and remove the SpawnScheduled. Somehow could be due to SpawnScheduled messing something up??!!

Link to comment
Share on other sites

Hi All

Any chance on getting some help on this. I've been trying to setup the Airboss with no luck. I did get the Tanker, Awacs and Rescue Helo to work but no recovery window, as well as the menu window operation in F10.

Any help would definitely be appreciated.

 

Here is the script I'm using for Creating the airboss.

 

local AirbossStennis=AIRBOSS:New("USS Eisenhower", "Eisenhower" )

local window1=AirbossStennis:AddRecoveryWindow( "10:30", "14:55", 1, nil, true)
local window2=AirbossStennis:AddRecoveryWindow("15:00", "20:55", 2, nil, false)
local window3=AirbossStennis:AddRecoveryWindow("21:00", "06:00+1", 3, nil, false)
---
AirbossStennis:SetSoundfilesFolder("Airboss Soundfiles/")
AirbossStennis:SetMenuSingleCarrier()
AirbossStennis:SetMenuRecovery(30, 20, true)
AirbossStennis:SetDespawnOnEngineShutdown()
AirbossStennis:Load()
AirbossStennis:SetAutoSave()
AirbossStennis:SetHandleAIOFF()
AirbossStennis:SetTrapSheet()
AirbossStennis:SetTACAN(57, "X", "IKE")
AirbossStennis:SetICLS(12, "IKE")
AirbossStennis:SetMarshalRadio(244, "AM")
AirbossStennis:SetLSORadio(266, "AM")
AirbossStennis:SetRadioRelayLSO("E-2D Wizard Group")
AirbossStennis:SetRadioRelayMarshal("Rescue Helo")
AirbossStennis:SetHandleAIOFF()
AirbossStennis:Start(15)

 

Thanks in advance


Edited by Wood

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 3 weeks later...

Hi Wood,

Airboss will tell you what it did with your recovery window in the dcs.log. Hit CTRL+F "recovery window" with the dcs.log open in a text editor and read through what it said. It will tell you something that will help you.


Edited by Pikey

___________________________________________________________________________

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

Link to comment
Share on other sites

is it possible to get ai ground units to transport troops using this script?

 

For example, I would like to be able to control an apc using Combined Arms, order it pick up troops, manually place a waypoint for the APC in the Tac commander slot (i.e. not use a predefined waypoint in the mission editor), and have the ability to decide when that vehicle unloads the troops (could be a random place. again, not a predefined trigger zone in the mission editor)

Modules owned:

 

FC3, M-2000C, Mig-21bis, F-5E, AJS-37 Viggen, F/A-18C, KA-50, Mi-8, F-14A&B, JF-17

Link to comment
Share on other sites

https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/AI.AI_Cargo.html

 

 

Cargo is not the strongest of MOOSE's modules, invariably something always breaking here, but on paper there is a lot of effort that has been done to it which does what you say and I've seen plenty of modules that do.

 

 

However, let me be outrageous and suggest a better alternative, CTLD. Yes, this is a moose thread, I have supported people for years using Moose but I would never tell someone to do something complex if I coudl get away with doing it simpler. Which means, for infantry, some behicles, CTLD is the best standalone way to accomplish that.

 

is it possible to get ai ground units to transport troops using this script?

 

For example, I would like to be able to control an apc using Combined Arms, order it pick up troops, manually place a waypoint for the APC in the Tac commander slot (i.e. not use a predefined waypoint in the mission editor), and have the ability to decide when that vehicle unloads the troops (could be a random place. again, not a predefined trigger zone in the mission editor)

___________________________________________________________________________

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

Link to comment
Share on other sites

Hi all,

 

I'm racking my brain on this and need some advice/help/slap in the face.

Basically, this airport should just go back and forth. The Blue A-10's will eliminate the red ground units, spawn a blue C130 which will fly over the airport and spawn blue units and red A-10's and the process will just rinse and repeat, all day, every day.

 

To do some troubleshooting, I took some code from the MOOSE DOC Missions and changed a few names to reflect my naming convention but the log file does not recognize that the C130's spawned.

 

On the game, the C130 has a name of C130_NORTHLASVEGAS_BLUE#001. I think this is what the problem is, so how do I dynamically grab these numbers?

 

Here's the code..

 

C130_NORTHLASVEGAS = ZONE:New("C130_NORTHLASVEGAS")

local C130_NORTHLASVEGAS_BLUE = GROUP:FindByName("C130_NORTHLASVEGAS_BLUE")
local C130_NORTHLASVEGAS_RED = GROUP:FindByName("C130_NORTHLASVEGAS_RED")

local Schedule, ScheduleID = SCHEDULER:New( nil,

   function (C130_NORTHLASVEGAS_BLUE, C130_NORTHLASVEGAS_RED)

       local IsAliveC130Blue = C130_NORTHLASVEGAS_BLUE:IsAlive()
       local IsAliveC130Red = C130_NORTHLASVEGAS_RED:IsAlive()
       
       BASE:E ( { IsAliveC130Blue = IsAliveC130Blue, IsAliveC130Red = IsAliveC130Red } )

    end, { C130_NORTHLASVEGAS_BLUE, C130_NORTHLASVEGAS_RED }, 1, 1
)

 

 

 

 

 

Logfile

 

 

2019-12-19 18:01:34.733 ERROR   wInfo: can't open Objects[AMERICANBOXWOOD] table
2019-12-19 18:01:34.743 INFO    SCRIPTING:  11912( 11814)/I:                      DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=0,[Group]=C130_NORTHLASVEGAS_BLUE#001,[Country]=2,[units]={[1]=C130_NORTHLASVEGAS_BLUE#001-01,},})
2019-12-19 18:01:34.744 INFO    SCRIPTING:  11723( 11825)/I:                      DATABASE00003.AddGroup({[1]=Add GROUP:,[2]=C130_NORTHLASVEGAS_BLUE#001,})
2019-12-19 18:01:34.744 INFO    SCRIPTING:  11401( 11827)/I:                      DATABASE00003.AddUnit({[1]=Add UNIT:,[2]=C130_NORTHLASVEGAS_BLUE#001-01,})
2019-12-19 18:01:34.943 INFO    SCRIPTING:     14(    -1)/E:                          BASE00000.function({[isAliveC130Red]=false,[isAliveC130Blue]=false,})
2019-12-19 18:01:41.147 WARNING LOG: 6 duplicate message(s) skipped.
2019-12-19 18:01:41.147 INFO    SCRIPTING:   5657(    -1)/I:            SCHEDULEDISPATCHER00002.function(<<<>New:26079 (C:\Users\bobbi\AppData\Local\Temp\DCS\/~mis00002012.lua))
2019-12-19 18:01:42.015 INFO    SCRIPTING:     14(    -1)/E:                          BASE00000.function({[isAliveC130Red]=false,[isAliveC130Blue]=false,})

Link to comment
Share on other sites

Is "C130_NORTHLASVEGAS_BLUE" and "..._RED" late activated in the ME?

If so, I don't see in your code snippet where they've actually been Spawn()

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

@egami

 

You might want to post the mission file + script + dcs.log

 

 

As for C130_NORTHLASVEGAS_BLUE#001, this indexing is done automatically by DCS every time a new group / unit with an already existing name spawns.

 

The rule of thumb here is to never use :FindByName() with late activated groups / units (at least in MOOSE).

 

In order to work with such groups / units, you'll need to either store each object on spawn or include it in a set afterwards.

 

:OnSpawnGroup() is your new friend, it will allow you to work with late activated groups / units.

 

 

Here is an example of my latest use of :OnSpawnGroup(). I store the group objects in a table and task them to attack me as soon as they spawn.

 


local Bandit_Table = {"Bandit_Tomcat_grp" , "Bandit_Hornet_grp", "Bandit_Eagle_grp", "Bandit_Viper_grp", "Bandit_Mirage_grp", "Bandit_Jeff_grp"}

local SpawnGroup_Table = {}

local RandomSpawnGroup = SPAWN:New(Bandit_Table[math.random(1,6)])
     :OnSpawnGroup(      [color="Blue"]-- It allows me to inject the function below[/color] 
     function(SpawnGroup)  [color="Blue"]-- SpawnGroup is the spawned group MOOSE object[/color]
        
        table.insert(SpawnGroup_Table, SpawnGroup) [color="Blue"]-- I insert the spawned group object in SpawnGroup_Table, for later use[/color]
        
        local Player_Attack = SpawnGroup:TaskAttackUnit(Client_Object,true) 
        
        SpawnGroup:PushTask(Player_Attack)
     end [color="blue"]-- end of the injected function[/color]
     ) [color="Blue"]-- close :OnSpawnGroup parenthesis[/color]

     RandomSpawnGroup:Spawn()


Edited by Hardcard
Link to comment
Share on other sites

MOOSE

 

What is MOOSE exactly? Is that something that has to be set up as a mod or can it run "out of the box"?

 

 

v6,

boNes

"Also, I would prefer a back seater over the extra gas any day. I would have 80 pounds of flesh to eat and a pair of glasses to start a fire." --F/A-18 Hornet pilot

Link to comment
Share on other sites

- Jack of many DCS modules, master of none.

- Personal wishlist: F-15A, F-4S Phantom II, JAS 39A Gripen, SAAB 35 Draken, F-104 Starfighter, Panavia Tornado IDS.

 

| Windows 11 | i5-12400 | 64Gb DDR4 | RTX 3080 | 2x M.2 | 27" 1440p | Rift CV1 | Thrustmaster Warthog HOTAS | MFG Crosswind pedals |

Link to comment
Share on other sites

OK, so it's for adding more realistic features or for facilitating mission writing/editing? If you download a MOOSE mission can you run it if you don't have MOOSE?

 

 

Thanks.

 

 

v6,

boNes

"Also, I would prefer a back seater over the extra gas any day. I would have 80 pounds of flesh to eat and a pair of glasses to start a fire." --F/A-18 Hornet pilot

Link to comment
Share on other sites

MOOSE is something you do not in any way have to worry or think about if you don't intend to do your own dynamic and/or highly interactive missions. It's a bunch of Lua tools — a script file — that the mission creator loads into the mission and calls upon to make various fancy things happen within that mission.

 

It is included in the mission file — it's not a mod or plugin or anything like that. It's simply a mission resource the same as voice-over or radio sounds, or localised text or briefing and kneeboard art. The .mis file (which is really just a zip file) contains it all for immediate use.

 

As an end-user of the mission, all you need to worry about is what nasty surprises the mission-creator has in store for you using those tools.

❧ ❧ Inside you are two wolves. One cannot land; the other shoots friendlies. You are a Goon. ❧ ❧

Link to comment
Share on other sites

What is MOOSE exactly?

 

It's a scripting framework, that facilitates the programming of advanced scripting that can be run within a DCS mission.

 

Is that something that has to be set up as a mod

 

No, it is not a Mod. It is added to a mission with the Mission Editor and it's stored within the MIZ file, so anyone using the mission does not need to concern with Moose; however the mission author does need to know how to use Moose.

 

or can it run "out of the box"?

 

Not really, as you do need to study a lot to learn how to make use of it and a computer programming background is helpful.

 

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

I would like to get this 64 bit environment working correctly,

Has anyone Had success recently..... ?

 

 

getting build errors after Finish of project setup "Moose_Framework"

 

Moose_Missions goes smooth

No Intel?

 

Maybe a better spot to ask?

 

maybe have something to do with Java's new policies ?

java started but produced exit code=13:joystick:

 

 

I am using NotePad++ (works great, but would like a intel environment)

 

 

Thanks Guys

 

Happy Holidays;)


Edited by Dispatch

~

Link to comment
Share on other sites

@Wrench

 

From what I've seen, MOOSE sets aren't always updated when using :FilterStart()

 

To work around this problem, I use :FilterOnce() instead, but that requires either placing the set variable inside a scheduler or inside functions that can be repeatedly called via F10 menu.

 

 

Aside from this, that snippet that you posted doesn't have a filter defined, I think that you need to specify the filtering method first... I normally use a prefix filter, works fine.


Edited by Hardcard
Link to comment
Share on other sites

Hi,

 

i have this case where I set a respawn and respawn on landing for 6 RECCE groups.

 

This is the code that works but it is not so smart

RespawnReaper1 = SPAWN:New('RECCE-REAPER #001'):InitLimit(1,1)
RespawnReaper2 = SPAWN:New('RECCE-REAPER #002'):InitLimit(1,1)
RespawnReaper3 = SPAWN:New('RECCE-REAPER #003'):InitLimit(1,1)
RespawnReaper4 = SPAWN:New('RECCE-REAPER #004'):InitLimit(1,1)

RespawnKiowa1 = SPAWN:New('RECCE-KIOWA #001'):InitLimit(1,1)
RespawnKiowa2 = SPAWN:New('RECCE-KIOWA #002'):InitLimit(1,1)



RespawnReaper1:InitRepeatOnLanding()
RespawnReaper1:InitDelayOff()

RespawnReaper2:InitRepeatOnLanding()
RespawnReaper2:InitDelayOff()

RespawnReaper3:InitRepeatOnLanding()
RespawnReaper3:InitDelayOff()

RespawnReaper4:InitRepeatOnLanding()
RespawnReaper4:InitDelayOff()

RespawnKiowa1:InitRepeatOnLanding()
RespawnKiowa1:InitDelayOff()

RespawnKiowa2:InitRepeatOnLanding()
RespawnKiowa2:InitDelayOff()


RespawnReaper1:SpawnScheduled(60,0)
RespawnReaper2:SpawnScheduled(60,0)
RespawnReaper3:SpawnScheduled(60,)
RespawnReaper4:SpawnScheduled(60,)

RespawnKiowa1:SpawnScheduled(60,0)
RespawnKiowa2:SpawnScheduled(60,0)

 

 

This is what I think would be smarter but I can't get it to work.

 


setRespawnRecce = SET_GROUP:New():FilterPrefixes('RECCE'):FilterCoalitions("blue"):FilterStart()

RespawnRecce = SPAWN:New(setRespawnRecce):InitLimit(6,6)

RespawnRecce:InitRepeatOnLanding()
RespawnRecce:InitDelayOff()

RespawnRecce:SpawnScheduled(30,0)

 

Can someone help me?

--

[sIGPIC][/sIGPIC]

36° Stormo Virtuale - Italian Virtual Flight Community

www.36stormovirtuale.net

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