dr_eyeball 16 Posted February 23, 2007 Overview & Main Goal: After looking at Kronzky's Urban Patrol Script ( UPS ), I thought it was great to have all of these random patrolling squads, but in addition, I also wanted to be able to automatically place lots of stationery squads simply hiding and guarding from within random house positions. Some of the big buildings have as many as 20-250 positions. I think this could be a useful script, if completed to include all the ideas listed below. Download: Test mission with THAG script version 1.0 Test mission with THAG script version 1.01 (fixed "move" with "setPos") Image 1 Problems: - I've just got it working, so it's not 100% tested yet, so if not used properly within it's limitations, it could potentially lock up ArmA due to excessive looping. i.e. changing the 2 constants or not placing units inside towns near local buildings. But I think I've caught any possible cases. - Also, it still appears to sometimes place 2 or more units near each other (or possibly inside each other). Still investigating whether this is legit. Usage: Adjust the script constants: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_MaxBuildingSearchRadius = 170; // Suggested range: 70-200 _MaxBuildingPositionsSearchCount = 38; // Potential range: 1-250. High values may cause long start-up delays, until optimised. Add a few enemy squads and set the initialization for each Squad Leader to: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fn = compile preprocessFile "THAG.sqf"; [this] call fn; - OR - nul=[this] execVM "THAG.sqf"; The script should be self initializing, I hope. (See THAG_OccupiedHouses var.) I suggest you uncomment this line for testing, if you've got Kronzky's 3D Markers mod installed. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// [_x, "lg", east] execVM "attachmarker.sqf"; // debug Future ideas: - use FindCover to hide them further. - Failure to find an unoccupied house position, should simply expand the house search radius and try again. - Add waypoints to "GUARD" position - Watch a direction away from walls - Speed up search for house positions count, using a binary search. - stop AI standing on wall edges due to collision with nearby objects I'm still working on it, but any advice on improving this is welcome. Share this post Link to post Share on other sites
mattxr 9 Posted February 23, 2007 Very Nice, there is already a script like this if im not mistaken.. Urban Combat Script Unless there is a difference please state :P Share this post Link to post Share on other sites
dr_eyeball 16 Posted February 24, 2007 I didn't know about that one. Yeah, it looks like it does virtually the same thing, the way it is now. Oh well, good scripting practice anyway. If I can improve upon it, I'll let you know. Thanks for the link. Just rechecking the other script: - it doesn't seem to check whether a building position has already been occupied by a previous person - it limits the building positions to 40, instead of 250+ - it may create a group with an odd unit counts (eg: 3 Squad Leaders) Share this post Link to post Share on other sites