OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: cjrs on 31 Oct 2005, 06:08:24

Title: Disabling AI
Post by: cjrs on 31 Oct 2005, 06:08:24
Search didn't turn up anything useful....

Here's an easy one for you guys (obviously not for me), is there any way to disable AI ingame, WITHOUT putting them in careless mode?

I'm looking for a way to disable units from shooting/moving, but everything i've tried so far just makes them lie down. Not shooting, but lying down, which isn't what i'm looking to do exactly.
Title: Re:Disabling AI
Post by: bedges on 31 Oct 2005, 07:39:37
look at the disableAI command (http://www.ofpec.com/editors/comref.php?letter=D#disableAI). ;) you may also need this one (http://www.ofpec.com/editors/comref.php?letter=S#setUnitPos) depending on the circumstances...
Title: Re:Disabling AI
Post by: Exaercase on 01 Nov 2005, 07:26:05
Hello,
   DisableIA is the correct command but they have a drawack, in my knolege you can change it after use this command.

Best Regards, Exa

Title: Re:Disabling AI
Post by: cjrs on 01 Nov 2005, 07:57:27
look at the disableAI command (http://www.ofpec.com/editors/comref.php?letter=D#disableAI). ;) you may also need this one (http://www.ofpec.com/editors/comref.php?letter=S#setUnitPos) depending on the circumstances...

Same thing, he just lies down. Doesn't fire, at least.
Title: Re:Disabling AI
Post by: bedges on 01 Nov 2005, 08:09:25
if you could explain what it is you are doin in more detail we might be able to spot the error more easily. are you using both disableai "move" and disableai "target"? are you using setunitpos "up"?
Title: Re:Disabling AI
Post by: cjrs on 02 Nov 2005, 10:12:47
What I have is two US soldiers, and two Russian soldiers. One US and the two Russians stand there, in careless mode, which is good. The 2nd US soldier is the one i'm trying to make not fire without being in careless mode.

In his initialization field (which is where i'm assuming this stuff goes?) I have the code the link you posted had given me. The exact code I have is:

this disableAI AUTOTARGET; this disableAI TARGET; this disableAI MOVE

Now what he does, is immediately goes prone, and kills both the Russian troops. That shouldn't be, seeing as i've supposidly disabled his AI for both targeting and moving.
Title: Re:Disabling AI
Post by: The-Architect on 02 Nov 2005, 11:19:46
There are a couple of ways around it, probably many more.  The most obvious to me is to set the two Russians to captive withe the,

This SetCaptive True

command. The US guy won't shoot them then, no matter what his behaviour is. If you want him to shoot them after that just change their captive state to false again with,

Dude SetCaptive False

in a trigger or script.
Title: Re:Disabling AI
Post by: bedges on 02 Nov 2005, 18:02:41
it should be

Code: [Select]
this disableAI "AUTOTARGET"; this disableAI "TARGET"; this disableAI "MOVE"
with the inverted commas.

i'd have a look at the architect's suggestion too, as disableai is not reversable - if you need to move the loon normally afterwards, use the architect's solution.