Jump to content

Recommended Posts

Posted
I think it's possible via moose scripting.

 

On dcs editor I managed to do that on groups

 

Inviato dal mio CPH1877 utilizzando Tapatalk

 

 

Yup, got the groups thing covered nicely thanks.......trying to extract as much as possible out of the base editor without using scripts like MOOSE etc for the moment, in the hope it makes the missions more resilient to updates...

  • 5 months later...
Posted

Anyone figure out how to do this? I am fine with scripting it, just don't know how. I imagine it has to do with something like OptionID.

 

 

My goal is to have both coalitions set to return fire until a trigger is fired, and then set coalitions to open fire. Thanks, any help is appreciated.

Posted (edited)

Here's an example to give you an idea.

--[[
AI.Option.Ground.Val.ROE
OPEN_FIRE              = 2
RETURN_FIRE            = 3
WEAPON_HOLD            = 4
--]]

function changeROE_openFire([color="blue"]coalitionSide[/color])
local groups = 0
for _, group in pairs(coalition.getGroups(coalitionSide)) do		
	if group:isExist() then
		groups = groups + 1
		local group_name = group:getName()
		group:getController():setOption(0, 2) --open fire

	end
end
trigger.action.outText("[ROE CHANGE] 'OPEN FIRE' activated for "..groups.." groups!",10)
end

function changeROE_holdFire([color="blue"]coalitionSide[/color])
local groups = 0
for _, group in pairs(coalition.getGroups(coalitionSide)) do			
	if group:isExist() then
		groups = groups + 1
		local group_name = group:getName()
		group:getController():setOption(0, 4) --hold fire						
	end
end
trigger.action.outText("[ROE CHANGE] 'WEAPON HOLD' activated for "..groups.." groups!",10)
end

 

coalitionSide can be 0 (neutral), 1 (red) or 2 (blue).

Edited by Catweedle
Addendum: uses the standard DCS API
Posted

Thanks Catweedle. However I am still having some trouble. I put what you gave me in a simple trigger that fires after 10 seconds and is just do script, but nothing happens, nor do I have any out text. I changed it to be

function changeROE_holdFire(1)
   local groups = 0
   for _, group in pairs(coalition.getGroups(1)) do            
       if group:isExist() then
           groups = groups + 1
           local group_name = group:getName()
           group:getController():setOption(0, 4) --hold fire                        
       end
   end
   trigger.action.outText("[ROE CHANGE] 'WEAPON HOLD' activated for "..groups.." groups!",10)
end

This should give me RED coalition changing to weapons hold. Additionally, when I check the dcs.log file, it doesn't have anything for me to see if something has gone wrong.

Posted
Thanks Catweedle. However I am still having some trouble. I put what you gave me in a simple trigger that fires after 10 seconds and is just do script, but nothing happens, nor do I have any out text.

 

You have to define/load the functions in a DO SCRIPT/DO SCRIPT FILE trigger action and subsequently call the function/-s with the desired argument (0, 1 or 2) in another DO SCRIPT / DO SCRIPT FILE to execute the code in their function bodies.

 

ROE-change of course also works without encapsulating the ROE-change in functions -- that's what you tried, but you have to remove the function definition, i.e. top and bottom line in your example.

 

I have attached a simple mission that defines the functions within the ME (vs. loading a script file) and makes them callable via F10-Other-radio (see SWITCHED CONDITION triggers in the mission).

change_roe_test.miz

Posted

By the way, you could also achieve this simple task with TRIGGERED ACTION's on single units or groups and trigger them via AI TASK PUSH/SET in trigger actions. (Learning) Scripting will give you much more possibilities on the long run, though.

Screen_200915_104125.jpg.366f562c186c6c43508630abbb887b9f.jpg

Screen_200915_104214.thumb.jpg.6bda6f02cdc28ba92834319419eb2d76.jpg

  • Recently Browsing   0 members

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