Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Anybody using CONTROLLABLE:EnRouteTaskEngageUnit()?

 

Because I am reworking that API.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Event Handling in Mission Object Oriented Scripting Framework

 

Find this new playlist that will contain videos explaining how to process the different DCS events within your moose objects created in your missions.

 

Various examples are created going through the scripting mechanism how to subscribe to the different events, and how to handle the different events within your objects when they occur.

 

The first video is an overview video of event handling in MOOSE, and explains some of the mechanisms and components that are created.

 

Hope you like the videos and would really, really like some feedback on this mechanisms from the community.

 

 

FC!

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Example of Event Handling

 

If you want to try out some of these missions yourselve, have a look here:

 

https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Test%20Missions/EVT%20-%20Event%20Handling

 

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Realistic Detection?

 

Guys, let discuss some additional filters that could contribute to make detection more "realistic".

 

The first is DistanceProbability for visual detection only. The further the target is from the detector, the less likely it will be that it gets detected, right? Why this factor? I found that FAC, and JTAC have incredible eyes. Even with binoculars or de-interference zoomers, the speed and accuracy of detection is phenomenal in DCS World. The are able to detect targets with one second that is 10 km away, including type information. That is why this additional probability factor comes in. Specify a %-tage probability that if a target is detected at 10km distance, that it really would get detected...

 

The second is HeightProbability. The higher the detector is located, the more likely it can detect targets. I found that JTACS are able to detect targets 10 km away within seconds when on the ground. Bullshit. There are always some clutter objects in between. Also, targets will likely hide behind clutter and camouflage...

 

The third is Foggy Zones... A ZoneProbability. In DCS World, trees, buildings are not accounted for in DCS World forum LOS calculation. With *ZoneProbability*, the mission designer can define zones where detection will be very difficult. Each zone can be given a probability factor. An array of zones with probability factor will be accepted. Of course, the more zones, the more CPU overhead, so this is to be used for very specific detection scenarios.

 

Now, my question, ... Are there other probabilities that need to be taken into account for visual detection....

 

And are there any probabilities that need to be added for radar, ir, drink etc detections???

 

Fc

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hi, I just wanted to say I'm messing around with MOOSE again and I will say it again, its amazing.

 

Especially the ZONE_POLYGON is a game changer for me. Its great.

 

Slowly I'm learning how to use more and more classes.

 

OH, how can I make a gorund group to make a loop with waypoints to create a patrol? I don't know which class I need to use it looks like all the patrol classes are for air groups.

 

thanks.


Edited by Ignition
Link to comment
Share on other sites

hi FC. I have another question.

 

I always use the your scripting system known MOOSE for my multiplay mission.

everyday thanks a lot.

 

someday I built Live Firing Range.

but I cant find method for make smoke where in the zone.

 

In Moose, have just Vec3 - Smoke.

But RandomPointInZone only exist for Vec2.

 

How to do?

I want pop smoke to random point in the zone.

 

Can I?

Thank a lot!

Link to comment
Share on other sites

Edit resources with Moose

 

Hello, I am trying to use the Moose Framework as follows:

 

- I edit the resources of the blue airport and leave only with an available aircraft, then I change the faction to red.

 

My question is this:

 

When the mission starts, a Lua code creates a spawn of this airplane to empty the resources of the airport in question. Afterwards I would like to remove it or destroy for when the Blue Coalition troops take the airport, another warehouse will supply this airport with the missing aircraft. Can I use Cleanup?

 

Thanks! :D

Link to comment
Share on other sites

I always use the your scripting system known MOOSE for my multiplay mission.

everyday thanks a lot.

 

someday I built Live Firing Range.

but I cant find method for make smoke where in the zone.

 

In Moose, have just Vec3 - Smoke.

But RandomPointInZone only exist for Vec2.

 

How to do?

I want pop smoke to random point in the zone.

 

Can I?

Thank a lot!

 

Done some homework for you ...

 

Sync your moose repository on GITHUB.

The following functions have been added:

 

2017-02-08 - Reworked some vector functions.

-- POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) added.

-- ZONE_RADIUS:GetRandomPointVec2( inner, outer ) added.

-- ZONE_RADIUS:GetRandomPointVec3( inner, outer ) added.

-- ZONE_POLYGON_BASE:GetRandomPointVec2() added.

-- ZONE_POLYGON_BASE:GetRandomPointVec3() added.

 

