Jump to content
Sign in to follow this  
redpiano

How do I create dynamic patrols now?

Recommended Posts

Since they took out the dynamic patrol module how am I supposed to create patrols now that start in random locations, patrol random locations and spawn in random numbers without using some buggy script?

Share this post


Link to post
Share on other sites

I cant believe BIS hasn't set this up yet!!!! Ugg!

You'd think they setup so you can set down a Marker, the Random Patrol Module, and Sync those to any and all Units

you want to Patrol randomly within that Marker. Final Release is just two weeks away.

Here's a good quick-n-dirty in-Editor way that I use without scripts:

Place 1 Unit with X Radius and Y% Spawn Probability. Then set down your 7-12 Waypoints with Z Radius around the

area you want them to Patrol. Just set ALL of them in a clump in the middle. Set the LAST Waypoint down and set

it to CYCLE and place away from the others and next to your Unit so it will click into that first Waypoint. Done.

Then select ALL Waypoints & your Unit. Copy (Ctrl+C) and then Paste (Ctrl+V) several more down. Wham! Patrols!!

Share this post


Link to post
Share on other sites
You'd write a non buggy script.

Sorry not going to learn how to script so I can fix the functionality that they decided to remove.

I cant believe BIS hasn't set this up yet!!!! Ugg!

You'd think they setup so you can set down a Marker, the Random Patrol Module, and Sync those to any and all Units

you want to Patrol randomly within that Marker. Final Release is just two weeks away.

Here's a good quick-n-dirty in-Editor way that I use without scripts:

Place 1 Unit with X Radius and Y% Spawn Probability. Then set down your 7-12 Waypoints with Z Radius around the

area you want them to Patrol. Just set ALL of them in a clump in the middle. Set the LAST Waypoint down and set

it to CYCLE and place away from the others and next to your Unit so it will click into that first Waypoint. Done.

Then select ALL Waypoints & your Unit. Copy (Ctrl+C) and then Paste (Ctrl+V) several more down. Wham! Patrols!!

Thank you I will give this a try.

Share this post


Link to post
Share on other sites
Sorry not going to learn how to script so I can fix the functionality that they decided to remove.

Thank you I will give this a try.

Actually, there still is a way to make random patrols with AI. Basically same thing that would be in a module, but its in a function instead.

[group this,getpos this, urdistance (number)] call BIS_fnc_taskPatrol;

in a group leaders init box will make a random patrol around X distance you set for it around where the units position starts from. You can change

getpos this

to any object name and the unit will get waypoints around that defined object/unit.

Group this 

just defines who we're running the function on.

Share this post


Link to post
Share on other sites

Ahhhhh very interesting, okay I'll see if I can get that to work then.

Share this post


Link to post
Share on other sites

Function viewer in the editor on the top bar is there for a reason ^^ use it and you will discover lots of little things that aren't in module form that could be useful to make some quick patrols/defenses. (BIS_fnc_taskDefend)

Share this post


Link to post
Share on other sites

I'd still explore just using the editor/editor units/waypoints/triggers as Goblin mentioned, why I say that is because it can give you more control over a lot of things and still be dynamic with things like waypoint radius and type group behaviour and probability of presence etc.. It can take a bit of patience to setup things but can be very rewarding once you get the hang of it. You can also make very complex missions by using the merge option in the editor.

Share this post


Link to post
Share on other sites

The problem is I can't read the functions viewer, I have no experience with any kind of programming languages and the stuff in the function viewer is not very noob friendly to understand.

Also when trying to use the function mentioned above it's telling me to put a bracket between urdistance and the number, not sure why.

Edited by redpiano

Share this post


Link to post
Share on other sites

For the most part all you need to read from the functions view is the top part between /* and */ which would be the comments. It should explain what you need for each input and how to call it. For example the top part of taskPatrol says:

