OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Crowey on 27 Feb 2009, 18:30:48

Title: AI stay and hold?
Post by: Crowey on 27 Feb 2009, 18:30:48
Hi guys is there a simple way to make AI stay in or near a position and hold that area rather than running toward and engaging the enemy once a gun batlle commences? My situation is I want my player controlled team to enter a town where a battle is already taking place and the north side will hold the blufr who will just take cover a the opfor to do the same from the south... ie so basiacally there will still be AI left alive by the time the player arives
Title: Re: AI stay and hold?
Post by: twisted on 27 Feb 2009, 20:35:39
i think the guard waypoint does this.
Title: Re: AI stay and hold?
Post by: Wolfrug on 27 Feb 2009, 23:16:51
Um, actually the guard waypoint would do the opposite - send the AI off after any perceived threats anywhere on the island ;)

The Hold waypoint however should do it, if we're talking a whole group. The problem comes when people use AI mods like GroupLink or ECS that "take over" the native AI and send them off on wild goose chases everywhere.

So, to absolutely, positively make an AI stand still, you need to use disableAI->

Code: [Select]
unitName disableAI "MOVE"; unitName disableAI "TARGET";
These two together (unitname = name of unit, or if you're putting them in the init line, this will do)

"MOVE" disables regular moving, and "TARGET" disables the "2, engage that, man, at 3 o'clock!"-styled moving. Both are needed AFAIK to make sure the AI doesn't move.

The problem is of course that, I think, the old bug since OFP-times still persists in which a loaded SP game will re-enable all disableAIs (and do other strange things), but if you don't think this is a problem then you'll be fine. Otherwise there're ways to get around that too.

But...maybe a simple Hold waypoint should be enough!

Wolfrug out.
Title: Re: AI stay and hold?
Post by: The-Architect on 28 Feb 2009, 12:34:31
I think I saw a note in one of the patch changelogs that said they'd fixed that.
Don't quote me on it though.

Another way to make sure there's still baddies left is place them well. Get them inside buildings, in courtyards and around corners and the like. You'll doubtless have problems with your guys waliing around corner and getting whacked but that will just make you more careful.
Title: Re: AI stay and hold?
Post by: Rommel92 on 01 Mar 2009, 22:30:07
Set their combat mode to "YELLOW". That always helps too.  :P

Otherwise best suggestion is the one by wolfrug.
Code: (wolfrugs) [Select]
unitName disableAI "MOVE"; unitName disableAI "TARGET";
Title: Re: AI stay and hold?
Post by: Psybercastor on 23 Apr 2009, 13:57:03
I basically have the same problem. I want the enemy to stay in it's specific area and don't run away regardless how much combat is taking place somewhere close. However, I DON'T want to use disableAI "MOVE". I still want them to be able to move, but just in their own area. I wan't them to act as a bunker/sentry/guardpost sorts of groups.

Another idea would be to use disableAI "MOVE", but disable that script as soon as the player is close by enough, or they have visual contact or something like that. Is that possible?
Title: Re: AI stay and hold?
Post by: Ext3rmin4tor on 23 Apr 2009, 18:57:13
I've never found a way to completely make the AI hold the position without running away, but this method is good:

Create a HOLD waypoint and set the Combat Mode to "Don't fire" (it's the second from the top of the dropdown menu). In this mode the units will engage the enemy only if he is aware of their presence and can harm them. The problem is if they hear shooting it might happen that the leader decide to use some scout units and so you'll have someone running anyway but this prevents the whole group to break formation and run everywhere like fools