Jump to content

Recommended Posts

Posted

Good evening! I am trying to revive an enemy aircraft that is set as uncontrolled. Not being able to Google my way to a solution I ended up back here.

From this website: https://wiki.hoggitworld.com/view/DCS_command_start this should be possible: "If a group is set to spawn in an uncontrolled state, this command can be sent to start the group. AI will take-off from the base and follow their route as designated."

However the setTask command does not work for me.

And while I'm at it... is there a lua command that enables me to open the canopy of the uncontrolled airplane? For the Mig-29s I am using it should be argument 38 set to a value of 0.9; but I can't figure out how to set it.

 

Thanks 🙂


-- Manipulate Mig Group
local MigGrp1 = Group.getByName('Bandit-1')

if MigGrp1:isExist() then

	local Start = { 
		id = 'Start', 
		params = {} 
	}
	
	MigCtrl1 = MigGrp1:getController()
	MigCtrl1:setTask(Start) -- <-- this does not work
	trigger.action.outText("Response: Mig Group started." , 35)
end
Posted

MigCtrl1:setCommand(Start)

The AI controller and tasks are split into 3 main categories of tasks, commands, and options. You need to use setTask* or pushTask for anything listed in main tasks and enroute tasks. setCommand for commands, and setOption for any option. 

 

*it is a bad idea to use setTask for anything other than main tasks. Basically setTask erases every task assigned, including the route the AI is following, and assigns whatever was set. Enroute tasks get executed as the AI follow their route... which would have just been erased. Commands and Options get executed immediately. So what would happen is the AI would RTB once the task that was set was completed. If you setTask on an attackUnit then the AI does that until the target unit is dead. I try to just use setTask on mission tasks that have waypoints assigned to it. 

pushTask pushes the assigned task to the top of the queue and then resumes with the route or whatever else is left to do. 

 

  • Like 1
  • Thanks 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

Thanks Grimes 🙂 That works perfectly 🙂

9 hours ago, Grimes said:

MigCtrl1:setCommand(Start)

The AI controller and tasks are split into 3 main categories of tasks, commands, and options. You need to use setTask* or pushTask for anything listed in main tasks and enroute tasks. setCommand for commands, and setOption for any option. 

 

*it is a bad idea to use setTask for anything other than main tasks. Basically setTask erases every task assigned, including the route the AI is following, and assigns whatever was set. Enroute tasks get executed as the AI follow their route... which would have just been erased. Commands and Options get executed immediately. So what would happen is the AI would RTB once the task that was set was completed. If you setTask on an attackUnit then the AI does that until the target unit is dead. I try to just use setTask on mission tasks that have waypoints assigned to it. 

pushTask pushes the assigned task to the top of the queue and then resumes with the route or whatever else is left to do. 

 

 

  • Recently Browsing   0 members

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