tophe 69 Posted June 29, 2014 (edited) Random House Patrol Script v2.2byTophe of OOPS>>> ARMAHOLIC DOWNLOAD <<< DESCRIPTION Here's an old A2 favorite... This script will allow you to have a unit patrol a house, randomly. All you need to do is to run the script on a unit and place it close to a building. The script will then check how many available positions there are in the closest building, place the unit randomly at one and have it patrol 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. If you turn on the debug mode, all positions will be marked with ingame 3d markers. Also there is a chat feedback from the units, as well as a map marker showing the next waypoint. It works in Multiplayer as well as Singleplayer. USAGE Place unit close to a house and set init field to: guard = [this] execVM "HousePatrol.sqf" SETTINGS guard = [this, MODE, STAND TIME, EXCLUDED POS, STARTING POS, DEBUG] execVM "HousePatrol.sqf" BEHAVIOUR - set unit behaviour. guard = [this,"COMBAT"] execVM "HousePatrol.sqf" Options: CARELESS, SAFE, AWARE, COMBAT, STEALTH Default: SAFE STAND TIME - Set maximum amount of seconds the unit will wait before moving to next waypoint. guard = [this,"SAFE",50] execVM "HousePatrol.sqf" Options: Any value in seconds. 0 = continuous patrol. Default: 30 EXCLUDED POSITIONS - exclude certain building positions from patrol route. guard = [this,"SAFE",30, [5,4]] execVM "HousePatrol.sqf" Options: Array of building positions Default: [] (no excluded positions) STARTING POS - Some building positions doesn't work well will the setPos command. Here you may add a custom starting pos. Negative number means starting pos will be randomized. guard = [this,"SAFE",30, [5,4], 2] execVM "HousePatrol.sqf" Options: Any available building position Default: -1 (random) STANCE - Tell the unit what stance to use. To keep the unit from going prone you can set this to MIDDLE or UP. AUTO will be the standard behaviour and unit will crawl around in combat mode. HIGH is the default mode. This is like AUTO but prone position is excluded. guard = [this,"SAFE",30, [5,4], 2, "UP"] execVM "HousePatrol.sqf" Options: UP, DOWN, MIDDLE, AUTO, HIGH Default: HIGH DEBUG - Use markers and chatlog for mission design debugging. guard = [this,"SAFE",30, [], -1, true] execVM "HousePatrol.sqf" Options: true/false Default: false VERSION HISTORY v2.2 - Added stance option - Behaviour and stance settings are case insensitive ( SAFE, Safe SaFe are all the same) v2.1 - Fixed debugging bug (sic) - If bulding has no building positions the script will now exit - If the building only has one position, the unit will be positioned there, then the script exits. v2.0 - Reworked for Arma 3 - Optimized the code for better performance. - Added option for mission debugging - Added option for excluding positions from route - Added option for setting starting position v1.1 - Optimized the code for better performance. - Added a workaround for a game bug where some buildings are missing data. v1.0 - First release for Arma 2 Edited June 30, 2014 by Tophe new version Share this post Link to post Share on other sites
Skagget 11 Posted June 29, 2014 Bugs I saw. 1. There is no transition from point A+B to C. The unit stands still on a "point", starting to walk and halts. From there he teleports to a new set of "points" and repeat. Ive tried all examples that came with the script regarding of command line in init. Tried aswell on a couple of diffrent houses. 2. Doors are something the unit cant operate, the unit start bugging out and then goes to (1) action; teleport and starts somewhere else. Share this post Link to post Share on other sites
tophe 69 Posted June 29, 2014 Thanks! I'll look into it! I think I know what it might be... ---------- Post added at 04:57 PM ---------- Previous post was at 04:30 PM ---------- Weird... I can't reproduce your bugs, and my guys opens doors without any problems. Found some other stuff though. I'll make a new release today. But please look into it a little more. Maybe tell me what houses you used? Share this post Link to post Share on other sites
mackenzieexd 32 Posted June 29, 2014 good script! worked for me +1 Share this post Link to post Share on other sites
tophe 69 Posted June 29, 2014 good script! worked for me +1 Cool! Just updated it a bit. The debug settings are a bit off. Also now the script will exit if there are less than two positions in the building. If the house has no positions the script will not try to move a unit, if there is only one the unit will move there. Will release tonight Share this post Link to post Share on other sites
darkxess 60 Posted June 30, 2014 So far its great, though just one thing you should change in my opinion. When the guy is in the house searching around, he often stops, drops to the ground, crawls, then moves once again. I think a person searching a house in RL wouldnt really stop and crawl then get up and search once more lol. Maybe disable the unit from crawling? just walking around caustiously is good enough :) Thanks anyways. Edit: does this happen to work with any other scripts? UPSMON / UPS / USPS for instance? Share this post Link to post Share on other sites
tophe 69 Posted June 30, 2014 So far its great, though just one thing you should change in my opinion. When the guy is in the house searching around, he often stops, drops to the ground, crawls, then moves once again. I think a person searching a house in RL wouldnt really stop and crawl then get up and search once more lol. Maybe disable the unit from crawling? just walking around caustiously is good enough :) Thanks anyways. Edit: does this happen to work with any other scripts? UPSMON / UPS / USPS for instance? Have you put him to safe mode? Share this post Link to post Share on other sites
darkxess 60 Posted June 30, 2014 Didn't touch it mate, though I'm running it with TPWCAS and also ASR which could effect it? so maybe its my bad then?!?! Share this post Link to post Share on other sites
tophe 69 Posted June 30, 2014 Didn't touch it mate, though I'm running it with TPWCAS and also ASR which could effect it? so maybe its my bad then?!?! Nah, when the unit goes to combat mode he starts throwing himself on the floor. I'm updating the script now. Adding a stance-option (up, down, middle, auto). So you'll be able to force the unit to stay upright. Makes sense! Thanks! For now you could always add this setUnitPos "MIDDLE" or this setUnitPos "UP" to the unit Share this post Link to post Share on other sites
darkxess 60 Posted June 30, 2014 Thanks mate, I will wait on the update - glad it wasnt my fault then haha. Would it work ok with other scripts like UPSMON / UPS / USPS also do you know? Thanks :) Share this post Link to post Share on other sites
tophe 69 Posted June 30, 2014 New version out! ---------- Post added at 06:17 PM ---------- Previous post was at 06:14 PM ---------- Thanks mate, I will wait on the update - glad it wasnt my fault then haha.Would it work ok with other scripts like UPSMON / UPS / USPS also do you know? Thanks :) Haven't done any extensive testing with other scripts. There might be conflicts, but try. Otherwise just leave the house patrol units out of the ups-scripts. Share this post Link to post Share on other sites
killshot 5 Posted September 4, 2014 I was using your RHPS for A2 and it was amazing! I also used that one in A3 and it did work well so far and I wasn't aware of this updated version. I will give it a try later this day for sure! Especially the "HIGH" parameter is such a useful great new implementation! Thanks for sharing your work! Share this post Link to post Share on other sites
ii-winters 10 Posted October 6, 2014 While testing I had a lot of building positions units can't reach, so the script uses the _timeout. This keeps the skript running but is not so nice. Doing some changes seems to solve the problem. waitUntil {moveToCompleted _unit || moveToFailed _unit || !alive _unit || _timeout < time [b][color="#FF0000"]|| _unit distance (_house buildingPos _currentBuildingPos) <= 2.5[/color][/b]}; The unit still move direct to, or if not possible close to the position, and moves on without using timeout and the setpos after that. I only testet the distance of 2.5 m. Maybe a other distance is better. P.S. Nice script. Share this post Link to post Share on other sites
jandrews 116 Posted January 31, 2015 hey, am getting this spam in RPT. Ideas? 9:40:50 Error in expression < "COMBAT" or _beh == "STEALTH") then {_unit setBehaviour _beh} else {_unit se> 9:40:50 Error position: <_unit setBehaviour _beh} else {_unit se> 9:40:50 Error Undefined variable in expression: _unit 9:40:50 File C:\Users\Andrews\Documents\Arma 3\missions\JShock_test_1.Stratis\HousePatrol.sqf, line 76 9:40:50 Error in expression <our "SAFE"}; while { format ["%1", _house buildingPos _x] != "[0,0,0]" } do> 9:40:50 Error position: <_house buildingPos _x] != "[0,0,0]" } do> 9:40:50 Error Undefined variable in expression: _house 9:40:50 File C:\Users\Andrews\Documents\Arma 3\missions\JShock_test_1.Stratis\HousePatrol.sqf, line 83 9:40:50 Error in expression <our "SAFE"}; Share this post Link to post Share on other sites
jandrews 116 Posted February 4, 2015 While testing I had a lot of building positions units can't reach, so the script uses the _timeout. This keeps the skript running but is not so nice. Doing some changes seems to solve the problem. waitUntil {moveToCompleted _unit || moveToFailed _unit || !alive _unit || _timeout < time [b][color="#FF0000"]|| _unit distance (_house buildingPos _currentBuildingPos) <= 2.5[/color][/b]}; The unit still move direct to, or if not possible close to the position, and moves on without using timeout and the setpos after that. I only testet the distance of 2.5 m. Maybe a other distance is better. P.S. Nice script. getting this spam with your fix 20:50:00 Error Undefined variable in expression: _currentbuildingpos 20:50:00 File C:\Users\Andrews\Documents\Arma 3\missions\mission_setup.Altis\HousePatrol.sqf, line 99 20:50:00 Error in expression <e || _unit distance (_house buildingPos _currentBuildingPos) <= 2.5}; sleep _t; > 20:50:00 Error position: <_currentBuildingPos) <= 2.5}; sleep _t; Share this post Link to post Share on other sites
jandrews 116 Posted February 10, 2015 error with this. ideas? 6:33:32 Error in expression <_stance = if (count _this > 5) then {toUpper(_this select 5)} else {"HIGH"}; > 6:33:32 Error position: <toUpper(_this select 5)} else {"HIGH"}; > 6:33:32 Error toupper: Type Bool, expected String 6:33:32 File C:\Users\Andrews\Documents\Arma 3\missions\AAAtestsidemissionJShock.Takistan\HousePatrol.sqf, line 67 Share this post Link to post Share on other sites
runforrest 10 Posted May 30, 2015 I also always used ur script in ArmA2 already - loveit :bounce3: Is there a way to make this work with AiA Terrainpack? It seems it doesnt work at all at Zargabad (might be related to the issues reported above - not sure im not a scripting guy) Share this post Link to post Share on other sites
infiltrator_2k 29 Posted June 20, 2015 (edited) This addon no longer works properly. The Ai do not detect enemy units. I've messaged Tophe to let him know. Hopefully he'll be able to provide a fix. This has been the best solution so far for what I need with regards to enemy Ai patrolling and guarding buildings. Manually inserting waypoints is way too time consuming and finicky. ***update*** The Ai do actually intermittingly respond if you loiter. They show signs that they acknowledge your presence by stopping and turning towards you, but you'll only receive fire from them in the form of a single shot now-and-then or a grenade. To eliminate other causes with the mission I tested with a fresh mission with several of the Ai in the Unfinished Building Complex on the Altis map. At mission start the Ai respond to enemy units until they respawn at the nearest building's waypoints. Edited June 20, 2015 by Infiltrator_2K Share this post Link to post Share on other sites
infiltrator_2k 29 Posted June 27, 2015 (edited) Has no one got a solution to this broken script? It's a shame because it's a bloody good script that saves a lot of time manually plotting waypoints for individual AI. The current editor sucks for plotting waypoints manually. *** UPDATE *** This issue seems to be caused not by the script being broken by an update, but generally any AI that uses a building's waypoints to patrol. In short it's Arma not Tophe's script. Edited June 27, 2015 by Infiltrator_2K Updated info Share this post Link to post Share on other sites
grande1982 10 Posted June 15, 2016 The script is broken, you can upgrade to the latest version of the game. Thanks Share this post Link to post Share on other sites