Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Sorry to see you go Sven. Maybe not using it to the full extend, but really liked what you did with MOOSE.

 

Hope that after 2.5 you find some new energy/motivation to pick it up again.

 

Meanwhile, enjoy the family, kids , life,....

dUJOta.jpg

 

Windows 11 | i9 12900KF | 64GB DDR4 | RTX 3090 | TM Warthog HOTAS | Saitek Combat Rudder Pedals | TM MFDs + Lilliput 8" | TIR5 Pro

Link to comment
Share on other sites

I am late to the party here but I have been looking at MOOSE over the past two months and thinking that this could build into something really significant and something really useful. As with most DCS Mission Editing, it is a serious up-hill battle in a quiet part of the forum. It takes time to generate momentum but the design and implementation of this tool set looks very promising. I am sad to read that it may be abandoned.

 

I realize that it is a lot of work and hearth and family obviously come first. I hope to see you back here again someday and I appreciate the hard work you put in to this.

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

Sven,

 

As a modder, I have complete sympathy from where you are coming. There are always unlimited requests and demands for features, but the surest way to kill a thread is to say "I need some help with this." :doh: I have just come to realize that people have different talent levels, and sometimes it's best just to walk away from something before your passion becomes a burden.

 

Take your time and recharge your batteries. Real life is more important than a pet project, no matter how passionate you are about the subject. When you do come back, I expect that you will do so with renewed vigor.

 

In the meantime, thank you so much for what you have provided. I am slowly going through your YouTube tutorials to learn this framework, and my glacial pace is a direct result of my own real life studies. However, I hope to be an active contributor in time, as I see so much potential in what you have created.

 

The DCS community is indebted to you for MOOSE, as you have created something that can evolve in perpetuity through the contributions of others.

 

Best,

HF


Edited by Home Fries
Link to comment
Share on other sites

  • 4 weeks later...

Schedule in Spawn Class

 

hi,

 

i dont understand the function Schedule in this line of code: (from mission in Github : Area 51 - The Secret Base)

 

Spawn_RU_Ground_Route_1 = SPAWN:New( 'RU GROUND ROUTE 1' ):Limit( 16, 150 ):Schedule( 150, 0.5 ):RandomizeTemplate( Spawn_RU_Ground ):RandomizeRoute( 1, 0, 1500 )

Could you explain ? because i dont see this function in Spawn Class (documentation)

 

thanks for help..

Link to comment
Share on other sites

  • 3 weeks later...
Maybe, Schedule its function from old version of Moose... and doesnt exist now

 

What do you mean?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Another Question, is it possible to test flag with moose?

 

Yes. There are standard DCS functions for that.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I have a question. Maybe I am just misunderstanding the behaviour but is it possible to spawn a group as an array at a particular Vec2?

 

This works to spawn my group in the intended zone

 

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

 

Which works .. in that the units I intended get spawned within 50m of the zone Vec2 position.

 

When I add the array call in, like this:

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1):Array (45,10,30,30)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

 

which I think means to spawn them facing 45 degrees, 10 wide, 30 m, delta 30x, and delta 30y), I get a nice line of units from the right group

 

but (there had to be a but :-) )

 

they are located at the position of the template group and not at or near the Vec2.

 

I assume I am doing something wrong. Lua is not mu first language :-)

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

I have a question. Maybe I am just misunderstanding the behaviour but is it possible to spawn a group as an array at a particular Vec2?

 

This works to spawn my group in the intended zone

 

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

Which works .. in that the units I intended get spawned within 50m of the zone Vec2 position.

 

When I add the array call in, like this:

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1):Array (45,10,30,30)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

which I think means to spawn them facing 45 degrees, 10 wide, 30 m, delta 30x, and delta 30y), I get a nice line of units from the right group

 

but (there had to be a but :-) )

 

they are located at the position of the template group and not at or near the Vec2.

 

I assume I am doing something wrong. Lua is not mu first language :-)

 

Do you have the latest version?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I have a question. Maybe I am just misunderstanding the behaviour but is it possible to spawn a group as an array at a particular Vec2?

 

This works to spawn my group in the intended zone

 

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

Which works .. in that the units I intended get spawned within 50m of the zone Vec2 position.

 

When I add the array call in, like this:

