Random House Patrol script v1.1
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
It works in Multiplayer as well as Singleplayer.
>> ARMAHOLIC DOWNLOAD <<
HOW TO USE:
* Just put this: guard = [this] execVM "HousePatrol.sqf"
in the init field of a unit and put it next to or on a house.
* You may also set the behaviour of the unit by putting the
preferred behaviour in the array.
Like this: guard = [this,"COMBAT"] execVM "HousePatrol.sqf"
You may put any of these five:
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.
Example: 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 continuesly.
* Optimized the code for better performance and no error codes.
* Added a workaround for a game bug where some buildings are missing data.
* First release for Arma 2
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.
Some buildings are not able to be identified, due to a bug in ArmA 2.
A unit placed close to such a house will be put in the nearest identified house.
Some buildings are missing building positions, this is a game bug.
When a unit it place close to a building it can not patrol, it will stay where you put it in the editor and a chat message will tell you about the problem.
If the unit is given a name you will be told which unit that can't patrol the given house.
/// Tophe of Östgöta Ops [OOPS], Sweden
Last edited by Tophe; Jul 20 2010 at 15:59.
Reason: updated version
Nice to see someone using it.
On this one, you don't need the server Logic.
I hope it will work smoothly.
Master Gunnery Sergeant
Nice to see this script now in ArmA2. Thx Tophe
Put it on our scripts section at Assault Mission Studio
Random House Patrol [1.1] by Tophe
Last edited by Imutep; Jul 15 2009 at 19:11.
Assault Mission Studio
- German Mission Editing && Scripting Website
great script. is there an option for them to exit the house after a certain time or once all waypoints are patrolled and commence patrolling another house? be great for evasion type action.
Good idea.. I'll see if I can look into that option in the future. Right now it's not in the script.
Random? I was never a fan of randomness. I made a script like this for some of my missions in ArmA and made the observasion that random = unrealistic. So I went through the trouble of making patrol 'waypoints' (an array of buildingPos's) for each unit, as well as 'instructions' (another buildingPos) on what to do upon contact with the enemy (one thing I absolutely cannot stand is patrols that don't 'break' when attacked). I used it extensively; to the point where whenever I need any AI unit to enter a building I'd use it.
Perhaps I'll post it later. Maybe some of these features would be useful for you to implement yourself.
Sounds really interesting... However in this script the unit will break, as on any waypoint when it sees an enemy unit. I've never experienced randomness itself as unrealistic, only perhaps bad implementation of it.
This script will basically just put a unit in a house and have it walk around inside, and sometimes stop for a while. Don't really see anything unrealistic about it.
But you seem to have some good points, so it would be nice to see you scripts. Maybe some good ideas there for the next version of this one.
Master Gunnery Sergeant
I can check this off my own to-do list!