I think this should help you forward!

 

The following additional demonstration missions have been created, that

demonstrate the use of the above methods for each ZONE class:

 

- ZON-101 - Normal Zone - Random Point

- ZON-201 - Group Zone - Random Point

- ZON-301 - Unit Zone - Random Point

- ZON-401 - Radius Zone - Random Point

- ZON-501 - Polygon Zone - Random Point

 

Looking forward of your feedback.

 

Fc

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hi, I just wanted to say I'm messing around with MOOSE again and I will say it again, its amazing.

 

Especially the ZONE_POLYGON is a game changer for me. Its great.

 

Slowly I'm learning how to use more and more classes.

 

OH, how can I make a gorund group to make a loop with waypoints to create a patrol? I don't know which class I need to use it looks like all the patrol classes are for air groups.

 

thanks.

 

You need the group class to do that. I'll see if I can come up with an example.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hello, I am trying to use the Moose Framework as follows:

 

- I edit the resources of the blue airport and leave only with an available aircraft, then I change the faction to red.

 

My question is this:

 

When the mission starts, a Lua code creates a spawn of this airplane to empty the resources of the airport in question. Afterwards I would like to remove it or destroy for when the Blue Coalition troops take the airport, another warehouse will supply this airport with the missing aircraft. Can I use Cleanup?

 

Thanks! :D

 

Well...

 

I had to read your sentence a couple of times ...

I think i understand it now, let me rephrase it:

 

1. You changed the resource plan of an airbase. Only one airplane left.

2. You spawn that airplane, so the resources of the airbase are empty now.

3. You want to destroy that airplane when the airbase is captured...

 

Okay ...

 

First question: how do you spawn the airplane... If you use the MOOSE code:

 

-- Create a SPAWN object, that allows to spawn the airplane.
AirplaneSpawn = SPAWN:New( "Airplane" )

-- Spawn the airplane, and store the resulting airplane in a GROUP object.
AirplaneGroup = AirplaneSpawn:Spawn()

-- Now, AirplaneGroup holds the airplane.

....

 

 

-- Somewhere further in your logic or trigger (DO SCRIPT), you can code:
AirplaneGroup:Destroy()

-- This will destroy that AirplaneGroup airplane object from your simulation.

Hope it helps,

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Well...

 

I had to read your sentence a couple of times ...

I think i understand it now, let me rephrase it:

 

1. You changed the resource plan of an airbase. Only one airplane left.

2. You spawn that airplane, so the resources of the airbase are empty now.

3. You want to destroy that airplane when the airbase is captured...

 

Okay ...

 

First question: how do you spawn the airplane... If you use the MOOSE code:

 

-- Create a SPAWN object, that allows to spawn the airplane.
AirplaneSpawn = SPAWN:New( "Airplane" )

-- Spawn the airplane, and store the resulting airplane in a GROUP object.
AirplaneGroup = AirplaneSpawn:Spawn()

-- Now, AirplaneGroup holds the airplane.

....

 

 

-- Somewhere further in your logic or trigger (DO SCRIPT), you can code:
AirplaneGroup:Destroy()

-- This will destroy that AirplaneGroup airplane object from your simulation.

Hope it helps,

FC

 

 

As English is not my native language, sometimes it is difficult for people to understand, since I use google translator :D I will carry out the tests here, thank you!

Link to comment
Share on other sites

AI CAP Question of Spawned MiG

 

Thanks FC why reply to every my poor question. Really Thank a lot! :thumbup:

Can I ask to you more? sorry to my many question and not good english.

 

Now, I make the "Within Visual Range Air Combat Training Mission"

My plan is below,

 

1. Spawn Two MiG-21bis from Random Vec3 at 1750 meter (success)

2. Let Do them going to AI_CAP and Engage Zone (fail)

 

I can't explain well because my english not good.

So attaching my Source Code.

 

// I found OnSpawnGroup API. but, MiG-21bis are going to Airbase for landing after spawn.

 

 

 

-- WVR A2A TRAINING MOOSE SCRIPT LUA FILE (19 Feb. 2017)

do

 

-- Declare Polygon Zone

HotZone = ZONE_POLYGON:New( "HotZone", GROUP:FindByName( "HOTZONE" ) )

SpaZone = ZONE_POLYGON:New( "SpaZone", GROUP:FindByName( "SPAZONE" ) )

 

-- Radio F10 Base Menu