Depot_Spawned = SPAWN:New ( Depot_Template_Name ):Limit (5,1):Array (45,10,30,30)
Depot_Spawned:SpawnFromVec2 (Zone_Vec2, 50, 5)

which I think means to spawn them facing 45 degrees, 10 wide, 30 m, delta 30x, and delta 30y), I get a nice line of units from the right group

 

but (there had to be a but :-) )

 

they are located at the position of the template group and not at or near the Vec2.

 

I assume I am doing something wrong. Lua is not mu first language :-)

 

Can you drop me a mission example that shows the behaviour? So i can check it here. It needs to include the code you've written. Attach it to your reply msg.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Ok here it is. I think I have stripped out most of the useless bits. In the DG_Ops_tmp-01.lua script, lines 91,92. I think that each of the depot groups should be spawning in formation but I may have something wrong.

Depots-tmp-01.miz

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

I think I understand. The Array () function is intended to have the Spawn object visible and ordered ... which means that the template is visible. When I call SpawnFromVec2 I am creating a clone of that template at the vector but it does not conform to the ordered positions of the template. IE: the template placement on the map (positions of each unit in the group) does not get copied to the cloned instance.

 

TLDR: I am misinterpreting the function.

  • Like 1

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

I think I understand. The Array () function is intended to have the Spawn object visible and ordered ... which means that the template is visible. When I call SpawnFromVec2 I am creating a clone of that template at the vector but it does not conform to the ordered positions of the template. IE: the template placement on the map (positions of each unit in the group) does not get copied to the cloned instance.

 

TLDR: I am misinterpreting the function.

 

Ha, yes, the Array() method is to spawn a VISIBLE battallion of hundreds of groups, inactive, but visible, and ordered at a place within the battlefield until activation.

 

It does not order the units of one group. Is that what you meant?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Yes. I thought they might maintain their order once they were placed with something like SpawnFromVec2. I see the difference now :-)

 

BTW: Much respect for hat you have done here. The code, documentation and test missions are very well done! I can see the obvious work that you put into them!

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

Yes. I thought they might maintain their order once they were placed with something like SpawnFromVec2. I see the difference now :-)

 

BTW: Much respect for hat you have done here. The code, documentation and test missions are very well done! I can see the obvious work that you put into them!

 

 

Thank you. Know that slowly I am preparing for a new release with additional features! Don't want to talk to much about it now. First I'll finish it, and then talk about it, not to set false expectations. Just know that preparing for a release also requires documenting, testing, demoing and training... For the moment I am a bit battling in lua how to reflect "class templates", so that you can pass processing "class template" to a Task object to orchestrate task processes... I already have a good task working mechanism implemented, but want to find something even better. It is all about syntactic sugar...

 

 

I am very happy that you like and use what has been made. Feel free to post a wish list with additional ideas / features that you would like to see in the framework somewhere in the future.

 

 

talk to you all soon!

Sven


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I am a bit battling in lua

 

That is the way I always feel in Lua :-)

 

And don't worry about rushing a new release. All of that documentation, testing, demoing and training takes a lot of time.

 

I will share what I am working on when it gets a little clearer. Right now I have the framework for something that may provide something for helicopter pilots to fly against :-)

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

Question: If I despawn a group with the DCS destroy() command, the count of those units get removed from the Spawn object?

 

Example: I have a supply group that I create a SPAWN object for. That group and set it to Limit (10 Units and 2 groups). When they are spawned with Spawn from unit, they are assigned a Route with the proper call and they head out. If they reach the destination (something I am polling for), they are destroyed by getting the DCS group and calling destroy. I can do this one more time before I run out of units from the SPAWN object instance.

 

Is there a way that I can 'return them to the pool' of spawnable units?

 

EDIT: Switched to the MOOSE GROUP:Destroy() call and I can see the SPAWN:SpawnCount stays the same but the SPAWN:AliveUnits goes down. It seems that the SpawnCount (counting groups) does not (and maybe is not intended to) be lowered when a group is destroyed?


Edited by dwpenney

Fridge

----------

Things which do you no good in aviation:

1) Altitude above you;

2) Runway behind you;

3) Fuel in the truck;

4) The airspeed you don't have.

Link to comment
Share on other sites

  • 2 weeks later...

SetTemplateCoalition

 

Hi.

 

