Jump to content

Help - how to set ROE to HOLD FIRE with lua script?


Recommended Posts

Posted (edited)

I'm no pro at scripting so I try to combine scripts from around the forums best as can do. So far I was able to get some tweaks to RagnarDa's MEDEVAC Script working, mainly set the spawned troops invisible so they don't get attacked, immortal so they don't get blown up by the next Truck exploding near them... Now I just need to have the bastards not firing at any enemy near them, cause they are invulnerable and invisible they destroy even tanks.

 

I can not figure how to set the ROE option!!! I tried adapting MBots Fire Suppression script, but no luck.

 

From RagnarDa's script I have the Group Name available as a variable and passing it to a function to set invisible etc. works pretty well. (see below)

 

What is the TASK / ACTION, whatever, to set the ROE to HOLD FIRE???:cry:

 

Example:

make_groupInvisible = function(groupName,bool)
local group
local groupController

   group = Group.getByName(groupName)
   groupController = Group.getController(group)
   Controller.pushTask(groupController,
   {
       ["id"] = "ComboTask",
       ["params"] = 
       {
           ["tasks"] = 
           {
               [1] = 
               {
                   ["enabled"] = true,
                   ["auto"] = false,
                   ["id"] = "WrappedAction",
                   ["number"] = 1,
                   ["params"] = 
                              {
                       ["action"] = 
                       {
                           ["id"] = "SetInvisible",
                           ["params"] =
                           {
                               ["value"] = bool,
                           }, -- end of ["params"]
                       }, -- end of ["action"]
                   }, -- end of ["params"]
               }, -- end of [1]
           }, -- end of ["tasks"]
       }, -- end of ["params"]
   })
end

 

EDIT: if ED could implement unarmed civilians as units, may be along with insurgents, Toyota trucks civilian and armed with Dshk ...imagine missions where you need to care about innocent civilians, so choice of weapons is crucial etc.

Edited by shagrat

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Posted

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

 

To do it once the group spawns in you simply need to use the Controller to set the option... Group.getByName(groupName):getController():setOption(0, 4) --hold fire

 

The number for set option are related to the enumerated values for the option type. Group.getByName(groupName):getController():setOption(AI.Option.Ground.id.ROE, AI.Option.Ground.val.ROE.WEAPON_HOLD) should have the same behavior I think...

 

 

Alternatively however its formatted in the tasking table in the mission file should also do the trick if its part of the table the group spawns with. Basically make a mission with an group whose only task is to ROE = hold, and then open the miz file up with 7zip and then teh mission file to see how its formatted.

  • Like 1

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

Posted
EDIT: if ED could implement unarmed civilians as units, may be along with insurgents, Toyota trucks civilian and armed with Dshk ...imagine missions where you need to care about innocent civilians, so choice of weapons is crucial etc.

 

You can already do that by creating one or more "enemy" group set as "passive defence" and "alert green", linking them with a trigger or a script that will report as civilian killed if attacked. I think that setting them "invisibile" (in the past) will make those group visible by you but not by your allied AI. Try, cause I don't know if this work in 1.2.6 or 1.2.7

 

but... I agree, a neutral faction and (imho) a third faction could be really interesting.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

  • Recently Browsing   0 members

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