local MenuBase = MENU_COALITION:New( coalition.side.RED, "Training Start" )

 

-- Fighter Groups

local VFC01 = GROUP:FindByName( "VFC01" )

local VFC02 = GROUP:FindByName( "VFC02" )

local BDM212 = GROUP:FindByName( "BDM212" )

 

-- Spawn BDM212

local function TwoMiG21()

-- Get Vec2 Coordinate

local Vec2BDM212 = SpaZone:GetRandomVec2()

local Vec3BDM212 = POINT_VEC3:NewFromVec2( Vec2BDM212, 1750 )

 

-- Spawning Now

local SpaBDM212 = SPAWN:New( "BDM212" )

:SpawnFromVec3( Vec3BDM212:GetVec3() )

:OnSpawnGroup (

function ( AICapZone )

local AICapZone = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )

AICapZone:SetControllable( BDM212 )

AICapZone:SetEngageZone( HotZone )

AICapZone:__Start( 1 )

end

)

end

 

-- Radio F10 Menu

local MenuTwoMiG21 = MENU_COALITION_COMMAND:New( coalition.side.RED, "Call Two MiG-21bis", MenuBase, TwoMiG21 )

 

end

 

Screen_170219_203450.jpg.a36d710967f807ebb523215ab1b1acf4.jpg


Edited by blklobo
Some Changed. :OnSpawnGroup
Link to comment
Share on other sites

Thanks for your Tip. but problem is same.

 

Change this line to

 

AICapZone:SetControllable(SpaBDM212)

 

I changed and more modernized based on your Tip

and reference the MOOSE docs. This is my today final Source Code.

 

 

-- WVR A2A TRAINING MOOSE SCRIPT LUA FILE (19 Feb. 2017)

do

 

-- Declare Polygon Zone

HotZone = ZONE_POLYGON:New( "HotZone", GROUP:FindByName( "HOTZONE" ) )

SpaZone = ZONE_POLYGON:New( "SpaZone", GROUP:FindByName( "SPAZONE" ) )

 

-- Radio F10 Base Menu

local MenuBase = MENU_COALITION:New( coalition.side.RED, "Training Start" )

 

-- Spawn BDM212

local function TwoMiG21()

-- Get Vec2 Coordinate

local Vec2BDM212 = SpaZone:GetRandomVec2()

local Vec3BDM212 = POINT_VEC3:NewFromVec2( Vec2BDM212, 1750 )

 

-- Spawning Now

BDM212 = SPAWN:New( "BDM212" )

:SpawnFromVec3( Vec3BDM212:GetVec3() )

:OnSpawnGroup(

function( BDM212CAPSTRCT )

BDM212CAPSTRCT = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )

:SetControllable( BDM212 )

:SetEngageZone( HotZone )

:__Start( 1 )

end

)

end

 

-- Radio F10 Menu

local MenuTwoMiG21 = MENU_COALITION_COMMAND:New( coalition.side.RED, "Call Two MiG-21bis", MenuBase, TwoMiG21 )

 

end

 

 

Problem is exist.

MiG-21bis are going to Airbase after Spawn.

 

Dizzy.

Thanks you so much why help me. but, LUA is so strong.

 

In dcs.log,

"20: attempt to call method 'OnSpawnGroup' (a nil value)"

Link to comment
Share on other sites

I can see a few potential issues in the function call for OnSpawnGroup and variable usage.

 

Have you looked at the demo missions? There will be many doing something very similar to what you are doing except maybe not the SpawnFromVec. But that should be similar to any other spawn type.

 

If I have time later and at my gaming computer I can rewrite this code to work.

 

The reason your planes are returning to base is because they are not properly associated to your AI_CAP_ZONE. Therefore they have nothing to do and return to base.

 

I changed and more modernized based on your Tip

and reference the MOOSE docs. This is my today final Source Code.

 

 

-- WVR A2A TRAINING MOOSE SCRIPT LUA FILE (19 Feb. 2017)

do

 

-- Declare Polygon Zone

HotZone = ZONE_POLYGON:New( "HotZone", GROUP:FindByName( "HOTZONE" ) )

SpaZone = ZONE_POLYGON:New( "SpaZone", GROUP:FindByName( "SPAZONE" ) )

 

-- Radio F10 Base Menu

local MenuBase = MENU_COALITION:New( coalition.side.RED, "Training Start" )

 

-- Spawn BDM212

