Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

laumaya,

 

Absolutely possible.

 

Download the Moose sample missions, and you will find clear examples in "CGO - Cargo". The transport vehicle doesn't really matter, so if it's a Huey, Mi-8, or a ground vehicle they are interchangeable so long as it's a type that actually can carry people.

 

Thanks fargo.

 

I will try this :pilotfly:

Current specs: Windows 10 64bit, i7-7700K @ 4.8 Ghz, 32 GB RAM, 1 To SSD, RTX2070-Super, TrackIR 5, TM Warthog, TM T.Flight Rudder Pedals

Link to comment
Share on other sites

I agree and could reproduce this. I an debugging this to fix this issue.. It has to do with the detection logic not interpreting correctly the spawns. Now that we have a debugger it is easier to fix this.

 

Sent from my SM-N950F using Tapatalk

I am making progress on the issue... found the cause why the detections weren't propagated properly into the dispatcher.

 

Sent from my SM-N950F using Tapatalk

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

is there a way to spawn in static aircraft randomly at airfields?

 

could i place a 5 aircraft in their parking, make a template of all of them

move them to different parking,make another template

 

place 5 different aircraft in their parking, make a template of all of them

move them to different parking,make a template

 

then randomly spawn the templates?

 

or is there a way to randomly spawn static objects (aircraft) in parking slots to populate airfields

skunk160 | Win10 PRO 64bit | i7-4770K 3.50 GHz | 32GB DDR3/1866MHz | GIGABYTE GeForce GTX 1080 x2 | Oculus Rift S | Virpil MongoosT-50CM2 | Virpil F-14B grip | Virpil 200m Curved Extension | PointCTRL | Delta Sim TM Slew | Sim Bandit AHCP | MFG Crosswind Pedals | //FOX2 Switch Boxes | RECARO SPG Seat | AuraSound AST-2B-4 Pro Bass Transducer x2

//FOXTWO Multi-Role Combat Pit Build http://forums.eagle.ru/showthread.php?t=134745

Link to comment
Share on other sites

How may I get the coordinates of a drowed bomb/the impact of the bomb? Does it work with GetCoordinate?

 

I don't recall anything available for this in MOOSE and likely not available via DCS API either. Better to ask this as a general scripting question but my guess is this is not available at all at least not on the client scripting side of things.

Link to comment
Share on other sites

Thanks delta99!

So it seams impossible to get the distance between a bomb impact and a target on a shooting range!? What a pity

Tom, I had the same idea about a range recently and asked FC exactly this question. He said it would be difficult. Maybe it is even impossible, don't know...

 

When I thought about it longer, I encountered a deeper problem:

Usually at a range you have multiple targets (not only one). Then the question arises to which target you really want to measure the distance to?

 

For example, the bomb drops between two range objects. What is the distance you want to know? A priori, the script does not know at which target you were aiming! (Hope that makes sense to you.)

 

Finally, I wrote a script that only counts the number of actual hits. That's unambiguous.

 

For the distance, in case of a miss, I would resort to tacview as a graphical option. There you see how far away from the desired impact point the bombs drop.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Funkyfranky, I think I understand the problem.

But, there is a function that ist called " bomb in zone" or something like that in the mission editor. So, maybe to use something like zones around one target (0-5m, 5-10m, 10-15m....). When it's possible to detect a bomb inside a zone in the mission editor, why not in Moose?

BTW does somebody know how to create moving zones in Moose?

Link to comment
Share on other sites

But, there is a function that ist called " bomb in zone" or something like that in the mission editor. So, maybe to use something like zones around one target (0-5m, 5-10m, 10-15m....). When it's possible to detect a bomb inside a zone in the mission editor, why not in Moose?

Yes, that sounds promising. If there is a function like that in the ME, it should be possible in MOOSE as well. Maybe not easy and not implemented yet but very likely possible given all the things FC has done :)

BTW does somebody know how to create moving zones in Moose?

Have a look at ZONE_UNIT and ZONE_GROUP.

 

For example, a zone (radius 300 m) moving with group defined/named as "Group A" in the ME:

GroupA = GROUP:FindByName("Group A")
ZoneGA = ZONE_GROUP:New("Zone around group A", GroupA, 300)

(Writing this from the top of my head, so please check the exact syntax ;))

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

