LucasForums (
-   JA Coding (
-   -   NPC behavior (

MeleeMaster 05-30-2006 07:58 PM

NPC behavior
Lol, sorry if I keep asking hard to answer questions. You see, I learned how to easily make NPCs and change their behavior ect. I was making a blue cultist that was on the lightside and gave it like 400 force and some other nice force powers like mind trick (to see if NPCs know how to use mind trick) and having some fun. I gave him melee as you would expect. Unfortunately when I spawned my cultist buddy he behaved like a gran boxer and didn't use his force powers but rather used the gran style of punching. I made sure he was the right class which was the reborn class (the class you gives sets their general behavior) and all that. Any help with getting him to act like a cultist would be appreciated. Also, I'm just wondering, whenever I give an NPC melee, they punch like grans, is it possible to get yourself to punch like that? I know its probably hard coded NPC behavior, but is it possible to give NPCs normal melee (what you get when you do give weapon_melee)?

MDN14 05-31-2006 01:03 PM

I dont know much about NPCs, but did you try making his class "jedi" instead of reborn? Maybe it would act differently than just punching and actually use mind trick.

MeleeMaster 05-31-2006 04:13 PM

Yeah I have but thx for the suggestion. Lol, I think I'll just have to pretend that they're using the force to enhance there punches. I got them to use force but when I'm upclose they still think they're grans.

MeleeMaster 06-07-2006 01:50 PM

I don't mean to double post but this is important, you see I think it's kinda obvious that some npcs have a little bit of special AI assigned to their npc files like saboteurs who use cloaking and cultists who use force (and force only) which is hard coded. But while I was searching through this forums I found a topic discussing how to give npcs the stealth/cloaking effects and at first the person couldnt get it to work but he put his new npc in the same .npc file that the npcs who use stealth are in and he got his npc to use stealth. So I think that AI (the special AI thats hardcoded to some npcs) is assignd to certain npc files rather than entries in an .npc file. So I think I'll finally be able to get my cultist to act like a force user.

EDIT:Heres where the thread is
And also it has something to do with the name of each entry in an .npc file.
My cultist still aint workin

razorace 06-08-2006 04:05 PM

From what I remember about the NPC AI code, the NPCs use specific code when using either the lightsabers or melee. As such, giving them melee or a lightsaber will override their NPC class select.

MeleeMaster 06-08-2006 09:16 PM

It seems to go by random when I give npcs melee because certain npcs want to be smart and chase me and try to knock me out while certain ones like to try and punch but stand still as if something is keeping them from moving. Also I've learned that making SP code changes are possible but barely because there's one SP/MP (it has an SP side and MP side) mod that is called the Chaos Force MOD 2 that has certain features that go way beyond the limitations of what can be edited in single player such as completely new animations and saber melee styles that are added rather than replacing old anims. and when I downloaded it I didnt open up its .pk3 inside the .zip but was stunned to see it came with new modified game .dlls which included the jampgamex86.dll which is obviously for MP which is no surprise but also came with a modified cgamex dll and uix(cant remember the whole name) dll. So SP code changes are likely possible but require great code language skills and understanding of .dlls. One time I tried to decompile the jagamex86.dll which I think is the main dll for the SP side of the game and according to the program I was using it said the dll was in C++. And also I think its possible to edit and add new npc AIs and values without too much trouble according to here Also could someone please tell me how to code some new npc AI for SP if it's possible? And would it be possible for me to get the game to assign certain special NPC behavior (the supposedly hardcoded AI used for melee fighters) to certain NPCs?
Thx for all your help everyone whos been answering my hard to answer questions over the weeks!

razorace 06-09-2006 12:55 AM

mmm, got a link for this Chaos Force MOD 2?

MeleeMaster 06-09-2006 11:05 AM

Here's a link:
Just click on one, there's two but one of them is just an animation fix I guess.
Could someone give me some help on NPC AI and behavior though? Im kinda lost with the way some of my melee using npcs have been acting.

razorace 06-09-2006 03:47 PM

Ok, I looked into it and the cgamex85.dll and the uix86.dll are actually the MP versions of those dlls. Plus, the mod only modifies the existing animation defines rather than creating new ones. Sorry, but this looks like a dead end. :(

Griswald 06-09-2006 05:33 PM

I may be mistaken, but I believe SP and MP use the same UI and CGAME code, and that the only main changes are the server (I could be mistaken, but I believe this is so)

MeleeMaster 06-09-2006 07:20 PM

Could someone please help me with the NPC AI though because that's what this topic is about.

Griswald 06-09-2006 08:22 PM

No offense, but you absolutely positively CANNOT make SP code changes without reverse-engineering (hacking) the dll's. Chaos Force Mod (upon further inspection), does indeed contain .dll files, but they are original and UNMODIFIED jka dll's (compare the filesizes to the ones in the JKA Base folder, exactly the same... modified dll's would HAVE to be different sizes, impossible to remain identical with any kinda code change to this kinda calibur)

In JKA, upon loading any new mod, it copies the dll files it loads into the mod folder. The author must have packaged the original DLL's in mistake. Upon further inspection of the pk3, there are several modified .npc and .sab files, as well as other modified game CONFIG files, and effects (created with effectsed). In order to author your own custom AI, you MUST have access to game code, otherwise it must be scripted through icarus (the only thing I can think of atm)

razorace 06-10-2006 01:00 AM


Originally Posted by Griswald
I may be mistaken, but I believe SP and MP use the same UI and CGAME code, and that the only main changes are the server (I could be mistaken, but I believe this is so)

I'm pretty sure that's not the case. The SP AI code refers to cgame stuff directly and to functions that aren't in the MP cgame code.

MeleeMaster 06-11-2006 12:00 AM

Guys, I dont necesarily mean coding completely new AI but rather making it so the game would assign premade AI to certain npcs. Is there any way to get the game assign (premade) certain AI to certain melee using npcs? Because as far as I know the game mixes and matches AI for my melee users. For example my cultist likes to constantly force lightning and push me and then when I get up close take a few cheap shots with his hands while a new wookie npc I made that uses melee cant seem to move from the exact spot from where I spawn him.

MDN14 06-11-2006 06:40 AM

probably has to do with range issues on the melee weapon itself and with what force powers you gave him. If the weapon projectile range of melee is set to the normal weapon projectile range, it is trying to hit you from where it is standing but is just swinging at the air, even though the actual weapon only has a small area in front of the player that it damages the enemy. Maybe I am just being stupid here, but I seem to remember seeing something like that with the melee weapon back when I used to tinker around a small bit with the code.

MeleeMaster 06-11-2006 10:35 AM

Thx, I'll toy around with the range and see if that helps. Cause one time I made an imperial officer with melee and he actually chased me. I'll have to do this stuff when I'm home because for the past 3-4 days I've been away but the hotels I've been staying in have had computers that you can use freely. I guess I better come to Utah more often.

EDIT:I guess I better have a look around in the MP SDK because I can look at the AI code and the way melee works, I mean it really cant be that much different in MP than it is in SP, oh yeah, I have to wait a few days till I get home.

razorace 06-11-2006 02:22 PM

Actually, the MP version of the AI code is just a much older version of the SP code. They are fairly different from each other.

Anyway, the difference between the reborn and the wookee NPC is that the reborn was set up as a jedi character. There's a special situation where the force powers based reborn only have melee, but use their force powers as their main weapon. Sorry I can't be more specific, it's been a while since I've dealt with that code.

MeleeMaster 06-11-2006 10:38 PM

But do you or does anybody know if theres a way to assign specific special AI that Raven already coded to certain melee using npcs? Because otherwise I'll just have to keep tweaking the .npc files till the game gets it right because for me it seems to mix and match the way they act and then just keep doing that till they act the way I want them to.

razorace 06-11-2006 11:04 PM

well, uh, you'd have to get the correct NPC class/weapon combination to work. Specifically what are you looking for?

MeleeMaster 06-12-2006 11:11 AM

But I thought you said when you give an npc melee it completely ignores the class you gave it. I know it has some effect on how they act but it gets kinda weird ingame though because like I said since the npc doesnt really have any special AI code to refer to its seems kinda randomized how they act. I'm not asking you specifically razorace but rather asking anybody if they have a clue on how to get player-made npcs to refer to certain AI thats probably hardcoded. Thx though for all your help razorace. And for example what I'm looking for is that when I make a cultist that he'll actually use the force powers I gave him rather than acting like a stupid gran. I made an exact copy of the cultist_lightning in the exact same .npc file and all I did was make him good and give him a few more powers and when I spawned him he did not even use any of his force powers. If you read my 2-3 post I somehow got one of my cultists to actually use force powers and heck he was using lightning more then darth sidious and then when I got up close he would maybe do a quick punch or two then he go all out with force again but there was still one problem, he couldn't seem to move from the spot where I spawned him. I want to make npcs that do act like grans that chase after me with their fists up and then when far away bring out their long range weapon. Like I'd want to make a wookie that acts just like that except with a bowcaster instead of detonators. I'd like to make my cultists be able to do fast punches and directional kicking but thats like impossible. Also I know its possible to get npcs to do things using icarus as said above. Would it be possible to make them act certain ways and in theory give them new AI using behaved. Because Ive opened it up before and it seems possible. But as far as I know behaved only opens .icarus files. I know its been done but how do you open, edit and create npcs using BehavEd

razorace 06-12-2006 01:56 PM

Oh, ok. Your problem sounds like a navigation problem more than the AI behavior that is being used. Did you try these different npcs at the same location on your map?

The reason why I ask is because the NPCs heavily rely on the NPC waypoint system to be able to navigate more than a few feet from their spawning location. In additon, you can ICARUS scripting to make them do patrols and so on.

As for the melee/class behavior situation, I actually looked it up and here's what I discovered....
Class Reborn + Melee = Jedi AI
Enemy Team + Themals OR Melee = Gran AI
Friend Team = Whatever AI the NPC's class is

I know, it's a bit weird, but that's how the SP code is configured. I hope that helps. :)

P.S. Please use more paragraphs. One giant paragraph is very hard to read.

MeleeMaster 06-12-2006 04:23 PM

Thx a bunch. That really helps. I'm going home tommorow and then I'll get to do some experimentation alon with BehavEd. How do you use BehavEd though on npcs since it can only open icarus files?

MDN14 06-13-2006 04:27 PM

BehaveED makes the script files, and you have the NPCs use the script that you made for them. I dont remember the key to use though on the NPCs themselves, someone else around here probably does though.

MeleeMaster 07-04-2006 12:28 PM

I've found out a few more things about behavEd and know I know you can basically almost create new AI with it. For example I could never seem to figure out how to get gun using cultist to jump and use force powers but I saw a folder named scripts that had a script named cultist_jump. But I have a problem. BehavEd only uses .icarus files while all the game scripts are in .ibi format which is a problem. Also, I'm really tired of how much damage punches do when npcs do them. Each punch does 20-30 damage while the blaster pistol does around 10 damage and the rifle 20 damage. I know Raven probably did it that way to simulate gran punches hurting a lot because of their big hands mainly because thats the only melee using npc Raven made that actually punches. But after seeing the movies and playing some other star wars games Gran hands are no where near that big. In some games they were kind of small. Also how do you get npcs to use scripts without map editing because I can not map edit.

MDN14 07-04-2006 01:15 PM

You make the script in BehavED and then compile it into an ibi file. Just hit the compile button and it makes the file for you.

MeleeMaster 07-06-2006 09:17 AM

Razorace said how the SP AI code works as seen above but there's one problem. Whenever I try and make a friendly npc that uses melee, they all suck. And no matter what class I give them they act exactly the same. No matter what stats I give them. They all act EXACTLY the same, and the AI I'm stuck with for them sucks.

EDIT:Why are NPCs so freaking complicated? Also after looking around in the MP SDK some I saw a lot of files talking about NPCs (not bots, NPCs).

razorace 07-06-2006 01:53 PM

It's because each NPC class is basically implimented seperately to give them different behavior. Plus, some of the boss behavior is hardcoded into the NPC code, like the evil healer twins for the Rosh battle, or Tavion's Spector attacks.

MeleeMaster 07-06-2006 03:12 PM

Remember how you said friendly team=whatever class you chose? Well it doesn't seem to make a difference. I'm not talking about boss behavoir either. You see I'm trying to make an npc called rebel_commander that uses melee and acts like a gran except is tougher and smarter ect. and the problem is no matter what I do he can't seem to act right. Here's my problem, the scenario is him and a gran in a fist fight, rather than constantly punching after doing one punch he'll whip around and face the opposite direction as if he was trying to dodge the attack (but of course he doesn't dodge it) and then after a second or two he'll decide to punch again then face another direction, basically he goes *punch, 1...2...3 punch, 1...2..3 punch. No matter what class he is are what stats he has he'll do this.

MeleeMaster 07-08-2006 10:02 AM

Okay, I just downloaded a huge single player mod called Escape from Yavin IV and in the second level there's a few grans with their fists up, I get hit once and it does 40 damage, normally they do around 25 damage, then he hits me again and it does 60 damage and sends me flying through the air, what the hell?

MeleeMaster 07-19-2006 05:16 PM

Hey guess what, I learned the you can add multiple classes to a .npc file to get different behaviors, I had never though of trying this before because I normally use the NPC Tool for creating NPCs which onlys allows one class. But I did this with my rebel commander NPC that uses melee and now he kicks Gran a** but still has a few problems (after that I modified his .npc file (I had all the extra classes typed as lowercase letters but I changed them to capital letters and know he doesn't seem to kick as much a**).

razorace 07-20-2006 01:15 AM

odd, I don't see how that would be possible with the code that I've seen.

MeleeMaster 07-20-2006 07:16 AM

Well you see I saw a topic where Tinny was asking how to make his own dual pistol NPC and he had its class set at commando and it wasn't working. Then someone told him to put in the commando class and the reborn class so then he had both classes in his NPC file and he said that it worked (and behaved better Im assuming) that it worked better (it still didn't have dual pistols though). The point is that he gave it 2 classes and it behaved differently. I may be wrong because theres a good chance the game just picks one of the classes to use by random but I didn't get any error messages ingame talking about my NPC having more then one class.

razorace 07-20-2006 03:45 PM

mmm, well, a NPC can only be one class, that's simply the way the NPC class is set. I'm not even sure how it would parse that NPC file. Are we referring to the same actual NPC or just the same NPC file? Could you give an actual example of the NPC file?

MeleeMaster 07-20-2006 04:44 PM

Well, I mean giving multiple classes to one entry in an NPC file, results are varied, to me it seems like the game just randomly picks one of the classes but somtimes it seems different. Here's an example:

playerModel kyle
customSkin blue
weapon WP_MELEE
rank captain
aggression 5
aim 5
evasion 1
intelligence 5
move 1
reactions 1
playerTeam TEAM_PLAYER
enemyTeam TEAM_ENEMY
health 200
earshot 4024
visrange 4024
yawSpeed 890
walkSpeed 220
runSpeed 450
snd kyle
sndcombat kyle
sndextra kyle
sndjedi kyle

NightXsenator 06-05-2010 07:15 AM

Hmm... MeleeMaster, I doubt you're still here... But if you'll ever return, then contact me on email adress:, I want to a bit about npc's in Jedi Academy... I'm also very interested in npc system and quite desperate because of all these faults... So...

razorace 06-07-2010 09:23 PM

What do you want to know?

Tinny 06-07-2010 09:59 PM

I'm so tempted to scrap the npc system and rewrite it meself, its sooo bleh because i think they just ported it from sp in a hurry.

Kimberly 06-08-2010 03:44 PM

I'm not sure but if i recall correctly there is already a NPC Unleashed project ;) led by Matt or something ...

oh yeah I also tried to fix the NPC system but I have just made the npc team spliting up :)

Tinny 06-09-2010 10:12 AM

Do you know if a site or forum's up for npc system? Wondering what they plan to do to fix the npc system, and seeing if i can help any :)

NightXsenator 06-09-2010 10:56 AM

Maybe it's possible to contact and persuade LucasArts reveal all secrets of NPC skills in Jedi Knight two last games? The game is quite old and... not widespread, if to say... So, not great loss it will be for them.

All times are GMT -4. The time now is 09:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2015 - All rights reserved.