No announcement yet.

AI Scouting Behavior Tips

  • Filter
  • Time
  • Show
Clear All
new posts

  • AI Scouting Behavior Tips

    Does anyone have some tips on getting the AI to scout positions competently? When I give the AI a waypoint in the editor which looks like a good position to scout from, I often run into a couple of problems. One is that they aren't very good at adjusting to having their vision obscured by objects like trees or elevations, even if they only need to move a few meters in order to get a good view of the area.

    Another, is that there isn't a "Scan Horizon" command available via scripting. So, if I want them to go to a position and then look around for bad guys, they don't actively scan the area. They just stand there and if an enemy happens to walk into their field of view they will detect them, but otherwise they do a crappy job of scouting.

    I've tried using "doWatch" but I'm having trouble getting it to work. I've tried putting this code into the "On Acct." field of a waypoint:

    aigunner doWatch (markerPos "marker1");

    but I just keep getting a "Missing ;" error.

  • #2
    Re: AI Scouting Behavior Tips

    A few things for ya Miles:

    #1. GL4 changes this behavior DRASTICALLY. If you are using waypoints to designate custom troop movements (as I am), make sure to link everything with the defend module so they ONLY pay attention to the waypoints.

    #2. I use this script to visibly make units "scan" the area, you can tweak as needed
    EDIT: _deg is the degrees i want the unit to scan, e.g. 180,360,etc. The script will make hte unit scan back and forth within that degree arc of their current faicing position until you kill it.
    if (!isServer) exitWith{};
    _unit = _this select 0;
    _deg  = _this select 1;
    _face = getdir _unit;
    _gman = (gunner (vehicle _unit));
    while {(alive _gman) &&  (alive _unit)} do
    _gman setformdir _face+((random -(_deg)+(_deg/2)));
    sleep (random 6)+2;
    #3. Use combinations of triggers /w the "Switch" flag. What you would do is this:
    - create a sentry waypoint for a unit
    - create a trigger, set it to type "Switch", and set it to "blufor detected by opfor"
    - Add 2 more waypoints to the unit. the first a "Cycle" waypoint, and the 2nd being hte response to the trigger you want
    - Sync the trigger with the cycle waypoint

    Doing the above, you can use multiple triggers/cycle's to make the AI behave differently depending on which trigger e.g. The trigger will ALWAYS go to the waypoint AFTER the Cycle its synced to.

    #4. You can use the script above in unison with the "knowsAbout" script command. This command tells you whether unit a knowsabout/sees unit b. I use this for my FO script.

    Task Force Proteus

    The very existence of flamethrowers proves that sometime, somewhere, someone said to themselves, You know, I want to set those people over there on fire, but Im just not close enough to get the job done."


    • #3
      Re: AI Scouting Behavior Tips

      The "STEALTH" behaviour mode helps out a lot for recce/scouting kind of stuff. Have them move in "AWARE" mode, when they arrive, put them into "STEALTH" mode. They will go prone and crawl to cover, works pretty well.


      • #4
        Re: AI Scouting Behavior Tips

        Sorry for the bump. I've been looking for a script like this for a while. I'm kind of a noob, so could you clarify a bit exactly when and how you would call the script? If my player, "p1", or any other Takistani militia is detected in an area I want my US sniper team, "fssniper1", to run to a particular location, go prone, and scan back and forth until he sees someone. I'm quite familiar with triggers and waypoints, but the scripting is a problem. It would be nice if I could have his one or two squadmates cover his flanks as if they were spotting, but as long as I can get a single sniper to scan an area my mission would feel a lot more real. Could you get a little more in depth with you explanation?

        I understand that gman in the script seems to be the player character. what is the alive_unit part? Is that the scouting unit? And what's the part about a vehicle gunner?




        TeamSpeak 3 Server


        Twitter Feed