Jump to content

Recommended Posts

I know there are dozen of different kinds of patrol related scripts available. I will still chip in with this simple one. It is based on BIN_taskPatrol for A2 by Binesi, which is based on BIS_fnc_taskPatrol. I have simplified it even further. The way I like to use it is to create a patrol group and then paste the execvm line into it's leader's init. Then copy-paste the whole group couple of times around the mission area. Simple and fast.

The script will create waypoints in a circlish manner around the starting position of the group. Waypoints placement and count is based on the distance parameter; longer it is, the more WPs there will be. Normally the group will go clock-wise around them, but each WP has a chance to make the next WP random. Thus, creating some unpredictability.

SHK_patrol.sqf

/*
 Required Parameters:
   0 Object or Group     The patrolling unit

 Optional Parameters:
   1 Number              Distance from the unit's starting position to create waypoints. Default is 250.

 Usage:
   Start from group leader's init field or from init.sqf:
     nul = [params] execVM "shk_patrol.sqf";

   Examples:
     nul = this execVM "shk_patrol.sqf";
     nul = [this,350] execVM "shk_patrol.sqf";
     nul = [grpA,300] execVM "shk_patrol.sqf";
*/
 

2021 reupload https://drive.google.com/drive/folders/1XXrSZbu7nCaW2UkOVsaVbKmX0ZmfFUtg?usp=sharing

 

Feel free to use anyway you like, or dont. 🙂

Share this post


Link to post
Share on other sites

Yet another awesome script from Shuko. Thanks for this, I'll definitely add it to my arsenal. :)

Share this post


Link to post
Share on other sites

Just what i was looking for to finish off my EOS script.

It boggles my mind how the vanilla BIS functions can't keep up with user made functions

Share this post


Link to post
Share on other sites

Is this ported from ArmA2? If so, you may want to consider the removal of the following code since it is possibly redundant due to the ArmA3 preloaded functions library.

// Make sure Functions module is loaded
if (isnil "bis_fnc_init") then {
 createcenter sidelogic;
 (creategroup sidelogic) createunit ["FunctionsManager",[1,1,0],[],0,"none"];
};
waituntil {!isnil "BIS_fnc_init"};
waituntil {BIS_fnc_init};

Share this post


Link to post
Share on other sites
Is this ported from ArmA2? If so, you may want to consider the removal of the following code since it is possibly redundant due to the ArmA3 preloaded functions library.

Yep, it's from A2. Thanks for the tip.

Share this post


Link to post
Share on other sites

Thanks for this Shuko - do you mind if I modify it for use in a game mode I'm making? (full credit to you of course)

Share this post


Link to post
Share on other sites
Thanks for this Shuko - do you mind if I modify it for use in a game mode I'm making? (full credit to you of course)

I've always been supporter of open source. Anyone can do anything they want with my scripts. In this case, all the credits should go to Binesi.

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

==================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Hi Shuko. Nice script.

Can you tell what _slack is referring too?

As i would very much like to integrate your script into EOS

Share this post


Link to post
Share on other sites
Hi Shuko. Nice script.

Can you tell what _slack is referring too?

As i would very much like to integrate your script into EOS

It's just some slack/randomness for the WP position picking. With it, the WPs won't make an exact circle. Amount of it is dependent on the distance parameter; longer -> more slack/play for the WP positioning. It also affects the completion radius of the WP.

It seems that the BIS_fnc_findSafePos is quite picky about the positions and even with fairly large slack (max position search range), it still won't always find a suitable position. In that case, it defaults to some center position and if you use a small slack and/or the location is not favorable, the WP positions can all fail and the center is used, thus it seems that units only patrol tiny area.

I've now uploaded a new version, which doesn't bother trying to find safe positions as with decent completion radius, units should be able to reach their WPs even if they happen to be placed in a difficult location. I also put back in the debug marker code so everyone can easily see what's going on.

Edited by Shuko

Share this post


Link to post
Share on other sites

getting an error for some reason :-

@line 48

Error in expression <t = 4 + (floor random 3) + (floor (_dst / 100)); 
_ang = (360 / (_cnt - 1)); 
_w>
 Error position: </ 100)); 
_ang = (360 / (_cnt - 1)); 
_w>

null=[_grp, _patrolMarker] execVM "scripts\shk_patrol.sqf";

Share this post


Link to post
Share on other sites
null=[_grp, _patrolMarker] execVM "scripts\shk_patrol.sqf";

Reason would probably be, I'm purely guessing here, that the _patrolMarker refers to a marker?

The script has 2 parameters: the patrol group and the distance of waypoints from the starting position.

Place your group in the middle of the marker and then use the marker's size as the distance and then delete the marker.

Share this post


Link to post
Share on other sites
Reason would probably be, I'm purely guessing here, that the _patrolMarker refers to a marker?

The script has 2 parameters: the patrol group and the distance of waypoints from the starting position.

Place your group in the middle of the marker and then use the marker's size as the distance and then delete the marker.

Opppsss should have read that bit - works like a charm :)

Share this post


Link to post
Share on other sites

Yeah, I did some changes with domains and web hosts. Forgot to update every single link on this forum. ;) Anyway, first post is updated.

Share this post


Link to post
Share on other sites

If I want this script to be for all AI units to set in patrol for their areas once spawned can I just use this as

nul = [] execVM "shk_patrol.sqf";

placed INIT.sqf of mission?

Or is this used differently? Using scripts like EOS and AISSP

Thanks

Share this post


Link to post
Share on other sites

You can call the script from anywhere you like, but you need to pass the group as a parameter.

nul = [myGroup1] execVM "shk_patrol.sqf";"

Share this post


Link to post
Share on other sites
You can call the script from anywhere you like, but you need to pass the group as a parameter.

nul = [myGroup1] execVM "shk_patrol.sqf";"

Ok, well this is above my pay grade. May be someone else could shed some light for me, was considering using this for an edited version of invade and annex which is using EOS and AISSP. I don't suppose there is an easy way to have the units spawned be assigned this script without editing more script?? If not, is there something out there that does this that is not a mod?

never mind.

Share this post


Link to post
Share on other sites

I really like this script thank you!

Edited by Nical155

Share this post


Link to post
Share on other sites

Blast from the past.

 

Reuploaded https://drive.google.com/drive/folders/1XXrSZbu7nCaW2UkOVsaVbKmX0ZmfFUtg?usp=sharing

 

Feel free to use anyway you like, or dont. 🙂

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

×