Jump to content
Lukeocyte

Random patrol to preset markers

Recommended Posts

Hi everyone,

 

Building a mission template for my friends and I and wanted to have units randomly patrol around the occupation zone. BIS_fnc_taskPatrol is great for infantry, but when used on vehicles sends them off road often causing them to explode/get stuck.

 

What I'd like to do is have vehicles choose specific markers to cycle between. Setting waypoints to cycle between works, but is there a way to make them choose waypoints at random? Ie. place down a set of markers and have a group randomly pick the first marker, then upon reaching it randomly choose a second one?

 

Thanks!

Share this post


Link to post
Share on other sites

This solution is a bit funky but simple:

 

wp = group this addWaypoint [getmarkerpos selectRandom ["marker_0","marker_1","marker_2","marker_3"], 0];
wp setWaypointType "MOVE";
wp setWaypointStatements ["true", "_wp = group this addWaypoint [getmarkerpos selectRandom [""marker_0"",""marker_1"",""marker_2"",""marker_3""], 0];_wp setWaypointType ""MOVE"";"];

 

Just give the vehicle an initial move waypoint and place some markers as seen in the example above.

Now put the above snippet into the initial waypoints on activation field.

Makes the unit move between all markers randomly and pick a new one once arrived.

 

Cheers

Share this post


Link to post
Share on other sites

Thanks for the response guys.

 

Grumpy, your script was perfect... just tested it out. Thanks!

 

Pierremgi, also a great solution am going to try and incorporate this as well. Thanks!

Share this post


Link to post
Share on other sites

Sorry to necro an old thread but im also lloking for a way to make AI stay on roads(to be more specific,have the WP destination be on a road) because AI vehicles who go off road inexplicably get stuck(not literally stuck on an object,they just do not complete the WP).

 

Is there a way to make the WPs cycle ? After all marker positions get reached once the vehicle stops,i just want them to keep moving through those random points

Share this post


Link to post
Share on other sites

The waypoints come in different types.  One type is called a Cycle waypoint. 

Share this post


Link to post
Share on other sites

That's two different things. Cycle waypoint is just a way to loop a path. Nothing more.

AIs stay on road (join the road by the shortest way if not already on it, drive on road, quit the road to join the last waypoint if not on road) with a SAFE behavior.

Read BIKI.

You can also try: setDriveOnPath    or forceFollowRoad (personally, I never saw the added value of this command..., but perhaps someone had a better experience on it).

 

Some roads on some maps are just broken. Especially, if you try to drive on bridges. Lingor is not fair for that (example). That depends also if you place a waypoint too close from the beginning of the bridge. sometimes a little separation can help for further waypoint. As rule of thumb, the less waypoints the better, even if the delay seems longer for path calculation.

 

There are plenty of reasons for a vehicle to be stuck. You'll save time reworking your scenario.

 

 

Share this post


Link to post
Share on other sites
20 hours ago, pierremgi said:

That's two different things. Cycle waypoint is just a way to loop a path. Nothing more.

AIs stay on road (join the road by the shortest way if not already on it, drive on road, quit the road to join the last waypoint if not on road) with a SAFE behavior.

Read BIKI.

You can also try: setDriveOnPath    or forceFollowRoad (personally, I never saw the added value of this command..., but perhaps someone had a better experience on it).

 

Some roads on some maps are just broken. Especially, if you try to drive on bridges. Lingor is not fair for that (example). That depends also if you place a waypoint too close from the beginning of the bridge. sometimes a little separation can help for further waypoint. As rule of thumb, the less waypoints the better, even if the delay seems longer for path calculation.

 

There are plenty of reasons for a vehicle to be stuck. You'll save time reworking your scenario.

 

 

Thanks,i had tried a variation of different scripting commands for this but i simply ended up with assining the gaurd waypoint to the vehicles as the mission area contains too many offroad areas and vehicles always get stuck when inevitably their estination gets far from a road.

 

The gaurd waypoint is fantastic as its always assigning new targets/locations throughout the mission and reliably keeping vehicles moving(most of the time)

  • 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

×