Nemanjic 71 Posted May 7, 2022 I want the script to be executed only when wp is reached, but this script activates sqf one after another no waiting for the helicopter's arrival at the waypoint. Even worse, it repeats the process after the last script is executed. So the question is: how to execute the script only if the helicopter reaches a specific point (waypoint)? //radio centers PATROL - ch47wptow0 = group pil1 addWaypoint [position rc_01, 0]; wptow0 setWaypointBehaviour "SAFE"; wptow0 setWaypointCombatMode "YELLOW"; wptow0 setWaypointSpeed "FULL"; wptow0 setWaypointType "SCRIPTED"; wptow0 setWaypointScript "skripte\wp0.sqf"; sleep 0.2; wptow1 = group pil1 addWaypoint [position rc_02, 1]; wptow1 setWaypointBehaviour "SAFE"; wptow1 setWaypointCombatMode "YELLOW"; wptow1 setWaypointSpeed "FULL"; wptow1 setWaypointType "SCRIPTED"; wptow1 setWaypointScript "skripte\wp1.sqf"; sleep 0.2; wptow2 = group pil1 addWaypoint [position rc_03, 2]; wptow2 setWaypointBehaviour "SAFE"; wptow2 setWaypointCombatMode "YELLOW"; wptow2 setWaypointSpeed "FULL"; wptow2 setWaypointType "SCRIPTED"; wptow2 setWaypointScript "skripte\wp2.sqf"; sleep 0.2; wptow3 = group pil1 addWaypoint [position rc_01, 3]; wptow3 setWaypointBehaviour "SAFE"; wptow3 setWaypointCombatMode "YELLOW"; wptow3 setWaypointSpeed "FULL"; wptow3 setWaypointType "SCRIPTED"; wptow3 setWaypointScript "skripte\wp3.sqf"; wptow3 setWaypointType "CYCLE"; SQF example (only one line and only difference is tower numbers..): systemChat "Helicopter loiter Tower 1"; Share this post Link to post Share on other sites
Harzach 2517 Posted May 7, 2022 wptow0 setWaypointScript "skripte\wp0.sqf"; Pretty sure that this fires when the waypoint becomes active/current waypoint, not when it is completed. For that, use setWaypointStatements. Share this post Link to post Share on other sites
Harzach 2517 Posted May 7, 2022 https://community.bistudio.com/wiki/Waypoints#Scripted Quote Scripted ... The group will not move to the waypoint location. The group will wait until the external script exits before moving on to the next waypoint. ... Note the On Activation script code block can be used to execute any script at any waypoint, making this waypoint type somewhat redundant. So, basically what I said, only the waypoint isn't really a waypoint as you think of it. As the Biki says, it's kind of redundant. If you want a script to run when a waypoint becomes active, run the script from the previous waypoint's On Activation field (or setWaypointStatements if scripting). If you want a script to run when a waypoint is complete, run the script from that waypoint's On Activation field (or setWaypointStatements if scripting). wptow0 = group pil1 addWaypoint [position rc_01, 0]; wptow0 setWaypointBehaviour "SAFE"; wptow0 setWaypointCombatMode "YELLOW"; wptow0 setWaypointSpeed "FULL"; wptow0 setWaypointType "MOVE"; wptow0 setWaypointStatements "skripte\wp0.sqf"; sleep 0.2; 1 Share this post Link to post Share on other sites
Nemanjic 71 Posted May 7, 2022 Thanks for the quick reply! Yes, I read about this from wiki and found it is a little bit confusing for me so I decided to try it this way and post it here after that. Testing right now and will report back shortly... Share this post Link to post Share on other sites
Nemanjic 71 Posted May 7, 2022 Replacing wptow2 setWaypointType "SCRIPTED"; wptow2 setWaypointScript "skripte\wp2.sqf"; with wptow2 setWaypointStatements ["true", "systemChat 'Helicopter loiter Tower 3'"]; and so on with other WPs... works as it should! Also, I figured out about helicopter location and reporting position on which tower is loitering on exact wp! Thank you for exactly knowing what to tell me in terms of help! But next thing: Yes, I managed to set the correct route and make the heli report the correct position via systemChat but I also need to run a script at one of these waypoints and that will be for refueling the heli. So the next goal is to learn how to run sqf when a waypoint is complete? The script will be a simple helicopter setFuel 1; The flight should be very long, about 28 game days which is about 4.5 days in real-time (time multiplier is 6) so I need this refuel to be a loop and make heli full on a regular basis. Thanks in advance Share this post Link to post Share on other sites
Harzach 2517 Posted May 7, 2022 16 minutes ago, Nemanjic said: So the next goal is to learn how to run sqf when a waypoint is complete? 1 hour ago, Harzach said: If you want a script to run when a waypoint is complete, run the script from that waypoint's On Activation field (or setWaypointStatements if scripting). You're already doing that with the systemChat. wptow## setWaypointStatements ["true", "helicopter setFuel 1"]; Share this post Link to post Share on other sites
Nemanjic 71 Posted May 7, 2022 Yea but, Example 1: _waypoint setWaypointStatements ["true", "hint 'hello'; hint 'goodbye'"]; Example 2: _waypoint setWaypointStatements ["true", "diag_log ['GroupLeader: ', this]; diag_log ['Units: ', thislist]"]; I can't understand how to implement the call for .sqf from these examples. This is from wiki. I though it is with setWaypointType "SCRIPTED"; but I have to replace it one step before. Ok I will try wptow2 setWaypointStatements ["true", "skripte\helrefuel.sqf"]; to see what's going on. Share this post Link to post Share on other sites
Nemanjic 71 Posted May 7, 2022 12 minutes ago, Harzach said: wptow## setWaypointStatements ["true", "helicopter setFuel 1"]; Yes but there was an exact example from the wiki I just replace hint with systemChat but can't understand how to call an external file. Don't see nothing familiar to me like execVM or call or something.. Will try something like wptow2 setWaypointStatements ["true", "skripte\helrefuel.sqf"]; and report back Share this post Link to post Share on other sites
Harzach 2517 Posted May 7, 2022 Just now, Nemanjic said: but can't understand how to call an external file. execVM. wptow2 setWaypointStatements ["true", "nul = execVM 'skripte\helrefuel.sqf'"]; 1 Share this post Link to post Share on other sites
Nemanjic 71 Posted May 7, 2022 Can't thank you enough brother! Not just for time but for the way you explain that everyone who reads - learns! This is a highly important scenario for my unit as it stands for the last and most difficult training process for new recruits. Now, instead we spend a holiday in 10-days scripting and fixing we can finally enjoy playing v2 of this training scenario thanks to your help in the last few days with important things. You, pieremgi, and others love you, and greetings from all my Arma soldiers! Edit: Yes, wptow2 setWaypointStatements ["true", "nul = execVM 'skripte\helrefuel.sqf'"]; works of course 😉 1 Share this post Link to post Share on other sites