Author: Tophe
Author Website:

Requirements: No addons required

Version: 1.1

Short description:

Date: 2009-07-15 18:26

Comments: (3)



Random House Patrol

This script will allow you to have a unit patrol a house, randomly.

All you need to do is place a unit close to a building and init the script on it. The script will then check how many available building positions there are in the closest building of the unit, and place him randomly at one. Then he will start patrolling the building.

Every time the unit reaches it's waypoint inside the house it will stay and wait for a short while, before moving to the next point. The amount of time the unit waits is random. So you'll never really
know how long the unit will stand still.

It works in Multiplayer as well as Singleplayer.

Put this in the init field of a unit and put it next to or on a house
guard = [this] execVM "HousePatrol.sqf"

Optional settings:
You may also set the behaviour of the unit by putting the preferred behavior in the array.

Like this:
guard = [this,"COMBAT"] execVM "HousePatrol.sqf" 

You may put any of these five:
    - "CARELESS"
    - "SAFE"
    - "AWARE"
    - "COMBAT"
    - "STEALTH"
If you don't put anything the default "SAFE" will be set.

* There is also an option to set the maximum amount of time (in seconds) that the unit will wait before moving to the next waypoint.

To use this option the behaviour option must be set too.
guard = [this,"SAFE",50] execVM "HousePatrol.sqf" 

If you don't put anything the default value of 30 will be set. Use 0 as value if you want the guard to patrol continuously.

Known issues:
Sometimes ArmA2 has some problems with pathfinding and getting units to report if they have finished or failed a task. To get around any such problems the guard will be given a new command if it takes more than 90 seconds to finish the last command. Some houses seem to be more difficult for the AI to sort out.

Change log:
* Optimized the code for better performance and no error codes.
* Added a workaround for a game bug where some buildings are missing data.

Forums Topic:

Enable javascript to be able to download from Armaholic please!

Tags: No tags