Varry Posted November 8, 2020 Posted November 8, 2020 Hi, I would like to force a unit to head towards another waypoint, when the trigger is activated. The unit is en route to waypoint 1; I want to have it move to waypoint 2 as soon the trigger's activated; even though the unit hasn't reached waypoint 1 yet. can anyone help me please?
toutenglisse Posted November 8, 2020 Posted November 8, 2020 You can use "do script" with these 2 functions : https://wiki.hoggitworld.com/view/DCS_command_switchWaypoint and https://wiki.hoggitworld.com/view/DCS_func_setCommand In the "do script" box copy/paste these lines (with your Wpt numbers and unit name) : SwitchWaypoint = { id = 'SwitchWaypoint', params = { fromWaypointIndex = number, goToWaypointIndex = number, } } Group.getByName('your unit name'):getController():setCommand(SwitchWaypoint)
ChillNG Posted November 9, 2020 Posted November 9, 2020 You can also just trigger the action 'AI Task Push' to push a triggered action from the aircraft menu. Under triggered actions you'll find Perform Command - Switch Waypoint. 1
Varry Posted November 10, 2020 Author Posted November 10, 2020 You can use "do script" with these 2 functions : https://wiki.hoggitworld.com/view/DCS_command_switchWaypoint and https://wiki.hoggitworld.com/view/DCS_func_setCommand In the "do script" box copy/paste these lines (with your Wpt numbers and unit name) : SwitchWaypoint = { id = 'SwitchWaypoint', params = { fromWaypointIndex = number, goToWaypointIndex = number, } } Group.getByName('your unit name'):getController():setCommand(SwitchWaypoint) Thanks; but it doesn't work. I calld the group that needs to switch "aggressors"; i edited your script to; SwitchWaypoint = { id = 'SwitchWaypoint', params = { fromWaypointIndex = 1, goToWaypointIndex = 2, } } Group.getByName('aggressors'):getController():setCommand(SwitchWaypoint) Conditions are ok, a i also set a text display when trigger is activated; text gets displayed, but the agressors do not change course.
Varry Posted November 10, 2020 Author Posted November 10, 2020 Found this; https://forums.eagle.ru/forum/english/digital-combat-simulator/dcs-world-2-5/bugs-and-problems-ai/ai-ad/207917-reported-ai-task-push-switch-waypoint-broken jeez; another bug
toutenglisse Posted November 10, 2020 Posted November 10, 2020 Thanks; but it doesn't work... I tried quickly - if I don't mistake waypoint number starts from "0" in M.E. but from point "1" in script, so it's switch Wpt from 2 to 3 (instead 1 to 2), and it "works" ... I mean something happens, but it looks bugged effectively. Here a .miz exemple, the script is triggered at 8 seconds in mission. (AI doesn't change heading from 1 to 2, but instead does a large turning route to 1 and then goes to 2)test-switchWpt.miz
Varry Posted November 11, 2020 Author Posted November 11, 2020 I tried quickly - if I don't mistake waypoint number starts from "0" in M.E. but from point "1" in script, so it's switch Wpt from 2 to 3 (instead 1 to 2), and it "works" ... I mean something happens, but it looks bugged effectively. Here a .miz exemple, the script is triggered at 8 seconds in mission. (AI doesn't change heading from 1 to 2, but instead does a large turning route to 1 and then goes to 2) Thank you so much for your help!! I'll have a go and I'll let you know!! Thanks!! OT: this was your 1000th post!!! congrats!!
toutenglisse Posted November 11, 2020 Posted November 11, 2020 Thanks Varry, but I've been useless to make the scripted function to work. But it works flawlessly the way ChillNG described in his post - and it is simpler. Here an exemple (trigger is activating flag 1 at 8 seconds in mission - AI has advanced waypoint action to switchWpt when Flag 1 is true) Thanks to him!test-switchWpt-MEfunction.miz 1
Varry Posted November 11, 2020 Author Posted November 11, 2020 Thanks Varry, but I've been useless to make the scripted function to work. But it works flawlessly the way ChillNG described in his post - and it is simpler. Here an exemple (trigger is activating flag 1 at 8 seconds in mission - AI has advanced waypoint action to switchWpt when Flag 1 is true) Thanks to him! I thank you both! Your script works: problem was the waypoint numbers. I works perfectly now, no sign of bug.
Recommended Posts