Jump to content
LordX71

Waypoint cycle switched to other waypoint

Recommended Posts

Hello everyone, I have a problem, I would like my patrols that follow their waypoint to stop repeating their task to move to another waypoint. I thought it simple and I redid the floof model on the article https://forums.bohemia.net/forums/topic/215636-how-to-make-ai-patrol-switch-to-a-reinforce -waypoint / but it doesn't work for me, my patrols don't break the cycle

 

https://steamcommunity.com/sharedfiles/filedetails/?id=2128164740 it is the screenshoot of my own version but it is exactly the same of the floof model

Share this post


Link to post
Share on other sites

I also thought of setting my triggers in blufor present and sync the waypoint with the triggers. and I also try the triggerActivated command but nothing helps the cycle did not break

Share this post


Link to post
Share on other sites

Well a more sophisticated way is via the videos below:

 

 

 

Share this post


Link to post
Share on other sites

65D07F6714CA09C9CEC400DA8B656942FB62BE5C

i don't want to delete waypoints but i just want it to go to another waypoint cycle with the help of a trigger

Share this post


Link to post
Share on other sites

I will have to test it but due to exams it might take a while. I know you would rather not delete the waypoints. Just suggested it since the other way does not work. For a simpler solution you can try :

 

https://community.bistudio.com/wiki/setCurrentWaypoint

https://community.bistudio.com/wiki/Waypoint

 

(still not like your initial method) 

Share this post


Link to post
Share on other sites
On ‎6‎/‎12‎/‎2020 at 10:14 AM, LordX71 said:

my patrols don't break the cycle

 

With mods, or without mods? 

Share this post


Link to post
Share on other sites

if you place a trigger, don't link it, just place a little code on activation, to script something deleting the waypoints and adding a new one:

 

while {(count (waypoints yourGroupHere)) > 0} do {
     deleteWaypoint ((waypoints yourGroupHere) #0)
};
wp = yourGroupHere addWaypoint [ NewPositionHere ,0];
wp setWaypointType "MOVE";
wp setWaypointBehaviour "COMBAT";
wp setWaypointSpeed "FULL";
yourGroupHere allowFleeing 0;

 

I just read that you don't want to delete the waypoints??  I'm not sure to understand why, but scripting is your solution. You can re-add these old waypoints with some conditions.

 

So, my last, in the init field of your GROUP ICON:
 

0 = this spawn {
  _anArrayOfWaypoints = [getMarkerPos "m1",getMarkerPos "m2",getMarkerPos "m3",getMarkerPos "m4",getMarkerPos "m5"];
  While {count units  _this >0} do {
    private _anArrayOfWaypoints = _anArrayOfWaypoints call Bis_fnc_arrayShuffle;
    while {(count (waypoints _this)) > 0} do {  deleteWaypoint ((waypoints _this) #0)};
    private _newNbrOfWpts = floor random (count _anArrayOfWaypoints ) max 2;
    For "_i" from 0 to _newNbrOfWpts do {
      _wp = _this addWaypoint [ _anArrayOfWaypoints #_i ,0];
    };
    waitUntil {sleep 2; currentWaypoint _this == _newNbrOfWpts+1};
  };
};

where:

this is for your group (not unit!)

[getMarkerPos "m1",getMarkerPos "m2",getMarkerPos "m3",getMarkerPos "m4",getMarkerPos "m5"] must be replaced by your own path positions (all of them)

How does it work:

while there is at least one unit in group, you shuffle the waypoints, you delete any existing wpt (not mandatory but safe); you pick at least 3 wpts (or more) and your group proceeds to path until the last waypoint is reached then you restart a shuffle, point at least 3 waypoints....etc

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×