A long time ago. Bunnyjap made a precision bombing contest. He mesured it out via MIST and Lua script. I'm pretty shure!

My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 1TB Samsung EVO 970, RTX4080, Thrustmaster HOTAS WARTHOG + Saitek Pro Flight Pedals, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2

Link to comment
Share on other sites

A long time ago. Bunnyjap made a precision bombing contest. He mesured it out via MIST and Lua script. I'm pretty shure!

 

Yep, using default scripting functions mostly. Just run land.getIP really fast with information updated on the bombs current position and velocity vector. Whatever was the last known intersect point will be pretty damn close to where the bomb impacted. The FC3 mission Sukhoi Surprise should have a working example to work from.

 

Its always good to know what the scripting engine can and can't do. Mist, moose, etc don't add any functionality to the scripting engine. They just package functions/object oriented approaches to make aspects of it more practical.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Another older Noobie attempting to figure this stuff out, so bear with me. I have wathed the vids and read most of the docs. Questions nevertheless.

 

1. What is purpose/usage of Moose_Dynamic_Loader.lua and Moose_Static_Loader.lua, Moose_Create.lua? Are these install files the user should ignore?

 

2. What is usage and purpose of Moose_Update_Missions.bat?

 

3. Some of the code examples lack the do/end function. Does such a script work independently, or is it meant to be copy/pasted into other scripts?

 

4. Does Moose_.lua function exactly like Moose.lua only a smaller file with no comments?

 

I marvel at the effort required to develop and promote Moose, and the functionality it provides. Many thanks to FlightControl and others involved.

Link to comment
Share on other sites

1. What is purpose/usage of Moose_Dynamic_Loader.lua and Moose_Static_Loader.lua, Moose_Create.lua? Are these install files the user should ignore?

You can ignore those.

 

2. What is usage and purpose of Moose_Update_Missions.bat?

It puts the (updated) Moose.lua into the example mission files. So you can also safely ignore it.

 

3. Some of the code examples lack the do/end function. Does such a script work independently, or is it meant to be copy/pasted into other scripts?

Do/end is usually used to keep local variables defined just within that structure. I also don't know why exactly they are there sometimes and other times not.

 

4. Does Moose_.lua function exactly like Moose.lua only a smaller file with no comments?

Yes, the files do exactly the same. As you say, the Moose_.lua is just without any comments and blank lines. Makes it harder to read but a little lighter to load over the network.

 

Good questions! Keep asking :)

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

OK. First attempt at MOOSE has me blocked. Scenario: test mission Normandy theater. 4 (red) CAP groups positioned in ME, each with its own CAP zone. I wish to spawn 1 of the groups randomly, have it CAP in its associated zone and engage enemy (blue) when in specified range. Player should not know direction of attack, if any. Note that 1 of the groups is a null group that has no zone and will not engage. Code:

 

-- Habu: Nov 2017

-- Spawn randomly 1 of 3 CAP groups, or none, in patrol zones. Attack enemy at engagement range.


Templates = { 
   "3R_Cap #001", 
   "3R_Cap #002", 
   "3R_Cap #003", 
   "3R_Cap #004" 
   }                               -- Array of 4 potential CAP plane groups

Spawn_CAP = SPAWN:New( "3R_Cap" )
   :InitLimit( 1, 1 )
   :InitRandomizeTemplate(Templates)   -- Randomly spawn 1 plane template group

PatrolZoneN = ZONE:New( "Cap Zone N" )   -- Initialize 3 CAP zones
PatrolZoneS = ZONE:New( "Cap Zone S" )
PatrolZoneE = ZONE:New( "Cap Zone E" )

AICapZoneN = AI_CAP_ZONE:New( PatrolZoneN, 2500, 3000, 320, 380 )   -- CAP parameters
AICapZoneS = AI_CAP_ZONE:New( PatrolZoneS, 2500, 3000, 320, 380 )
AICapZoneE = AI_CAP_ZONE:New( PatrolZoneE, 2500, 3000, 320, 380 )

AICapZoneN:SetControllable( Spawn_CAP )   -- Assign Spawn_CAP to the CAP zones. Not sure about this.
AICapZoneS:SetControllable( Spawn_CAP )
AICapZoneE:SetControllable( Spawn_CAP )

