Jump to content

Sign in to follow this  
Big Dawg KS

BD Building Patrol Script v2.0

Recommended Posts

I don't think I released version 1.0 for ArmA, but I recently revised this script for use in ArmA2 and figured some of you might appreciate it.

The purpose of this script is to allow AI units to patrol inside of a building. Contrary to popular belief, the ArmA2 AI works very well indoors. This script allows you to set up a path for them to patrol using buildingPos's. When the unit reaches a waypoint, he will wait there for a short period of time before moving on. In addition, (optionally) he will watch a specified direction at that waypoint. The unit will move to the waypoints in order, and will loop when the last waypoint is reached. When the unit becomes alerted they will move more cautiously, and (optionally) will move to a specified position until they resume SAFE mode, at which point they resume the patrol. You can also cease the patrol by passing the script a condition. By ceasing the patrol you can allow the unit to move freely, leaving the building, whatever you want. Once the patrol is ceased the script terminates, so you have to execute it again to resume the patrol afterward.

Here's the script:

  Reveal hidden contents

You can download it now at Armaholic (includes demo mission):

BD Building Patrol Script

Enjoy.

Edited by Big Dawg KS
Fixed small typo in the code

Share this post


Link to post
Share on other sites

Here's a nice demo mission for you guys to see how it works.

(download in first post)

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites

Isn't this doing more or less what Tophe's Random House Patrol script is doing?

I guess your posting this because of the talk in the OA thread. The talk was about AI patrolling buildings on their own :)

Nice script though :)

Share this post


Link to post
Share on other sites
  JW Custom said:
Isn't this doing more or less what Tophe's Random House Patrol script is doing?

I dunno what his script does. The whole point of this script is not to be random. Why? Because that's what I needed. This script is useful for people who want to arrange AI in a building the way they want, so you can get a lot more meaning than it just being random. Good for missions where you want your enemy to hold/patrol a specific structure in a well-thought-out manner. Check out the demo mission if you want to see it in action (if the d/l link is still active, I'm waiting on another so be patient).

Of course, if you want you can easily write another script to call this with random waypoints (or even random buildings). As I see it, making it random would make it geared more towards use large buit-up areas with lots of enterable structures, which isn't what I wrote this for, but it certainly doesn't mean you can't adapt it for that.

Also, from a technical standpoint this script has a lot of interesting features. I figured those who were new to scripting could use this to learn some new tricks.

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites

Random House Patrol script simply makes units random patrol a defined buildings positions.

Like i said it's a nice script you have written there :cool:

Share this post


Link to post
Share on other sites
  JW Custom said:
Random House Patrol script simply makes units random patrol a defined buildings positions.

I see. Well then you can think of this as a more advanced version of that, with more options.

Share this post


Link to post
Share on other sites

Looks handy.

Indeed, it is a different flavor than the random house patrol, which can also be useful.

Share this post


Link to post
Share on other sites

I put up a download link to Armaholic but I'm not sure what it contains (whether it's just the script or the demo mission).

Can someone tell me? :o

Share this post


Link to post
Share on other sites
Guest
  Big Dawg KS said:
I put up a download link to Armaholic but I'm not sure what it contains (whether it's just the script or the demo mission).

Can someone tell me? :o

Its the script "patrol.sqf" together with an example mission. That is correct right?

Share this post


Link to post
Share on other sites

Saw this on Armaholic, so I just had to take a look since I did another script like this.

This seems like a great complement to my random script. Good job.

In my script I automated the building selection and counting of building pos's. Might be an idea for an update in your version. Instead of having the user first define a building, putting it in a variable and then pass it to the script, the script simply chooses the building closest to the unit. You could have an option to do that or use a user defined building. Just an idea to make it quicker and easier to implement.

Have you found any workaround for the missing building positions or undefined buildings in Arma 2?

Share this post


Link to post
Share on other sites
  Foxhound said:
Its the script "patrol.sqf" together with an example mission. That is correct right?

Thanks. Yea that should be fine.

---------- Post added at 03:40 PM ---------- Previous post was at 03:34 PM ----------

  Tophe said:
In my script I automated the building selection and counting of building pos's. Might be an idea for an update in your version. Instead of having the user first define a building, putting it in a variable and then pass it to the script, the script simply chooses the building closest to the unit. You could have an option to do that or use a user defined building. Just an idea to make it quicker and easier to implement.

Well, like I mentioned earlier, I didn't design it to be easy or automated. I designed it to be flexible. I guess this would be better for more advanced mission makers. Like I already mentioned, all you need is another script that automatically finds a building and generates a random set of waypoints, then call my script from it.

  Tophe said:
Have you found any workaround for the missing building positions or undefined buildings in Arma 2?

No, I'm not even sure what the problem is. I'm not doing any checking for valid building positions or anything in my script. I wrote it for my own use, so I guess I figured I'd never give it any invalid input. :rolleyes:

Share this post


Link to post
Share on other sites
  Big Dawg KS said:
I wrote it for my own use, so I guess I figured I'd never give it any invalid input. :rolleyes:

hehe

You are a much better scripter than I am, then. :D

I find myself passing invalid data to my own scripts far more frequently than I like!

But, that is a digression....

Share this post


Link to post
Share on other sites

Well, there really is no point in adding any error checking. If the user doesn't already know what he's doing, they're not going to get the script to work. And if they do pass it invalid input, I'd prefer the ArmA2 interpreter warn them when they test their mission then simply have it not do anything.

Share this post


Link to post
Share on other sites

Big Dawg, I'm confused about what you're using for the second parameter, i.e. the building to patrol.

How are you identifying specific buildings without using their numeric IDs? I saw that in your example mission, the industrial building was referred to as insBldg in your script, so I did a quick Google search for this variable but came up with nothing.

If this is a silly question, I apologise for digging up an old thread; if not, I hope it helps others out. Your script sounds really powerful - thank you for sharing it! I'm definitely very eager to utilise it.

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  

×