Jump to content

Setting/Changing/Updating Waypoints in a mission while its running using lua.


Drexx

Recommended Posts

Can you set/change/update waypoints for clients using a lua script while the mission is running.....

 

I just cant really believe after all this time we still don't have a way of doing this.... (can I give the mission task to the client group with the waypoints in it?)

Developer of DDCS MP Engine, dynamicdcs.com

https://forums.eagle.ru/showthread.php?t=208608

Link to comment
Share on other sites

absolutely. In one of my scripts I set waypoints for the client AC and it works just fine. Do it same way as setting waypoints for AI units.

 

For example:

 

 function addWaypoints(route, groupName)
   local wp = {}
   wp.speed = 100
   wp.x = route.x
   wp.y = route.y                
   wp.type = 'Turning Point'
   wp.ETA_locked = false
   wp.ETA = 100
   wp.alt = 500
   wp.alt_type = "BARO"
   wp.speed_locked = true
   wp.action = "Fly Over Point"
   wp.airdromeId = nil
   wp.helipadId = nil
 
   local wp1 = {}
   wp1.speed = 500
   wp1.x = route.x
   wp1.y = route.y                
   wp1.type = 'Turning Point'
   wp1.ETA_locked = false
   wp1.ETA = 100
   wp1.alt = 500
   wp1.alt_type = "BARO"
   wp1.speed_locked = true
   wp1.action = "Fly Over Point"
   wp1.airdromeId = nil
   wp1.helipadId = nil
   
   local newRoute = {}
   newRoute[1]=wp1
   --newRoute[#newRoute+1]=wp1
   
   local newTask = {
       id = 'Mission',
       params = {
           route = {
               points = newRoute,
           },
       },
   }
   local group = Group.getByName(groupName)    
   local ctrl = group:getController()
   ctrl:pushTask(newTask)    
 end


Edited by sea2sky
  • Like 1

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

absolutely. In one of my scripts I set waypoints for the client AC and it works just fine. Do it same way as setting waypoints for AI units.

 

For example:

 

 function addWaypoints(route, groupName)
   local wp = {}
   wp.speed = 100
   wp.x = route.x
   wp.y = route.y                
   wp.type = 'Turning Point'
   wp.ETA_locked = false
   wp.ETA = 100
   wp.alt = 500
   wp.alt_type = "BARO"
   wp.speed_locked = true
   wp.action = "Fly Over Point"
   wp.airdromeId = nil
   wp.helipadId = nil
 
   local wp1 = {}
   wp1.speed = 500
   wp1.x = route.x
   wp1.y = route.y                
   wp1.type = 'Turning Point'
   wp1.ETA_locked = false
   wp1.ETA = 100
   wp1.alt = 500
   wp1.alt_type = "BARO"
   wp1.speed_locked = true
   wp1.action = "Fly Over Point"
   wp1.airdromeId = nil
   wp1.helipadId = nil
   
   local newRoute = {}
   newRoute[1]=wp1
   --newRoute[#newRoute+1]=wp1
   
   local newTask = {
       id = 'Mission',
       params = {
           route = {
               points = newRoute,
           },
       },
   }
   local group = Group.getByName(groupName)    
   local ctrl = group:getController()
   ctrl:pushTask(newTask)    
 end

I just started a thread specifically for naval vessels. I've tried an approach similar to this that works for AC/Land units, but not for naval. Have you had any luck tasking ships?

Link to comment
Share on other sites

absolutely. In one of my scripts I set waypoints for the client AC and it works just fine. Do it same way as setting waypoints for AI units.

 

What aircraft type is your client aircraft? I just tried it with an A-10C and could not get it to work.

 

I added an A-10C (group name "a10c") to a mission, skill set to "Client", runway start.

I started the mission, jumped into the A-10C, and then executed the following code:

 

	local cpos = Group.getByName("a10c"):getUnit(1):getPosition().p

local wp = {}
   wp.speed = 100
   wp.x = cpos.x
   wp.y = cpos.y                
   wp.type = 'Turning Point'
   wp.ETA_locked = false
   wp.ETA = 100
   wp.alt = 500
   wp.alt_type = "BARO"
   wp.speed_locked = true
   wp.action = "Fly Over Point"
   wp.airdromeId = nil
   wp.helipadId = nil
 
   local wp1 = {}
   wp1.speed = 500
   wp1.x = cpos.x + 1000
   wp1.y = cpos.y + 10000
   wp1.type = 'Turning Point'
   wp1.ETA_locked = false
   wp1.ETA = 100
   wp1.alt = 500
   wp1.alt_type = "BARO"
   wp1.speed_locked = true
   wp1.action = "Fly Over Point"
   wp1.airdromeId = nil
   wp1.helipadId = nil
wp1.name = "BAR"
   
   local newRoute = {}
   newRoute[1]=wp
   newRoute[#newRoute+1]=wp1
   
   local newTask = {
       id = 'Mission',
       params = {
           route = {
               points = newRoute,
           },
       },
   }
   local group = Group.getByName("a10c")
   local ctrl = group:getController()
   ctrl:pushTask(newTask)    

 

My waypoints did not change at all.

Link to comment
Share on other sites

Ian;3170110']What aircraft type is your client aircraft? I just tried it with an A-10C and could not get it to work.

 

I added an A-10C (group name "a10c") to a mission, skill set to "Client", runway start.

I started the mission, jumped into the A-10C, and then executed the following code:

 

    
   local cpos = Group.getByName("a10c"):getUnit(1):getPosition().p

   local wp = {}
   wp.speed = 100
   wp.x = cpos.x
   wp.y = cpos.y                
   wp.type = 'Turning Point'
   wp.ETA_locked = false
   wp.ETA = 100
   wp.alt = 500
   wp.alt_type = "BARO"
   wp.speed_locked = true
   wp.action = "Fly Over Point"
   wp.airdromeId = nil
   wp.helipadId = nil
 
   local wp1 = {}
   wp1.speed = 500
   wp1.x = cpos.x + 1000
   wp1.y = cpos.y + 10000
   wp1.type = 'Turning Point'
   wp1.ETA_locked = false
   wp1.ETA = 100
   wp1.alt = 500
   wp1.alt_type = "BARO"
   wp1.speed_locked = true
   wp1.action = "Fly Over Point"
   wp1.airdromeId = nil
   wp1.helipadId = nil
   wp1.name = "BAR"
   
   local newRoute = {}
   newRoute[1]=wp
   newRoute[#newRoute+1]=wp1
   
   local newTask = {
       id = 'Mission',
       params = {
           route = {
               points = newRoute,
           },
       },
   }
   local group = Group.getByName("a10c")
   local ctrl = group:getController()
   ctrl:pushTask(newTask)    

My waypoints did not change at all.

 

Worked for Su-25T for sure. I think you should use position a bit differently:

 

local cpos = Group.getByName("a10c"):getUnit(1):getPosition().p
[b]wp.x = cpos.x
wp.y = cpos.z
wp.alt = cpos.y

...

[/b][b]wp1.x = cpos.x
wp1.y = cpos.z
wp1.alt = cpos.y
[/b]

Also, the coordinates for both route points should match (see above) - that will create a single waypoint. This is my observation, and I might be wrong, but that is how it worked for me.

 

I will check the current version of that script tonight and test/see what works what does not. Will keep posted.


Edited by sea2sky

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

I confirm the code below works in MP for client Su-25T and Su-25, but unfortunately it does not for A-10C :(. I guess the reason is a simplification of waypoint management/loading mechanism for those 2 aircraft modules.

 

 function addWaypoints(route, groupName)

   local wp1 = {}
   wp1.speed = 500
   wp1.x = route.x
   wp1.y = route.y                
   wp1.type = 'Turning Point'
   wp1.ETA_locked = false
   wp1.ETA = 100
   wp1.alt = 500
   wp1.alt_type = "BARO"
   wp1.speed_locked = true
   wp1.action = "Fly Over Point"
   wp1.airdromeId = nil
   wp1.helipadId = nil
   
   local newRoute = {}
   newRoute[#newRoute+1]=wp1
   
   local newTask = {
       id = 'Mission',
       params = {
           route = {
               points = newRoute,
           },
       },
   }
   local group = Group.getByName(groupName)    
   local ctrl = group:getController()
   ctrl:pushTask(newTask)    
 end

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

  • 6 years later...
  • Recently Browsing   0 members

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