Jump to content

How is setTask format working?


Lumax
 Share

Recommended Posts

Im trying to set a task for my group. basically a bunch of waypoins.

 

im reading this http://wiki.hoggit.us/view/DCS_task_mission

 

now my problem is that how do i make it execute a script code on a waypoint. ? example wp3 ?

 

lets say i have something like this.

 

local object = Group.getByName('convoy')
local leader = Unit.getByName('ConvoyUnit #1')
local control = object:getController()

local wp1 = leader:getPosition()
local wp2 = trigger.misc.getZone('Trigger Zone A')
local wp3 = trigger.misc.getZone('Trigger Zone B')


local x1 = wp1.p.x
local y1 = wp1.p.z
local x2 = wp2.point.x
local y2 = wp2.point.z
local x3 = wp3.point.x
local y3 = wp3.point.z
   
local path = {
   [1] = { 
       type = 'Turning Point',
       action = 'Off Road',
       x = x1, 
       y = x1, 
       speed = 20, 
       name = 'WP1', 
   },                        
   [2] = { 
       type = 'Turning Point',
       action = 'Off Road',
       x = x2, 
       y = y2, 
       speed = 20, 
       name = 'WP2', 
   },
   [3] = { 
       type = 'Turning Point',
       action = 'Off Road',
       x = x3, 
       y = y3, 
       speed = 20, 
       name = 'WP3', 
   },
}

local mission = { 
   id = 'Mission', 
   params = { 
       route = { 
           points = path,
       }    
   }
}
       
Controller.pushTask(control, mission)

I guess i need to add something like this to Wp3 but not sure of the correct format

               ["task"] = {
                   ["id"] = "ComboTask",
                   ["params"] = {
                       ["tasks"] = {
                           [1] = {
                               ["number"] = 1,
                               ["auto"] = false,
                               ["id"] = "WrappedAction",
                               ["enabled"] = true,
                               ["params"] = {
                                   ["action"] = {
                                       ["id"] = "Script",
                                       ["params"] = {
                                           ["command"] = "DO MY CODE HERE",
                                       }, -- end of ["params"]
                                   }, -- end of ["action"]
                               }, -- end of ["params"]
                           }, -- end of [1]
                       }, -- end of ["tasks"]
                   }, -- end of ["params"]
               }, -- end of ["task"]

 

Edit: never mind. im stupid,the answer is in my post

 

--


Edited by Lumax
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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