/*

File: taskPatrol.sqf

Author: Joris-Jan van 't Land

Description:

Create a random patrol of several waypoints around a given position.

Parameter(s):

_this select 0: the group to which to assign the waypoints (Group)

_this select 1: the position on which to base the patrol (Array)

_this select 2: the maximum distance between waypoints (Number)

_this select 3: (optional) blacklist of areas (Array)

Returns:

Boolean - success flag

*/

So we see there are 4 paramenter we need for this function, one of which is optional. The name of the function is way up top, BIS_fnc_taskPatrol. So we create it like this:

// using a group, a position and a number as our arguments
_null = [group this, getPos player, 50] spawn BIS_fnc_taskPatrol.

That will cause the group of whoever's init field that is (group this) to patrol around the location of the player (getPos player) with 50 meters between each random waypoint.

Granted you need to know some amount of scripting to get here, such as how to call functions and what a parameter/argument/whatever is, but it's enough to just copy paste that example into an init field to get it working.

Any questions about that?

Share this post


Link to post
Share on other sites

Okay well now I have it set to

[group G1, getpos 491783, (50)] call BIS_fnc_taskPatrol;

and it's saying "expected object type number"

---------- Post added at 18:38 ---------- Previous post was at 18:31 ----------

Okay I got it working but I can't get the getPos to work on a building only on the player.

Share this post


Link to post
Share on other sites

Is that 491783 a grid reference? You'd want to put a marker down there by your building, (default empty one would do and name it "patrol") then change it to read:

_null = [group G1, getMarkerPos "patrol", 50] call BIS_fnc_taskPatrol;

The error is because getPos is expecting an object like 'player' or 'G1' or something similar and you had a number there instead.

Share this post


Link to post
Share on other sites

It's a building ID. I see there's a function to make a group patrol the inside of a building can you tell me how to get that to work?

Share this post


Link to post
Share on other sites

ahh ok

for building ID you could do this:

_null = [group G1, getPos (position G1 nearestObject 491783), 50] call BIS_fnc_taskPatrol;

Share this post


Link to post
Share on other sites

Saying you dont want to learn scripting, but you want to use the editor... well mate you will learn scripting no matter lol!

Its how we all started. I started in OFP I refused to learn scripting, but in the end I picked things up. Kylania though, knows his stuff.

Best of luck mate. Need anything just ask :)

Edited by Woodpeckersam

Share this post


Link to post
Share on other sites

Another option from the mysterious 'Goblin'...

Super short, super simple, dynamic results:

1.Place Unit(s) 2.Place Waypoint right in front set to DISMISSED; Behavior SAFE.

The Game will keep generating Random Waypoints over and over again! the Unit(s)

will wonder all over the place. Works great. Downside though, is you can't restrict

them to stay in a small pre-defined area. Fast & Easy mate! Mix & Match. Try it... ;)

Share this post


Link to post
Share on other sites

Hello again guys, now for some reason I'm getting an error when starting a mission and the groups I dropped are just standing still instead of patrolling.

This is the init code

[group G1, getPos P1, (150)] call BIS_fnc_taskPatrol;

I have one for each group with the group and getpos ID changed for each and a corresponding marker on the map with the correct ID.

This is the error message

http://img802.imageshack.us/img802/9430/6qx.jpg (363 kB)

---------- Post added at 11:48 ---------- Previous post was at 11:34 ----------

I tried changing "getpos" to "getMarkerPos" and the error still occurs.

Share this post


Link to post
Share on other sites

If P1 is a marker:

getMarkerPos "P1"

Objects don't have " " while markers need " " around them.

Share this post


Link to post
Share on other sites

Do you guys have trouble with the built in random patrol module? It works as intended for me.

Share this post


Link to post
Share on other sites

How do you use the Random Patrol site module I cant figure it out please help thanks?

Share this post


Link to post
Share on other sites

I believe it still works like

, well this is one way to use it. Have not tried it but dont think its changed since that video. Edited by Larrow

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
Sign in to follow this  

×