local function TwoMiG21()

-- Get Vec2 Coordinate

local Vec2BDM212 = SpaZone:GetRandomVec2()

local Vec3BDM212 = POINT_VEC3:NewFromVec2( Vec2BDM212, 1750 )

 

-- Spawning Now

BDM212 = SPAWN:New( "BDM212" )

:SpawnFromVec3( Vec3BDM212:GetVec3() )

:OnSpawnGroup(

function( BDM212CAPSTRCT )

BDM212CAPSTRCT = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )

:SetControllable( BDM212 )

:SetEngageZone( HotZone )

:__Start( 1 )

end

)

end

 

-- Radio F10 Menu

local MenuTwoMiG21 = MENU_COALITION_COMMAND:New( coalition.side.RED, "Call Two MiG-21bis", MenuBase, TwoMiG21 )

 

end

 

 

Problem is exist.

MiG-21bis are going to Airbase after Spawn.

 

Dizzy.

Thanks you so much why help me. but, LUA is so strong.

 

In dcs.log,

"20: attempt to call method 'OnSpawnGroup' (a nil value)"

Link to comment
Share on other sites

Change your code to this:

 

-- Spawning Now
BDM212 = SPAWN:New( "BDM212" )
:SpawnFromVec3( Vec3BDM212:GetVec3() )
:OnSpawnGroup(
 function( spawnedGroup )
   BDM212CAPSTRCT = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
     :SetControllable( spawnedGroup )
     :SetEngageZone( HotZone )
     :__Start( 1 )
 end
)

 

Assuming you have SpaZone and HotZone defined correctly this should work.

 

I can see a few potential issues in the function call for OnSpawnGroup and variable usage.

 

Have you looked at the demo missions? There will be many doing something very similar to what you are doing except maybe not the SpawnFromVec. But that should be similar to any other spawn type.

 

If I have time later and at my gaming computer I can rewrite this code to work.

 

The reason your planes are returning to base is because they are not properly associated to your AI_CAP_ZONE. Therefore they have nothing to do and return to base.

Link to comment
Share on other sites

Change your code to this:

 

-- Spawning Now
BDM212 = SPAWN:New( "BDM212" )
:SpawnFromVec3( Vec3BDM212:GetVec3() )
:OnSpawnGroup(
 function( spawnedGroup )
   BDM212CAPSTRCT = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
     :SetControllable( spawnedGroup )
     :SetEngageZone( HotZone )
     :__Start( 1 )
 end
)

 

Assuming you have SpaZone and HotZone defined correctly this should work.

 

I attempted your solution just now.

But not solve the problem.

 

Can I ask what is the "spawnedGroup"?

it is just "spawnedGroup" or "BDM212"?

 

I found something in FC's docs.

about OnSpawnGroup.

 

So, my now code same to below.

 

BDM212 = SPAWN:New( "BDM212" )
        :OnSpawnGroup(
           function( SpawnedBDM212 )
              BDM212CAP = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
              :SetControllable( SpawnedBDM212 )
              :SetEngageZone( HotZone )
              :__Start( 1 )
           end
           )
        :SpawnFromVec3( Vec3BDM212:GetVec3() )
     end

 

this case show error in the dcs.log,

"23: attempt to index a nil value"


Edited by blklobo
Link to comment
Share on other sites

another method attemted(failed)

 

Ok I attempted go other way.

 

I looking dcs.log,

I found something interest.

 

hook?

So I re-Coding my script.

 

but I fail.:lol:

 

-- WVR A2A TRAINING MOOSE SCRIPT LUA FILE (19 Feb. 2017)
do

-- Declare Polygon Zone
local HotZone = ZONE_POLYGON:New( "HotZone", GROUP:FindByName( "HOTZONE" ) )
local SpaZone = ZONE_POLYGON:New( "SpaZone", GROUP:FindByName( "SPAZONE" ) )

-- Radio F10 Base Menu
local MenuBase = MENU_COALITION:New( coalition.side.RED, "Training Start" )

-- Spawn BDM212
local function TwoMiG21()
        -- Get Vec2 Coordinate
        local Vec2BDM212 = SpaZone:GetRandomVec2()
        local Vec3BDM212 = POINT_VEC3:NewFromVec2( Vec2BDM212, 1750 )
        
        function CapBDM212()
        local BDM212CAP = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
        :SetControllable( GROUP:FindByName( "BDM212#001") )
        :SetEngageZone( HotZone )
        :__Start( 1 )
     end
     
        -- Spawning
        local BDM212 = SPAWN:New( "BDM212" )
        :OnSpawnGroup(
           function( spawnGroup )
             spawnGroup:E( CapBDM212 )
           end
           )
        :SpawnFromVec3( Vec3BDM212:GetVec3() )
     end
           