AICapZoneN:SetEngageRange( 15000 )
AICapZoneS:SetEngageRange( 15000 ) 
AICapZoneE:SetEngageRange( 15000 )  -- Set the Engage Range to 15,000 meters.

AICapZone:__Start( 1 ) -- Startup after 1 sec., and start patrolling in the PatrolZone.

 

The mission spawns only the target blue aircraft. I suspect the primary issue is assigning the spawned CAP to its associated zone. Of course this may be only one of the problems. The template array might also be amiss. Mission file attached.

[ATTACH]172516[/ATTACH]

Link to comment
Share on other sites

OK. First attempt at MOOSE has me blocked. Scenario: test mission Normandy theater. 4 (red) CAP groups positioned in ME, each with its own CAP zone. I wish to spawn 1 of the groups randomly, have it CAP in its associated zone and engage enemy (blue) when in specified range. Player should not know direction of attack, if any. Note that 1 of the groups is a null group that has no zone and will not engage. Code:

 

-- Habu: Nov 2017

-- Spawn randomly 1 of 3 CAP groups, or none, in patrol zones. Attack enemy at engagement range.


Templates = { 
   "3R_Cap #001", 
   "3R_Cap #002", 
   "3R_Cap #003", 
   "3R_Cap #004" 
   }                               -- Array of 4 potential CAP plane groups

Spawn_CAP = SPAWN:New( "3R_Cap" )
   :InitLimit( 1, 1 )
   :InitRandomizeTemplate(Templates)   -- Randomly spawn 1 plane template group

PatrolZoneN = ZONE:New( "Cap Zone N" )   -- Initialize 3 CAP zones
PatrolZoneS = ZONE:New( "Cap Zone S" )
PatrolZoneE = ZONE:New( "Cap Zone E" )

AICapZoneN = AI_CAP_ZONE:New( PatrolZoneN, 2500, 3000, 320, 380 )   -- CAP parameters
AICapZoneS = AI_CAP_ZONE:New( PatrolZoneS, 2500, 3000, 320, 380 )
AICapZoneE = AI_CAP_ZONE:New( PatrolZoneE, 2500, 3000, 320, 380 )

AICapZoneN:SetControllable( Spawn_CAP )   -- Assign Spawn_CAP to the CAP zones. Not sure about this.
AICapZoneS:SetControllable( Spawn_CAP )
AICapZoneE:SetControllable( Spawn_CAP )

AICapZoneN:SetEngageRange( 15000 )
AICapZoneS:SetEngageRange( 15000 ) 
AICapZoneE:SetEngageRange( 15000 )  -- Set the Engage Range to 15,000 meters.

AICapZone:__Start( 1 ) -- Startup after 1 sec., and start patrolling in the PatrolZone.

 

The mission spawns only the target blue aircraft. I suspect the primary issue is assigning the spawned CAP to its associated zone. Of course this may be only one of the problems. The template array might also be amiss. Mission file attached.

[ATTACH]172516[/ATTACH]

 

Couple of things. First, you are not actually spawning the CAP group. You need Spawn_CAP:Spawn()

 

Second, I very highly doubt you can assign to all 3 zones. That will likely break things or only really work with the last zone.

 

Just saw a third thing. You are attempting to start a CAP Zone that doesn't even exist. You are issuing __Start() on a variable that is not defined.

 

What I would do if I were you is get this working with just one CAP zone and then think about where you want to take it once that works.

 

Also that NULL group (however you are defining that) will likely break things too. I would approach this a bit differently. I would have an array with 3 real groups defined and a NIL value. I would then randomly select a value from that array. If its NIL do nothing, otherwise continue with spawning the random one you picked.

 

Further, it depends on whether you are going to be playing with InitLimit here. If so, you need to take probably yet another approach and catch when the units are spawned and then attach them to the CAP ZONE etc.

Link to comment
Share on other sites

Hmmm. Tx for looking into this. Much to think about. Having a different CAP zone for each of the CAP groups seems to present a difficult scenario.

 

You will find with Moose that there are many ways to approach things.

 

For instance you might be looking for something that is more suited for AI-A2A-Dispatcher: http://flightcontrol-master.github.io/MOOSE/Documentation/AI_A2A_Dispatcher.html

