Jump to content

Unit Options with MIST/Scripting


NineLine

Recommended Posts

  • ED Team

How do I set ROE with scripting/MIST

 

   ["y"] = ranpos.z,
  ["type"] = "Ural-375 ZU-23",
  ["name"] = "Unit #1" ,
  ["unitId"] = 51,
  ["heading"] = 0,
  ["playerCanDrive"] = true,
  ["skill"] = "Average",
  ["x"] = ranpos.x,

 

Should I just place a bunch of units each with different options and view the code of that mission or is there some place to find this out otherwise? Or is it as simple as pulling the info from the drop down in the ME so it would be:

 

["ROE"] = "OPEN FIRE',

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

It is done via unit/group controllers.

 

http://wiki.hoggit.us/view/Part_2#Behavior_options

 

Aircraft and ground/ships are limited to different functions. For instance you can micromanage AI aircraft on a per unit basis, giving them new waypoints, orders, etc. Ground vehicles and ships are treated as a group.

 

The following is taken from my IAD script.

local con = Group.getByName(iadGroup.groupName):getController()
con:setOption(0, 0) --fire at will
con:setOption(9, 2) --radar on

 

There is another way to write it. The numbers simply indicate the table entry for the different type of options and choices within said option.

 

con:setOption(AI.Option.Ground.id.ROE, AI.Option.Ground.val.ROE.OPEN_FIRE)

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

  • 3 weeks later...
It is done via unit/group controllers.

 

http://wiki.hoggit.us/view/Part_2#Behavior_options

 

Aircraft and ground/ships are limited to different functions. For instance you can micromanage AI aircraft on a per unit basis, giving them new waypoints, orders, etc. Ground vehicles and ships are treated as a group.

 

The following is taken from my IAD script.

local con = Group.getByName(iadGroup.groupName):getController()
con:setOption(0, 0) --fire at will
con:setOption(9, 2) --radar on

 

There is another way to write it. The numbers simply indicate the table entry for the different type of options and choices within said option.

 

con:setOption(AI.Option.Ground.id.ROE, AI.Option.Ground.val.ROE.OPEN_FIRE)

 

 

How do you know which optionId to use? The way I interpret the documentation for setOption is that in your example your first parameter would be AI.Option.Ground.id.ROE and your second parameter would be AI.Option.Ground.val.ROE.OPEN_FIRE (when looking at con:setOption(0, 0) --fire at will).

 

And the 'Ground units' doesn't have anything for toggling radar for the unit. Unless I'm reading the documentation wrong.

314-я смешанная авиационная дивизия

314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119

Link to comment
Share on other sites

How do you know which optionId to use? The way I interpret the documentation for setOption is that in your example your first parameter would be AI.Option.Ground.id.ROE and your second parameter would be AI.Option.Ground.val.ROE.OPEN_FIRE (when looking at con:setOption(0, 0) --fire at will).

 

The AI.Option stuff is basically a giant table, with table indexes representing different values. I have the data via writing the _G global lua environment within the sim to a table. I need to amend the documentation to include these enumerated values where-ever they exist.

 

Here is a sample of what the _g table looks like

 

So instead of typing out AI.Option.Air.id.ROE, I can just use '1' to represent the same thing. The scripting engine will know which type of group you are trying to assign the command to.