-- Radio F10 Menu
local MenuTwoMiG21 = MENU_COALITION_COMMAND:New( coalition.side.RED, "Call Two MiG-21bis", MenuBase, TwoMiG21 )

end

cats.jpg.620d528fa92f8db10686354c42aea6f9.jpg

Link to comment
Share on other sites

What was the error if anything?

 

spawnedGroup is the object passed to the function defined in OnSpawnGroup. It is the group that is spawned so that you can take it and do something with it in the function. And what you are doing is adding it to the Patrol Zone.

 

I attempted your solution just now.

But not solve the problem.

 

Can I ask what is the "spawnedGroup"?

it is just "spawnedGroup" or "BDM212"?

 

I found something in FC's docs.

about OnSpawnGroup.

 

So, my now code same to below.

 

BDM212 = SPAWN:New( "BDM212" )
        :OnSpawnGroup(
           function( SpawnedBDM212 )
              BDM212CAP = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
              :SetControllable( SpawnedBDM212 )
              :SetEngageZone( HotZone )
              :__Start( 1 )
           end
           )
        :SpawnFromVec3( Vec3BDM212:GetVec3() )
     end

 

this case show error in the dcs.log,

"23: attempt to index a nil value"

Link to comment
Share on other sites

Ok I attempted go other way.

 

I looking dcs.log,

I found something interest.

 

hook?

So I re-Coding my script.

 

but I fail.:lol:

 

-- WVR A2A TRAINING MOOSE SCRIPT LUA FILE (19 Feb. 2017)
do

-- Declare Polygon Zone
local HotZone = ZONE_POLYGON:New( "HotZone", GROUP:FindByName( "HOTZONE" ) )
local SpaZone = ZONE_POLYGON:New( "SpaZone", GROUP:FindByName( "SPAZONE" ) )

-- Radio F10 Base Menu
local MenuBase = MENU_COALITION:New( coalition.side.RED, "Training Start" )

-- Spawn BDM212
local function TwoMiG21()
        -- Get Vec2 Coordinate
        local Vec2BDM212 = SpaZone:GetRandomVec2()
        local Vec3BDM212 = POINT_VEC3:NewFromVec2( Vec2BDM212, 1750 )
        
        function CapBDM212()
        local BDM212CAP = AI_CAP_ZONE:New( SpaZone, 500, 3000, 550, 650 )
        :SetControllable( GROUP:FindByName( "BDM212#001") )
        :SetEngageZone( HotZone )
        :__Start( 1 )
     end
     
        -- Spawning
        local BDM212 = SPAWN:New( "BDM212" )
        :OnSpawnGroup(
           function( spawnGroup )
             spawnGroup:E( CapBDM212 )
           end
           )
        :SpawnFromVec3( Vec3BDM212:GetVec3() )
     end
           
-- Radio F10 Menu
local MenuTwoMiG21 = MENU_COALITION_COMMAND:New( coalition.side.RED, "Call Two MiG-21bis", MenuBase, TwoMiG21 )

end

 

Is your problem fixed?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

No. I dont know what problem of my code. Thanks delta and FC. I am now going to travel to Lua Basic. I will solve that.

 

나의 SM-G930S 의 Tapatalk에서 보냄

 

Share your mission so we can have a look.

Send it to flightcontrol_moose@outlook.com.

 

Fc


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Share your mission so we can have a look.

Send it to flightcontrol_moose@outlook.com.

 

Fc

 

FC, this is the problem I was referring to. If I am reading the debug log properly then SpaZone is NIL for some reason. OR, if I am not reading that properly then the SpaZone:GetRandomVec2() is returning NIL if I remember correctly.

Link to comment
Share on other sites

FC, this is the problem I was referring to. If I am reading the debug log properly then SpaZone is NIL for some reason. OR, if I am not reading that properly then the SpaZone:GetRandomVec2() is returning NIL if I remember correctly.

 

We will only know for sure what the problem is if we can look at the whole picture.

Thanks for your help Delta.

 

Fc

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

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