Jump to content
Sign in to follow this  
tophe

Random House Patrol script v1.0

Recommended Posts

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.

>> 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.

OPTIONAL SETTINGS:

* 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:

* "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.

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.

VERSION HISTORY:

v1.1:

* Optimized the code for better performance and no error codes.

* Added a workaround for a game bug where some buildings are missing data.

v1.0

* First release for Arma 2

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.

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

Edited by Tophe
updated version

Share this post


Link to post
Share on other sites

Thx! Been using your ArmA1 script in ArmA2 already, but these new optional settings are a good addition :grinning::thumbsup:

Share this post


Link to post
Share on other sites

Nice to see someone using it.

On this one, you don't need the server Logic.

I hope it will work smoothly.

Share this post


Link to post
Share on other sites

Nice to see this script now in ArmA2. Thx Tophe :)

Put it on our scripts section at Assault Mission Studio

dlicon.gif

Random House Patrol [1.1] by Tophe

Edited by Imutep

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Good idea.. I'll see if I can look into that option in the future. Right now it's not in the script.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I can check this off my own to-do list! :D

Thanks!

Share this post


Link to post
Share on other sites

Oh... Of course. Still though, I've never encountered a situation where 30 units have been patrolling a single house. But you do have a point in that.

A future project might be to make the script do a random route over all the building positions and then have the unit cycle those. That way all units will have their own route but they will stick to it.

Thank you for the email by the way. I will have a good look at those!

Cheers.

// Tophe of Östgöta Ops [OOPS]

Share this post


Link to post
Share on other sites
Oh... Of course. Still though, I've never encountered a situation where 30 units have been patrolling a single house.

Well you obviously haven't played any of my misions. :j:

If there's a building big enough, sure enough I'll cram as many units into it as will fit.

Share this post


Link to post
Share on other sites

Updated script to v1.1

See first post.

Share this post


Link to post
Share on other sites

Works perfectly, thanks a lot! This will add a lot to my mission! :)

Edit: i've run into a problem, as sometimes the soldiers who are patrolling a house will drop dead randomly.

That's a major issue for me because sometimes it's the guy the players need to kill. They will be enroute to the objective to kill the guy, only for him to drop dead when they havent even arrived yet.

Edited by SiC-Disaster

Share this post


Link to post
Share on other sites
Works perfectly, thanks a lot! This will add a lot to my mission! :)

Edit: i've run into a problem, as sometimes the soldiers who are patrolling a house will drop dead randomly.

That's a major issue for me because sometimes it's the guy the players need to kill. They will be enroute to the objective to kill the guy, only for him to drop dead when they havent even arrived yet.

There are some serious issues with pathfinding in some houses. This is a bug that BIS will probably not do anything about though... It's been there since the start of building positions. So what happens in some houses is that units fall off ledges, stairs and such and thus kill themselves.

Have you tried tracking the unit to see what happens before it drops dead? There is nothing in the script that kills any units, it has got to do with pathfinding or similar engine problem. The script just tells the unit to go from one point to another.

Share this post


Link to post
Share on other sites

Great script! Adds a HUGE amount of ambiance, not to mention danger to a mission. I was wondering if there was a way to put it into a module that allowed a commander to use it ingame? The IF conditions could be something like:

If the unit is infantry, ordered to and reached an internal house position, and their mode is 'engage at will', then [this,"COMBAT"] execVM "HousePatrol.sqf"

Something like that would be beyond fantastic. Thanks again!

Share this post


Link to post
Share on other sites

Thx for the feedback! I might have a look at the module thingy later on, it's a really good idea!

Share this post


Link to post
Share on other sites

Hey Tophe -

Might it be possible, within the script, to perhaps also designate a radius, and get all buildings with buildingpos settings within that radius, and either pick one randomly, or patrol all of them, in order? :)

I know, I know... wishing is easy. :D

Share this post


Link to post
Share on other sites

Some buildings are not able to be identified, due to a bug in ArmA 2.

....

Some buildings are missing building positions, this is a game bug.

...

Hi. Thanks for the script, I'm a big fan of urban-y 'house to house' type of fighting, and this script helps a lot in that area.

Because of this, I've been frustrated by these bugs you've mentioned, on more than one occasion (most recently on the great custom map Duala). So, I took the time to register at the A2 community bug tracker, so I could 'vote' for these bugs.

(and others that may relate to 'urban building fighting' type of stuff, such as this one http://dev-heaven.net/issues/4438 )

But I can't find these bugs listed. Am I overlooking them, or are they not listed? If you know, please point me to them, so we can try and elevate their status, in hopes they get fixed.

Thanks!

Share this post


Link to post
Share on other sites

Will this work on maps other than chernagorsk? I ask because maps like Duala and Quesh Kibrul have a lot of enterable buildings.

Also, will the unit stay in the build once combat has started?

Also also, can I make a unit patrol a street then on blufor detected make a waypoint near a building and have the script execute then, so he will enter the building?

Share this post


Link to post
Share on other sites
Will this work on maps other than chernagorsk? I ask because maps like Duala and Quesh Kibrul have a lot of enterable buildings.

Also, will the unit stay in the build once combat has started?

Also also, can I make a unit patrol a street then on blufor detected make a waypoint near a building and have the script execute then, so he will enter the building?

Yes

Yes

Yes, you might wanna start a thread for help on that!

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  

×