I'm struggeling with the SetTemplateCoalition in the GROUP class. Bascily what I want to do is change/tweak a group (HAWK SAM) coalition and country so it swithces side from blue to red side.

 

The second paramater in this function SetTemplateCoalition(CoalitionID, Template) is CoaltionID. I have tried to find out what this is and how to retrieve it. Tried with the obvious "coalation.side.RED", but log complains "attempt to index local 'Template' (a number value)".

 

How do I set this argument?

 

Regards :)

 

Wingthor

  • Like 1
Link to comment
Share on other sites

I'm struggeling with the SetTemplateCoalition in the GROUP class. Bascily what I want to do is change/tweak a group (HAWK SAM) coalition and country so it swithces side from blue to red side.

 

Looks like you've been deep into the code while exploring the SPAWN class :D.

Haven't come accross this scenario / requirement yet where a mission designer wants to spawn a new group object while changing the country / coalition.

 

A few questions on this requirement:

1. When you change the coalition, does it change country too?

2. Once the coalition has changed, does the GROUP have a changed coalition all the time?

 

So, here's my first go on the solution:

 

You know by now that GROUP is a wrapper class. For each DCS Group it finds at mission start, a GROUP instance is created that correlates to the DCS group, holding more parameters and exposing methods to manipulate the DCS Group.

 

The second explanation needed is about "templates". At mission start, a _DATABASE object is created, which has a member called Templates, that contains all the description properties of each DCS Group, DCS Unit and other DCS objects at mission start. When you unzip a mission, open the mission file, and search for the first Group object descriptor, exactly those structures are now contained in an array under the _DATABASE object like this:

 

[color=Blue]_DATABASE.Templates.Groups[self.GroupName].Template[/color]

The .Template variable for each Groups element in the array, is such a DCS Group description. When you analyze closely the mission file that you've just opened, you'll see that 2 important fields are missing from each of these DCS Group descriptors: country and coalition ... These are actually contained in the mission file, because each DCS Group description is ordered per coalition and country. Thus, during the scan at the mission startup, within each .Template object, 2 fields are added to the .Template variable: country and coalition, which get the relevant country ID and coalition ID.

 

Why all this explanation? Well, because SPAWN doesn't actually spawn anything. _DATABASE does...

The function in MOOSE that actually spawns new objects is found here:

 

[color=Teal]--- Instantiate new Groups within the DCSRTE.
-- This method expects EXACTLY the same structure as a structure within the ME, and needs 2 additional fields defined:
-- SpawnCountryID, SpawnCategoryID
-- This method is used by the SPAWN class.
-- @param #DATABASE self
-- @param #table SpawnTemplate
-- @return #DATABASE self[/color]
[color=Blue]function DATABASE:Spawn( SpawnTemplate )
 self:F( SpawnTemplate.name )

 self:T( { SpawnTemplate.SpawnCountryID, SpawnTemplate.SpawnCategoryID } )[/color]

 [color=Green]-- Copy the spawn variables of the template in temporary storage, nullify, and restore the spawn variables.[/color]
 [color=Blue]local SpawnCoalitionID = SpawnTemplate.CoalitionID
 local SpawnCountryID = SpawnTemplate.CountryID
 local SpawnCategoryID = SpawnTemplate.CategoryID[/color]

 [color=Green]-- Nullify[/color]
 [color=Blue]SpawnTemplate.CoalitionID = nil
 SpawnTemplate.CountryID = nil
 SpawnTemplate.CategoryID = nil

 self:_RegisterTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID  )

 self:T3( SpawnTemplate )
 coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )[/color]

 [color=Green]-- Restore[/color]
 [color=Blue]SpawnTemplate.CoalitionID = SpawnCoalitionID
 SpawnTemplate.CountryID = SpawnCountryID
 SpawnTemplate.CategoryID = SpawnCategoryID

 local SpawnGroup = self:AddGroup( SpawnTemplate.name )
 return SpawnGroup
end[/color]

The code above contains a statement:

 

[color=Blue]coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )[/color]

This statement coalition.addGroup is actually spawning new objects within the simulator. Before addGroup can spawn the objects, something needs to be done ... the SpawnTemplate should not contain a coalition and country field, and thus, before spawning, these fields are blanked out, but remembered within the function before spawning.

Because ... after the spawn, a new GROUP template is created in _DATABASE that contains the correct coalition and country id for the newly created GROUP instance.

 