["AI"] = table: 0000000027B71EC0     {
   ["AI"]["Option"] = table: 000000002AAB4B20         {
       ["AI"]["Option"]["Air"] = table: 000000002AAB4B70             {
           ["AI"]["Option"]["Air"]["id"] = table: 000000002AAC7DF0                 {
               ["AI"]["Option"]["Air"]["id"]["FLARE_USING"] = 4,
               ["AI"]["Option"]["Air"]["id"]["REACTION_ON_THREAT"] = 1,
               ["AI"]["Option"]["Air"]["id"]["FORMATION"] = 5,
               ["AI"]["Option"]["Air"]["id"]["ROE"] = 0,
               ["AI"]["Option"]["Air"]["id"]["RTB_ON_BINGO"] = 6,
               ["AI"]["Option"]["Air"]["id"]["SILENCE"] = 7,
               ["AI"]["Option"]["Air"]["id"]["RADAR_USING"] = 3,
               ["AI"]["Option"]["Air"]["id"]["RTB_ON_OUT_OF_AMMO"] = 10,
               ["AI"]["Option"]["Air"]["id"]["NO_OPTION"] = -1,
               },
           ["AI"]["Option"]["Air"]["val"] = table: 0000000058EB95D8                 {
               ["AI"]["Option"]["Air"]["val"]["FLARE_USING"] = table: 0000000027B82FA0                     {
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["WHEN_FLYING_NEAR_ENEMIES"] = 3,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["WHEN_FLYING_IN_SAM_WEZ"] = 2,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["AGAINST_FIRED_MISSILE"] = 1,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["NEVER"] = 0,
                   },

 

And the 'Ground units' doesn't have anything for toggling radar for the unit. Unless I'm reading the documentation wrong.

 

Alarm state governs a groups sensors, which includes radar. Toggling between alarm state red and green manually switches the radars on and off. (Or is it the other way around? I always forget)

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

  • ED Team

Ok, thanks Grimes, I will see if I can format that for my randomizing script above :)

 

It is done via unit/group controllers.

 

http://wiki.hoggit.us/view/Part_2#Behavior_options

 

Aircraft and ground/ships are limited to different functions. For instance you can micromanage AI aircraft on a per unit basis, giving them new waypoints, orders, etc. Ground vehicles and ships are treated as a group.

 

The following is taken from my IAD script.

local con = Group.getByName(iadGroup.groupName):getController()
con:setOption(0, 0) --fire at will
con:setOption(9, 2) --radar on

 

There is another way to write it. The numbers simply indicate the table entry for the different type of options and choices within said option.

 

con:setOption(AI.Option.Ground.id.ROE, AI.Option.Ground.val.ROE.OPEN_FIRE)

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

The AI.Option stuff is basically a giant table, with table indexes representing different values. I have the data via writing the _G global lua environment within the sim to a table. I need to amend the documentation to include these enumerated values where-ever they exist.

 

Here is a sample of what the _g table looks like

 

So instead of typing out AI.Option.Air.id.ROE, I can just use '1' to represent the same thing. The scripting engine will know which type of group you are trying to assign the command to.

["AI"] = table: 0000000027B71EC0     {
   ["AI"]["Option"] = table: 000000002AAB4B20         {
       ["AI"]["Option"]["Air"] = table: 000000002AAB4B70             {
           ["AI"]["Option"]["Air"]["id"] = table: 000000002AAC7DF0                 {
               ["AI"]["Option"]["Air"]["id"]["FLARE_USING"] = 4,
               ["AI"]["Option"]["Air"]["id"]["REACTION_ON_THREAT"] = 1,
               ["AI"]["Option"]["Air"]["id"]["FORMATION"] = 5,
               ["AI"]["Option"]["Air"]["id"]["ROE"] = 0,
               ["AI"]["Option"]["Air"]["id"]["RTB_ON_BINGO"] = 6,
               ["AI"]["Option"]["Air"]["id"]["SILENCE"] = 7,
               ["AI"]["Option"]["Air"]["id"]["RADAR_USING"] = 3,
               ["AI"]["Option"]["Air"]["id"]["RTB_ON_OUT_OF_AMMO"] = 10,
               ["AI"]["Option"]["Air"]["id"]["NO_OPTION"] = -1,
               },
           ["AI"]["Option"]["Air"]["val"] = table: 0000000058EB95D8                 {
               ["AI"]["Option"]["Air"]["val"]["FLARE_USING"] = table: 0000000027B82FA0                     {
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["WHEN_FLYING_NEAR_ENEMIES"] = 3,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["WHEN_FLYING_IN_SAM_WEZ"] = 2,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["AGAINST_FIRED_MISSILE"] = 1,
                   ["AI"]["Option"]["Air"]["val"]["FLARE_USING"]["NEVER"] = 0,
                   },

 

 

 

Alarm state governs a groups sensors, which includes radar. Toggling between alarm state red and green manually switches the radars on and off. (Or is it the other way around? I always forget)

 

I see what you're saying. A personal force of habit of mine but I would rather user the object/table (not sure how to calls these in Lua) notation than to user the index directly, in the event someone decides to add or remove an index.

 

 

How are you writing the _G to a table in your mission file? And what is your method for printing dumping all of it out?

 

Thanks again for the insight.

314-я смешанная авиационная дивизия

314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...