Created By: Hector Ramos
Difficulty Scale: Easy

In this tutorial we are going to learn how to modify enemy AI. I got thisinformation from Tutorial by Hector Ramos (

Let's Begin

First you have to decide for which enemy you are going to edit their AI. Then open up Res2.gob and search in the misc/ai/ folder for [enemy name].ai#. [enemy name] can be either the name of the enemy, or just an abbreviation. # stands for either 0,2, or nothing at all. .ai0 files are for Easy difficulty, .ai for Medium difficulty and .ai2 for Hard difficulty. In this tut we are going to use STDEFAULT.AI2 (Deafult Stormtrooper on Hard difficulty) and modify it so it moves fast, sees you from far away, etc.:


The file starts with some brief sentences describing the file, followed by:

alignment=-1.0, rank=0.5, fov=170, maxstep=0.2, sightdist=7.0, heardist=4.0, accuracy=0.45

Aligment: -1.0 stands for Darkside, 0.0 for neutral, and 1.0 for Lightside.
Rank: Should be related to Force Powers...
FOV: The number is how much degrees does the cone shaped field of view spans, starting directly in front of the actor. 90 would give it a very narrow FOV, 180 would cover all the front and sides, and 180 would enable it to see everything around it.
Maxstep: From which height they are willing to fall. Increasing it will enable them to fall from cliffs and such, but still take some damage. In this case MAXSTEP is 0.2, or 2 meters
SightDist: How far they see. This is measured in game units, in which one(1) unit is equal to ten(10) meters.
HearDist: How far they hear, in game units.
Accuracy: How good their aim is. This Stormtrooper has a 45% chance of hitting you.

Since we want to make the ST more difficult, we are going to change the line to this:alignment=-1.0, rank=0.5, fov=180, maxstep=0.2, sightdist=10.0, heardist=7.0, accuracy=0.90

We have improved the Storm Troopers sight, hearing and accuracy. Feel free to play with these numbers to make him either more difficult or easy.


These are some parameters which define the Stormtrooper's instinct...

#instinct			argsLookForTarget   	500.0, 45000.0Listen          	0.75, 2.0PrimaryFire     	2000.0, 0.8, 5.0, 0.20, 0.0, 300.0, 0.20, 0.00, 2.0, 500.0BlindFire       	1500.0, 0.50, 0, 0.8, 0.0, 0.20Follow          	0.0, 1.5OpenDoorsCircleStrafe    	6000.0, 30.0, 1.5, 1000.0, 1.0Talk            	10000.0, 0.10ReturnHome
For the PrimaryFire parameters, we have two sets of 5 numbers each. The first one is a delay in MS. You can see that the stormtrooper will fire 2 shots in quick succesion, with a delay of 500 MS (0.5 seconds) between each. The ST waits 2000 MS (2 seconds) before initiating the shots. I don't know what the second and third numbers do... The fourth number randomizes the shots; increasing it would make the bolts fly past you, not even close, and decreasing it would make the ST more accurate. The fifth number is another delay, the ST would have to wait 500 MS before doing anything else. Play with these numbers to your own risk.


GOB the file, place it into a new sub-dir in your JK dir, and play JediKnight using the -path command. (jk -path <dir of mod>)

I know this has been a short tutorial, and there is still more information to find about AI, but it will surely help you in editing AI in some way.