ED Team NineLine Posted August 2, 2014 ED Team Share Posted August 2, 2014 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', Forum Rules • My YouTube • My Discord - NineLine#0440• **How to Report a Bug** Link to comment Share on other sites More sharing options...
Grimes Posted August 2, 2014 Share Posted August 2, 2014 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 Server, Scripting 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 More sharing options...
number3 Posted August 18, 2014 Share Posted August 18, 2014 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 More sharing options...
Grimes Posted August 18, 2014 Share Posted August 18, 2014 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 Server, Scripting 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 More sharing options...
ED Team NineLine Posted August 18, 2014 Author ED Team Share Posted August 18, 2014 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) Forum Rules • My YouTube • My Discord - NineLine#0440• **How to Report a Bug** Link to comment Share on other sites More sharing options...
number3 Posted August 18, 2014 Share Posted August 18, 2014 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 More sharing options...
Recommended Posts