Link to comment
Share on other sites

  • 2 weeks later...

I have refueling / fuel threshold behavior issues in the A2A Dispatcher with Moose 2.2.6 running the AID-016 AI_A2A - Refuel Tanker Test. I tried it in DCS 1.5.7 and in 2.1. The test miz won't trigger refuel no matter what I set with SetDefaultFuelThreshold or with SetSquadronFuelThreshold. The test mission sets .9 for the SU-34 and .8 for SU30. CAPs will continue until Bingo Fuel (Fuel = .1) and then head for tanker and refuel which is too late for my implementation. Other A2ADispatcher methods appear to work that I've tried so hopefully not an environment issue. Any help would be appreciated.

Link to comment
Share on other sites

I'm having trouble getting the FAC_AttackGroup task to work on MOOSE spawned objects. I've set up a simple mission to test where I have a JTAC group ("Spawn JTAC") and target group ("Spawn Target") and my aircraft. The JTAC and Target are set to late activation. The following code is set to run upon mission start:

 

Spawn_Target = SPAWN:New( "Spawn Target" )
SpawnTargetGroup = Spawn_Target:Spawn()

Spawn_JTAC = SPAWN:New( "Spawn JTAC" )
SpawnJTACGroup = Spawn_JTAC:Spawn()

function StartJTAC()
 local TargetGroupName = SpawnTargetGroup:GetName()
 local JTACGroupName = SpawnJTACGroup:GetName()
 local TargetGroup = Group.getByName(TargetGroupName)

 local JTACFACAction = {
   id= 'FAC_AttackGroup',
     params = {
     groupId = TargetGroup:getID(),
     datalink = true,
     frequency = 45000000,
     modulation = 1,
     callname = 15,
     number = 4,
    }
   }

 Group.getByName(JTACGroupName):getController():setCommand({id = 'EPLRS',params = {value = true, groupId = 9,}})
 Group.getByName(JTACGroupName):getController():setCommand({id = 'SetInvisible',params = {value = true}})
 Group.getByName(JTACGroupName):getController():setTask(JTACFACAction)
end

StartJTAC()

 

Everything seems to be working. The JTAC spawns, the Target spawns, and the JTAC menu shows up in my radio (at the proper callsign and frequency as specified above, there is no FAC tasking for the JTAC group in the editor to assign radio params). But when I request tasking, the JTAC never responds. I've tested the syntax on non-spawned entities (ie. kept everything the same except the units are present from mission start and not spawned in by scripting) and it works fine, JTAC responds and passes on a 9-line.

 

Any ideas why he's gone silent when spawned in?

 

EDIT: Just to get the obvious out of the way, I'm using simple radios so it's not a frequency issue, and here's the code I used without MOOSE that works:

 

JTACGroup = Group.getByName('JTAC')
TargetGroup = Group.getByName('Target')

function StartJTAC()

 local JTACFACAction = {
   id= 'FAC_AttackGroup',
     params = {
     groupId = TargetGroup:getID(),
     datalink = true,
     frequency = 45000000,
     modulation = 1,
     callname = 15,
     number = 4,
    }
   }

 JTACGroup:getController():setCommand({id = 'EPLRS',params = {value = true, groupId = 9,}})
 JTACGroup:getController():setCommand({id = 'SetInvisible',params = {value = true}})
 JTACGroup:getController():setTask(JTACFACAction)
end

StartJTAC()


Edited by Subferro
Link to comment
Share on other sites

Are you certain that those functions you are calling to get ids and names and such is actually returning what you want. You are mixing Moose and DCS API calls so unlikely you are getting what you expect. I think there is a way to get the DCSGroup using a Moose method so you should probably use that for everything. A DCSGroup != Moose group object.

 

I think there might be a one liner to do what you want though in Moose. Check some of the methods under CONTROLLABLE

 

I'm having trouble getting the FAC_AttackGroup task to work on MOOSE spawned objects. I've set up a simple mission to test where I have a JTAC group ("Spawn JTAC") and target group ("Spawn Target") and my aircraft. The JTAC and Target are set to late activation. The following code is set to run upon mission start:

 

Spawn_Target = SPAWN:New( "Spawn Target" )
SpawnTargetGroup = Spawn_Target:Spawn()

