Bon 12 Posted May 12, 2011 (edited) Hi all, here a simple-to-use script for AI movement (kind of an alternative patrol script). It provides three different ways of behavior: "patrol"To let the AI group move in circles of random radius around the defined location center. In case the group passes an enterable house on their route, they will sweep it with some probability.The group moves in either clockwise or counterclockwise direction. "hide"Lets the AI group search for enterable houses to hide in them. In case no such house exists the group starts patrolling. "standby"Lets the group seach for a flat and empty position around the location center to move and hold there. Infantry groups will sit down at this position. Here are some screenshots of some debug output: Screenshot 1 Screenshot 2 Screenshot 3 You call the script with three arguments: 1. the group 2. the position 3. the behavioral type. Example init line of a unit: _n = [group this,"locationmarker","patrol"] execFSM "bon_ai_movement.fsm"; Details in enclosed readme.txt, however, this is just it. The script releases the group and pauses while a group is in COMBAT mode and resets and restarts after the group leaves COMBAT mode. My motivation was that, for me, movement of groups which just proceed randomly assigned waypoints appears somewhat implausible, especially in non-urban terrain or when holding/guarding a certain point. With this script you can make it so that you will see some patrols running around the AO systematically, enemy vehicles standing by on key positions, where most of the enemy hides in houses and comes out only when in contact with you. and that all with one single script file. Download link: http://fh-warzone.de/downloads/boninf/scripts/bon_ai_movemet.Takistan.rar hf. Edited May 25, 2011 by Bon Share this post Link to post Share on other sites
demonized 16 Posted May 12, 2011 cool, will deff check your work out, have been toying as well with creating a new patrol script since UPSMON kindof is removing more and more mission maker control as of newer versions. Share this post Link to post Share on other sites
PELHAM 10 Posted April 20, 2012 (edited) Very useful FSM! I find I can alternate movement by calling these functions randomly with a timer, it resets the FSM so they are either patroling or hiding or finding a new place to patrol or hide. The standby behaviour doesn't reset though, they seem to get setPossed to the location instead of moving there. Any chance we could have an update or some advice so we can call the different behaviours repeatedly? fnc_patrol = { private ["_unit","_group","_n"]; _unit = _this select 0; _group = group _unit; {deleteWaypoint _x} foreach waypoints _group; {_x setUnitPos "Up"} foreach units _group; {_x stop false} foreach units _group; _n = [_group,"locationmarker","patrol"] execFSM "bon_ai_movement.fsm"; }; fnc_hide = { private ["_unit","_group","_n"]; _unit = _this select 0; _group = group _unit; {deleteWaypoint _x} foreach waypoints _group; {_x setUnitPos "Up"} foreach units _group; {_x stop false} foreach units _group; _n = [_group,"locationmarker","hide"] execFSM "bon_ai_movement.fsm"; }; script that calls the functions - changes movement every 180 seconds (3 mins) private ["_t","_ldr","_val"]; waitUntil {!isNil "bis_fnc_init"}; _t = 175; while {true} do { _t = _t + 1; if (_t >= 180) then { _t = 0; { if (side _x == EAST) then { _val = [fnc_patrol,fnc_hide]call BIS_fnc_selectRandom; [leader _x] call _val};} forEach allGroups; }; sleep 1; }; NOTE: - you need to precompile the functions in init.sqf before your call them!!! Edited April 20, 2012 by PELHAM Share this post Link to post Share on other sites
lockjaw-65- 0 Posted April 20, 2012 This sounds really good, could it be used with groups that are spawned during mission? Share this post Link to post Share on other sites
PELHAM 10 Posted April 20, 2012 (edited) This sounds really good, could it be used with groups that are spawned during mission? My bit? Yes, this line calls it for all groups, so you just spawn them and it does it's thing: [leader _x] call _val};} forEach allGroups; for Bon Movement as is this would make all the civilians run home: {if (side _x == civilian) then { [_x,"nameMarker","hide"] execFSM "bon_ai_movement.fsm"} ;} forEach allUnits; Edited April 20, 2012 by PELHAM Share this post Link to post Share on other sites
carlostex 38 Posted April 20, 2012 This script definitely deserves refining. Awesome piece of work! Please Bon, keep working on it. Could easily replace BIS_fnc_taskpatrol and make AI look better and i won't even talk about performance. Share this post Link to post Share on other sites