Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Try removing the local on the SPAWN object. You need a global object there.

 

Hi, I have a problem with using MOOSE.

 

AI unit is no longer spawns in multiplayer if AI pilot is ejected.

 

Below is my code.

 

local SpawnCleanUpInterval = 60

local SpawnMaxUnitsAlive = 1

local SpawnMaxGroups = 0

local SpawnTemplate = { "AI AJS-37", "AI F-5E-3", "AI M-2000C", "AI MiG-21Bis" }

local SpawnTime = 60

local SpawnTimeVariation = 0

local SpawnZoneTable = { ZONE:New( "Battle Zone" ) }

 

local SpawnAI = SPAWN:New( "AI AIRCRAFT" )

:InitCleanUp( SpawnCleanUpInterval )

:InitLimit( SpawnMaxUnitsAlive, SpawnMaxGroups )

:InitRandomizeTemplate( SpawnTemplate )

:InitRandomizeZones( SpawnZoneTable )

:SpawnScheduled( SpawnTime, SpawnTimeVariation )

 

 

Thanks.

Link to comment
Share on other sites

Hi

 

when a unit is dead, is it possible and how to know it is attacked by what with which weapons?

 

or when the unit is firing, how can I know what it is hit and if the target is destoried?

 

Thanks

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

 

Hi Pikey

 

I have read the Event Handling demos, the demo shows how to listen a event but doesn't tell me how to get the attacker

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

Hi Pikey

 

I have read the Event Handling demos, the demo shows how to listen a event but doesn't tell me how to get the attacker

 

This information is contained in the "EventData" that is passed to the event handling function.

 

For example

EventData.IniUnit

which is the unit initiating the event or

EventData.TgtUnit

which is the target unit.

 

Similar for groups. The existence of these depend on the initiating event.

 

For hit event you should get the initiating unit/group, i.e. the one that shot and target group that was hit. But I don't think you get the weapon type.

 

For shot events, you get the shooter (the initiating unit/group here), the targeted unit/group and the weapon should also be possible. But I never tried that, so I might be wrong.

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

This information is contained in the "EventData" that is passed to the event handling function.

 

For example

EventData.IniUnit

which is the unit initiating the event or

EventData.TgtUnit

which is the target unit.

 

Similar for groups. The existence of these depend on the initiating event.

 

For hit event you should get the initiating unit/group, i.e. the one that shot and target group that was hit. But I don't think you get the weapon type.

 

For shot events, you get the shooter (the initiating unit/group here), the targeted unit/group and the weapon should also be possible. But I never tried that, so I might be wrong.

 

Thank you, I will try it when I get home

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

Thank you!

 

I just wanted to take a minute to say THANK YOU to FC and the entire MOOSE development team.

 

What you've done here rivals the size, scope, and planning of any project I've worked on in 20+ years of IT, and the quality of the work is superb all around.

 

I know you guys get a lot of use case questions, and I've certainly asked my share too, but as much as I use the framework, it's high time to express appreciation to this team for a job well done on what for me is a transformational product for mission design.

 

Please be buoyed by the assurance that what you are doing is used, and appreciated.

 

V/R,

 

/Fargo007

 

Banner EDForum2020.jpg

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

https://discord.gg/blacksharkden/

Link to comment
Share on other sites

I just wanted to take a minute to say THANK YOU to FC and the entire MOOSE development team.

 

What you've done here rivals the size, scope, and planning of any project I've worked on in 20+ years of IT, and the quality of the work is superb all around.

 

I know you guys get a lot of use case questions, and I've certainly asked my share too, but as much as I use the framework, it's high time to express appreciation to this team for a job well done on what for me is a transformational product for mission design.

 

Please be buoyed by the assurance that what you are doing is used, and appreciated.

 

V/R,

 

/Fargo007

 

Well said!

Link to comment
Share on other sites

Hi Pikey

 

I have read the Event Handling demos, the demo shows how to listen a event but doesn't tell me how to get the attacker

 

So the other guys nailed it, but if you want my "dumbass approach", i found that I learned what was in "EventData" by looking through the logs with MOOSE loaded. In there is the events which we speak of, and they spit out the entire list of everything in the form of a table. Each element to that table can be returned!

 