Spawn_JTAC = SPAWN:New( "Spawn JTAC" )
SpawnJTACGroup = Spawn_JTAC:Spawn()

function StartJTAC()
 local TargetGroupName = SpawnTargetGroup:GetName()
 local JTACGroupName = SpawnJTACGroup:GetName()
 local TargetGroup = Group.getByName(TargetGroupName)

 local JTACFACAction = {
   id= 'FAC_AttackGroup',
     params = {
     groupId = TargetGroup:getID(),
     datalink = true,
     frequency = 45000000,
     modulation = 1,
     callname = 15,
     number = 4,
    }
   }

 Group.getByName(JTACGroupName):getController():setCommand({id = 'EPLRS',params = {value = true, groupId = 9,}})
 Group.getByName(JTACGroupName):getController():setCommand({id = 'SetInvisible',params = {value = true}})
 Group.getByName(JTACGroupName):getController():setTask(JTACFACAction)
end

StartJTAC()

 

Everything seems to be working. The JTAC spawns, the Target spawns, and the JTAC menu shows up in my radio (at the proper callsign and frequency as specified above, there is no FAC tasking for the JTAC group in the editor to assign radio params). But when I request tasking, the JTAC never responds. I've tested the syntax on non-spawned entities (ie. kept everything the same except the units are present from mission start and not spawned in by scripting) and it works fine, JTAC responds and passes on a 9-line.

 

Any ideas why he's gone silent when spawned in?

 

EDIT: Just to get the obvious out of the way, I'm using simple radios so it's not a frequency issue, and here's the code I used without MOOSE that works:

 

JTACGroup = Group.getByName('JTAC')
TargetGroup = Group.getByName('Target')

function StartJTAC()

 local JTACFACAction = {
   id= 'FAC_AttackGroup',
     params = {
     groupId = TargetGroup:getID(),
     datalink = true,
     frequency = 45000000,
     modulation = 1,
     callname = 15,
     number = 4,
    }
   }

 JTACGroup:getController():setCommand({id = 'EPLRS',params = {value = true, groupId = 9,}})
 JTACGroup:getController():setCommand({id = 'SetInvisible',params = {value = true}})
 JTACGroup:getController():setTask(JTACFACAction)
end

StartJTAC()

Link to comment
Share on other sites

That's the only thing I can think of, but I think I'm at least getting the JTAC unit because the radio menu is populating. I've gotten the task syntax wrong and when that happens I don't see the radio menu. I would assume that if the problem was the target I would get at least a "No Further Tasking" message though?

 

EDIT: Just tried the following callbacks and got the same issue:

 

Spawn_Target = SPAWN:New( "Spawn Target" )
SpawnTargetGroup = Spawn_Target:Spawn()

Spawn_JTAC = SPAWN:New( "Spawn JTAC" )
SpawnJTACGroup = Spawn_JTAC:Spawn()

function StartJTAC()
 local JTACGroup = SpawnJTACGroup:GetDCSObject()
 local TargetGroup = SpawnTargetGroup:GetDCSObject()

 local JTACFACAction = {
   id= 'FAC_AttackGroup',
     params = {
     groupId = TargetGroup:getID(),
     datalink = true,
     frequency = 45000000,
     modulation = 1,
     callname = 15,
     number = 4,
    }
   }

 JTACGroup:getController():setCommand({id = 'EPLRS',params = {value = true, groupId = 9,}})
 JTACGroup:getController():setCommand({id = 'SetInvisible',params = {value = true}})
 JTACGroup:getController():setTask(JTACFACAction)
end

StartJTAC()


Edited by Subferro
Link to comment
Share on other sites

Hi, have an other problem.

I try to make some things with coordinates and points - want to create a new point to spawn a unit there. Try things like this

 

Tank = SPAWN:New( "TestUnit")

 

ZonePosition = ZONE:New( "Position" )

Koordinate = ZonePosition:GetVec3()

 

Tankx = Koordinate:GetX()

Tanky = Koordinate:GetY()

 

Koordinate2 = POINT_VEC3:New( Tankx, Tanky )

 

Tank:SpawnFromVec3( Koordinate2 )

 

I try this with Vec2 and Vec3. Nothing works

Need your help. Thanks

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