Now, here we come to fill in your requirement, great minds think alike ...

Using the

[color=Blue]function GROUP:SetTemplateCoalition( Template, CoalitionID )[/color]

is the correct assumption.

 

I would code something like this, assuming that you want to change from a BLUE coalition belonging to country USA to a RED coalition belonging to RUSSIA...:

 

[color=Blue]local GroupOldCoalition = GROUP:FindByName( "GroupName" )[/color] [color=Green]-- Find the GROUP instance correlating to the DCS Group with name GroupName.[/color]

[color=Blue]GroupTemplate = GroupOldCoalition:GetTemplate()[/color] [color=Green]-- This returns a table with the DCS Group description as found within the mission file. This table also contains coalition and country fields.[/color]

[color=Blue]GroupOldCoalition:SetTemplateCoalition( GroupTemplate, coalition.side.RED )
GroupOldCoalition:SetTemplateCountry( GroupTemplate, country.id.RUSSIA )
[/color]
[color=Green]-- Now, the GroupOldCoalition template has transitioned from BLUE to RED coalition, and from USA to RUSSIA country...
-- When you spawn this GROUP, you'll get a new object belonging to RED and RUSSIA.
[/color]
[color=Blue]local SpawnGroup = SPAWN:New( "GroupName" )
SpawnGroup:Spawn()
[/color]

Hope this helps and works for you.

 

Now, we both understand that this method is not ideal, and we are using functions behind the scenes to overcome a new requirement.

I think I need to have a closer look at SPAWN for this requirement. Maybe new parameters can be added that model for what coalition and country the SPAWN object should function. Thus, when the SPAWN object would spawn a new object, it would do so for the coalition and country described.

 

Another point of design is that when you change the coalition and country object within the _DATABASE Templates, it will be permanent, and this is not what should be ... It should be set temporarily ...

 

Let me know how this little code works for you ... And I'll see what I can do implementing a nice change iin the MOOSE object model to fulfill this requirement by the next release.

 

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Thank you for a quick and comprehensive answer.

 

Your suggestion worked to some extent. Basicily it was what I originaly did but I had swaped the args. Seems to be swapped in the docu too, cause in mine documentation it says coaltionID as first argument.

 

Anyway, what happen is that Moose respawned an object as red, but not the same. The Blue SAM HAWK SR AN/MPQ-50 turned inot a Russian, red APC M1005 HMMWV. :)

 

Will not stress you with this. Just a "nice to have" feature.

 

Making a Arma III like "Zeuvs" function.

 

Let me know if you want to see the code, if you think I might have done anything wrong.

 

Regards Wingthor


Edited by Wingthor
Link to comment
Share on other sites

Thank you for a quick and comprehensive answer.

 

Anyway, what happen is that Moose respawned an object as red, but not the same. The Blue SAM HAWK SR AN/MPQ-50 turned inot a Russian, red APC M1005 HMMWV. :)

 

Hi,

 

I think the reason why the spawn is not the same, is due to the internal DCS design. You see, coalitions cannot all have the same units in their arsenal.

You'll need to find countries that have common unit types between RED and BLUE. One such country is GEORGIA. They have SU-25Ts, and common SAMs. Russian make however ... Check for a RED country that can have NATO equipment too. Or, design your mission like this that a russian country belongs to BLUE. That may also work...

 

Will not stress you with this. Just a "nice to have" feature.

Making a Arma III like "Zeuvs" function.

Let me know if you want to see the code, if you think I might have done anything wrong.

 

I trust your code. Let me know if the above explained provides an improvement.

 

Your suggestion worked to some extent. Basicily it was what I originaly did but I had swaped the args. Seems to be swapped in the docu too, cause in mine documentation it says coaltionID as first argument.

 

Thanks for notifying the args. I'll check the documentation and correct this.

Also, if you think such function is useful, I can add methods to SPAWN to indicate for which coalition and country the group should be spawned...

 

kind regards,

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I think the reason why the spawn is not the same, is due to the internal DCS design.
I had a quick glance at MIST dynAdd function, and that one seems to do something with the countryID, but I am not an expert in MIST, so I can't confirm that mist.dynadd supports side swaps. Anyway for me its a "nice to have" feature.
Edited by Wingthor
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...