So for example if (and i'm just gonna make this up) there was a line in the logs about an EVENT and after it, a load of blurb, and one part of that blurb where it says "Fruit"= "Apple", you can write MyFruit = EventData.Fruit, and that gives you your Apple. In real terms the EventData depends very much on the actual Event, not everything is captured, but you get a bunch of info on the event like player, weapon, time and so on.

  • Like 1

___________________________________________________________________________

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

Link to comment
Share on other sites

Seems to only happen in Vegas. Used example script and made a mission with correct contents and it crashes.

 

Are you having statics in your mission?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

There is this too which you should definitely read in detail: http://flightcontrol-master.github.io/MOOSE/Documentation/Event.html

 

thank you for sharing

 

I can get a event of dead now, but neither init group nor unit is vaild, there are nil.

 

No message is printed when the fuel tank is destoried:

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

function tgt1:OnEventDead( EventData )
 EventData.IniUnit:MessageToAll( "I just got dead and I am part of " .. EventData.IniGroupName, 15)
end

 

But if I use a group to publish the message, it OK

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

msger = GROUP:FindByName( "gnd_Apc1" )
function tgt1:OnEventDead( EventData )
 msger:MessageToAll( "I just got dead and I am part of ", 15 )
end

 

then if I want to print the init name, it no ok :(

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

msger = GROUP:FindByName( "gnd_Apc1" )
function tgt1:OnEventDead( EventData )
   msger:MessageToAll( "I just got dead and I am part of " .. EventData.IniGroupName, 15)
end

 

 

So it seems that there are some restrictions for event of STATIC object or something is wrong in my code

 

EDIT:

The fuel tank is destroyed by an player controlled A-10C with GAU-8


Edited by RglsPhoto

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

I can get a event of dead now, but neither init group nor unit is vaild, there are nil.

 

For static objects the group fields won't be filled. But the unit ones should not be nil. I can't test it right now, but you could try this version.

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

function tgt1:OnEventDead( EventData )
 MESSAGE:New("I just died and my name is "..EventData.Ini[b]Unit[/b]Name, 15):ToAll()
end

The message can be send without "coming" from a group or unit and mind the EventData.IniUnitName instead of EventData.IniGroupName.

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

thank you for sharing

 

I can get a event of dead now, but neither init group nor unit is vaild, there are nil.

 

No message is printed when the fuel tank is destoried:

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

function tgt1:OnEventDead( EventData )
 EventData.IniUnit:MessageToAll( "I just got dead and I am part of " .. EventData.IniGroupName, 15)
end

But if I use a group to publish the message, it OK

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

msger = GROUP:FindByName( "gnd_Apc1" )
function tgt1:OnEventDead( EventData )
 msger:MessageToAll( "I just got dead and I am part of ", 15 )
end

then if I want to print the init name, it no ok :(

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

msger = GROUP:FindByName( "gnd_Apc1" )
function tgt1:OnEventDead( EventData )
   msger:MessageToAll( "I just got dead and I am part of " .. EventData.IniGroupName, 15)
end

So it seems that there are some restrictions for event of STATIC object or something is wrong in my code

 

EDIT:

The fuel tank is destroyed by an player controlled A-10C with GAU-8

Yes, you didn't mention static objects. The dead event for STATICS certainly doesn't scroll through in MOOSE, whereas it does for a normal UNIT. Welcome to DCS scripting, where things just aren't as simple as you hope :)

 

You don't get a UNIT name because Static objects dont have a Unit name, they have a group and an ID as far as I recall.

 

What do you need to do? Return a name for a static on death? Return the initiator? Something else? Statics are painful, let me tell you that.

___________________________________________________________________________

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

Link to comment
Share on other sites

Yes, you didn't mention static objects. The dead event for STATICS certainly doesn't scroll through in MOOSE, whereas it does for a normal UNIT. Welcome to DCS scripting, where things just aren't as simple as you hope :)

 

You don't get a UNIT name because Static objects dont have a Unit name, they have a group and an ID as far as I recall.

 

What do you need to do? Return a name for a static on death? Return the initiator? Something else? Statics are painful, let me tell you that.

 

Hi Pikey

 

I am building a qualification mission, there are 3 target zone , each for Ka-50, A-10C and Su-27.

 

So when a target is killed, I need to know by who and with what weapon

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

For static objects the group fields won't be filled. But the unit ones should not be nil. I can't test it right now, but you could try this version.

tgt1 = STATIC:FindByName( "Static_fuel_tank_tgt1A" )

tgt1:HandleEvent( EVENTS.Dead )

function tgt1:OnEventDead( EventData )
 MESSAGE:New("I just died and my name is "..EventData.Ini[b]Unit[/b]Name, 15):ToAll()
end

The message can be send without "coming" from a group or unit and mind the EventData.IniUnitName instead of EventData.IniGroupName.

 

Hi funkyfranky

 

Thank you so much, the message can be printed now, but the IniUnitName is who get killed, what I want to get is the killer instead of the victim

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

Only HIT events have the initiator and the target. DEAD events have the unit that died and the time.

This is because the unit that died can be hit by more than one person, but the game doesn't decide who is responsible for it's death.

___________________________________________________________________________

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

Link to comment
Share on other sites

Ran you mission and getting the same crash. Tested my own mission and it does the same, works in 15. crashed in 2.1 NTTR

 

Guys, I had the same... in 2.1...

But, i had statics at the airbase. Once i removed the statics from the mission, I had no crash anymore!

Can you or Tracerfacer try this?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I just wanted to take a minute to say THANK YOU to FC and the entire MOOSE development team.

 

What you've done here rivals the size, scope, and planning of any project I've worked on in 20+ years of IT, and the quality of the work is superb all around.

 

I know you guys get a lot of use case questions, and I've certainly asked my share too, but as much as I use the framework, it's high time to express appreciation to this team for a job well done on what for me is a transformational product for mission design.

 

Please be buoyed by the assurance that what you are doing is used, and appreciated.

 

V/R,

 

/Fargo007

 

Thank you! That is great to read!

 

It is a bit invisible how many people are using this framework, so thanks for the appreciation to the team.

 

This framework is an ongoing target, the more people use it, the better it will get, and less bugs will appear over time. The more people are contributing and helping others, the more time the developers have with extending the framework with new modules.

 

Thanks

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Only HIT events have the initiator and the target. DEAD events have the unit that died and the time.

This is because the unit that died can be hit by more than one person, but the game doesn't decide who is responsible for it's death.

 

Thank you, I walk around it, subscribe Hit event of the target and save the initiator, then subscribe the Dead event, so when the target gets killed, I can know by who

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

Thank you, I walk around it, subscribe Hit event of the target and save the initiator, then subscribe the Dead event, so when the target gets killed, I can know by who

 

SCORING works like this also. And the accounting for the deads in the FSM works like this too.

 

Is this for scoring deads? Because that has already been written...

 

SCORING class ...

 

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

SCORING works like this also. And the accounting for the deads in the FSM works like this too.

 

Is this for scoring deads? Because that has already been written...

 

SCORING class ...

 

FC

 

yep, I will check the SCORING when I get home. Thank you

I7-6700K OC 4.9G, 896G SSD, 32G RAM @ 2400MHz, NH-D15 cooling system,TM Hotas Warthog,Saitek Pro Flight Rudder Pedals,TrackIr 5, BOSE M2

Link to comment
Share on other sites

Hey guys, i was wondering if there was a way to change the tactics A2A AI is using once in engagements ? Like azimuth split, range split, ... I looked at the documentation but couldn't find it

 

Thanks, great framework btw i didn't think LUA could be so clean :D

Link to comment
Share on other sites

Guys, I had the same... in 2.1...

But, i had statics at the airbase. Once i removed the statics from the mission, I had no crash anymore!

Can you or Tracerfacer try this?

 

sorry to report that after removing all the statics - I get the exact same crash. Seems like when the F10 menu is updating during the task creation process. (guess from the logs)

dcsMooseCrashVegas.zip


Edited by TracerFacer
Link to comment
Share on other sites

sorry to report that after removing all the statics - I get the exact same crash. Seems like when the F10 menu is updating during the task creation process. (guess from the logs)

 

I will look into this with big magnifying glasses!

 

Sven

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