OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: LiverWurst on 29 Jun 2004, 18:25:49

Title: Smart AI How To?
Post by: LiverWurst on 29 Jun 2004, 18:25:49
 Was wondering if anyone could help with a script that would make the AI smarter in noticing their flag being captured?

(I am already using parts of Backoff's Capture & Hold script and its working great.)

Here is the senario:

The game is MP with only one side (US) being human playable.  The parts of the C&H script that I have incorporated work great...I run up to the RUS flag pole, take the flag, and it puts the US flag on the pole, also on the map it changes the color of the ellipse from red to blue.  I have removed the scoring, the need to hold flag for a certain amount of time or the need to bring the RUS flag back to base.  All I require is for the enemy flag to be taken down and allied to be put on the pole in order for the territory to change sides and this is where my problem arises.  If I capture the AI flag and there are still RUS patrols, they do not try and take their flag back.  They just stand around the flag pole like nothing is wrong.  So, like I asked before, is there any way that anyone could help in the creation of a script that would make the AI take notice of the fact that they have lost their territory/flag and simply walk up to the flag pole and use the 'Take Flag' command in order regain control of their territory/flag?


Thanks....
Title: Re:Smart AI How To?
Post by: macguba on 01 Jul 2004, 12:24:00
I don't know anything about MP or CTF.    It may be that the game has AI routines to make the AI go to the flagpole and change the flag.

But if it doesn't, then you will have to order the AI to do it.   Changing the flag is easy - you just need a wee trigger around the flagpole, East present, and doing all the things that need to be done when East gets there.   Basically the same but opposite to what happens when West gets there.

Making them go there could also be easy:  you just dish out doMove or setWPPos commands.    However, the tricky bit is making them do that in a smart way.    You could create a script that, for example, makes the nearest / largest / smallest / both nearest and furthest away / random /group move to flagpole and then stay there to guard it.