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


Notices

Reply
 
Thread Tools Display Modes
Old 06-09-2017, 05:47 PM   #1
Drexx
Member
 
Join Date: Jul 2016
Posts: 112
Reputation power: 2
Drexx is on a distinguished road
Default Setting/Changing/Updating Waypoints in a mission while its running using lua.

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 for the -=16AGR=- US East Dynamic Caucasus Server. Come in and join the fun with a fast and fully fleshed out PVP/PVE map with Sling Loading, fully fleshed out base defenses, convoys, and automated events.
Drexx is offline   Reply With Quote
Old 06-09-2017, 06:48 PM   #2
ruskybeaver
Member
 
ruskybeaver's Avatar
 
Join Date: Jun 2016
Location: Vancouver, BC
Posts: 555
Reputation power: 5
ruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the rough
Default

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:

Code:
  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
__________________
...i5-4690|16Gb|gtx-970-OC4G|Rift CV1|2560x2640...

Universal Radar for DCS ver 3.0

Last edited by ruskybeaver; 06-09-2017 at 06:51 PM.
ruskybeaver is offline   Reply With Quote
Old 06-10-2017, 12:03 AM   #3
Kyridious
Junior Member
 
Join Date: Oct 2013
Posts: 39
Reputation power: 4
Kyridious is on a distinguished road
Default

Quote:
Originally Posted by ruskybeaver View Post
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:

Code:
  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?
Kyridious is offline   Reply With Quote
Old 06-10-2017, 07:22 PM   #4
FlightControl
Senior Member
 
FlightControl's Avatar
 
Join Date: Mar 2012
Location: Antwerp, Belgium
Posts: 1,630
Reputation power: 15
FlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really niceFlightControl is just really nice
Default

Pikey, can you answer this please :-)
__________________
FlightControl is offline   Reply With Quote
Old 06-16-2017, 08:38 PM   #5
[FSF]Ian
ED Testers Team
 
Join Date: Feb 2013
Location: Dortmund, Germany
Posts: 1,176
Reputation power: 12
[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice[FSF]Ian is just really nice
Default

Quote:
Originally Posted by ruskybeaver View Post
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:

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.
[FSF]Ian is offline   Reply With Quote
Old 06-16-2017, 08:58 PM   #6
ruskybeaver
Member
 
ruskybeaver's Avatar
 
Join Date: Jun 2016
Location: Vancouver, BC
Posts: 555
Reputation power: 5
ruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the rough
Default

Quote:
Originally Posted by [FSF]Ian View Post
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:

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:

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

...

wp1.x = cpos.x
wp1.y = cpos.z
wp1.alt = cpos.y
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.
__________________
...i5-4690|16Gb|gtx-970-OC4G|Rift CV1|2560x2640...

Universal Radar for DCS ver 3.0

Last edited by ruskybeaver; 06-16-2017 at 09:31 PM.
ruskybeaver is offline   Reply With Quote
Old 06-18-2017, 02:24 AM   #7
Delta99
Member
 
Delta99's Avatar
 
Join Date: Jan 2017
Posts: 109
Reputation power: 1
Delta99 is on a distinguished road
Default

I've tried something similar for F15C's and always crashes to desktop for client but works fine on AI group.
__________________
My Missions: Valley Patrol Mission :: Valley Escort Mission
Delta99 is offline   Reply With Quote
Old 06-19-2017, 05:58 PM   #8
ruskybeaver
Member
 
ruskybeaver's Avatar
 
Join Date: Jun 2016
Location: Vancouver, BC
Posts: 555
Reputation power: 5
ruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the roughruskybeaver is a jewel in the rough
Default

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.

Code:
  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-4690|16Gb|gtx-970-OC4G|Rift CV1|2560x2640...

Universal Radar for DCS ver 3.0
ruskybeaver is offline   Reply With Quote
Old 06-21-2017, 04:40 PM   #9
Delta99
Member
 
Delta99's Avatar
 
Join Date: Jan 2017
Posts: 109
Reputation power: 1
Delta99 is on a distinguished road
Default

My guess is that the different modules have to support this in some way but sounds like a definite bug that should be reported.
__________________
My Missions: Valley Patrol Mission :: Valley Escort Mission
Delta99 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:15 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.