Jump to content

Home

stoffe -mkb-'s improved AI (was Question about behaviors...)


J_Slash

Recommended Posts

Edit tk102: See this post for stoffe -mkb-'s download

 

Hi all,

 

is there any way to reactivate the "defensive behavior", or at least edit the existing ones??

it's pretty annoying when these guys just start runnin around bashing stuff and gettin the aZ woopin of a lifetime and leave u all by yourself!!!

 

i tried editing some stuff but didn't work, i also tried scripting but i suck at it so i didn't get pretty far!!

i almost lost hope but i found some really capable guys at this forum, i'd appreciate it if somebody could help me with this. thanx

Link to comment
Share on other sites

  • Replies 110
  • Created
  • Last Reply

Is this for K1, or K2?

 

If its for K2, then if your a jedi , i cant remeber which kind of lightsaber form it is, but it has a defensive stance.

 

Or your could also script and when you are turning you teamates into jedi, they could turn into counsalers, rather than guardians. But its whatever you want to do!

 

Hope this helps:D

 

DarthSmallz

Link to comment
Share on other sites

it's for k2

actually it's not the sabre forms, it's the behavior stances right next to it, u know the one that has "agressive, ranged, stationary,..."

there was supposed th be a deffensive stance but it was cut

out...(thanx LA)

 

if u got anything else just let me know, i can't get it out of my head!!!:burn1:

Link to comment
Share on other sites

It may not be exactly what you are asking for, but if you want to try it, download this file, unpack it and put it in your Override folder.

 

It's the main AI script that I've modified. It doesn't add the "Defensive" AI style, but it modifies the "Jedi Support" AI style to work roughly like the Defensive style is described in the manual.

 

More specific, your party members will not attack enemies further away than 10 meters (or 20 meters of they use force powers since they are ranged), and they will attempt to stay within 10 meters of the party leader no matter what.

 

Note that I only use this style for melee/lightsaber characters since it's not adapted for ranged attackers (ie not attacking enemies further away than 10 meters from the party leader).

 

Also note that if an enemy ranged attacker shooting at them is further away than 10 meters it's up to you to handle it since the AI won't chase them down as long they are too far away.

 

This only modifies the AI style for party NPCs, not regular opponents.

 

 

(If you use this file, be warned that it also contains some other modifications to the AI that I've made, mostly how they use force powers and feats. They will only use the best power/feat in a particular series, most of the time. (Ie don't use Flurry if they have Master Flurry, don't cast Horror if they know Insanity etc.)

Link to comment
Share on other sites

this is great!!

thanx stoffe, i've been tryin to do this for like a month and couldn't get anywhere!!

just out of curiosity, did u use a source script from the game??

 

anyway thanx man i owe u a lot!!

 

i'm so happy!!!!:bounce1:

 

EDIT:

i found the script never mind!!

thanx man..:)

Link to comment
Share on other sites

Originally posted by J_Slash

this is great!!

thanx stoffe, i've been tryin to do this for like a month and couldn't get anywhere!!

just out of curiosity, did u use a source script from the game??

 

Yes, fortunately the source code for the AI-scripts can be found in Scripts.bif. I've been modifying them a bit to correct bugs and try to make the party members act a bit less stupid.

 

Originally posted by Achilles

Does this mean that Jedi Support is now available to non-Jedi party NPC's?

 

I don't suppose you've modified Grenadier to re-implement Droid Support? :D

 

No, I haven't figured out where the game determines what AI modes should be available for what classes, unfortunately. Maybe I could replace/modify the Grenadier mode for non-force users though since grenade-lobbing AI tends to be better at harming party members than the enemies. Shouldn't be too much work.

 

What's wrong with Droid Support currently? I haven't been using droids much in my party in TSL more than when T3 is going solo, and then you have no need for AI scripts. :)

Link to comment
Share on other sites

Originally posted by stoffe -mkb-

What's wrong with Droid Support currently? I haven't been using droids much in my party in TSL more than when T3 is going solo, and then you have no need for AI scripts. :)

They don't have one :p

 

For some reason they decided not to include Droid Support in TSL, which means that unless you switch to a droid party member and queue up one (or more) of the droid utilities, they will only use default attack.

Link to comment
Share on other sites

Originally posted by J_Slash

Well, since the official patch is history...

Really? Since when? I check the OE and LA sites pretty regularly, but may have missed an official notice that they decided against a patch. OE's site admins must be asleep at the wheel.

 

Originally posted by J_Slash

...do you think the guys at the "TSL Restoration Project" could fix these stuff??i mean since they're already scripting "half the game"!!!(again, thanx LA)

Based on what that team has previously announced (more here ) the idea behind their project seems to be restoring cut content (cutscenes, dialog, etc). Since there is no indication that OE intended for their to be a Droid Support behavior, then adding one would be outside the scope of what they are working on.

 

And since the number/availability of the behaviors appears to be hardcoded, they would have to replace an existing one...which it also appears stoffe-mkb- has already done.

 

Not sure where that leaves us.

Link to comment
Share on other sites

I didn't say that they decided against the patch! it's just taking soooo long we might as well forget about it, as most poeple did and solved some of the bugs by themselves!

 

As for the restoration project, these behaviours were cut out from the game too, but i found some stuff about them in the game files so maybe they could be restored too, right??

Link to comment
Share on other sites

Originally posted by Achilles

They don't have one :p

 

For some reason they decided not to include Droid Support in TSL, which means that unless you switch to a droid party member and queue up one (or more) of the droid utilities, they will only use default attack.

 

That's odd... Seems like I got an excuse to take some droids along for a bit after all. :) I'll see what I can do about changing the Grenadier to use droid utility weapons and staying close the the party leader while still using ranged weapons effectively.

Link to comment
Share on other sites

Originally posted by stoffe -mkb-

That's odd... Seems like I got an excuse to take some droids along for a bit after all. :) I'll see what I can do about changing the Grenadier to use droid utility weapons and staying close the the party leader while still using ranged weapons effectively.

You would be the best if you did that. I almost feel like this belonged in the request sticky :D

 

Thanks for looking into this!

Link to comment
Share on other sites

Originally posted by J_Slash

As for the restoration project, these behaviours were cut out from the game too, but i found some stuff about them in the game files so maybe they could be restored too, right??

I poked around the AI style code in k_inc_generic yesterday, and although I personally think it's an interesting task to pursuit, we don't currently have any plans to change the AI styles as a part of the TSLRP.

 

Meanwhile, stoffe here definitely knows his stuff and he's already working on it, so I say "all's good" ;)

Link to comment
Share on other sites

Thanx Razorfish, and good luck on the project, i can't wait!!:)

 

Stoffe, is there some other AI stuff that u did?? if there is where can i get them?? thanx man..:)

 

Oh and i forgot, Achilles, thanx for the great tutorials..:)

Link to comment
Share on other sites

Originally posted by Achilles

You would be the best if you did that. I almost feel like this belonged in the request sticky :D

 

Thanks for looking into this!

 

Seems like I've gotten it to work fairly well now. The Jedi Support and Grenadier AI styles now prevents the NPC from going off more than 10 meters from the party leader*, and I modified it to work with both melee and ranged weapons.

 

I also modified the Grenadier AI style to use Droid Utility Weapons if the NPC is a droid, and G0T0's droid scrambler if the target is a droid too. Further I changed it so only Mira (or someone with a Wrist Rocket Launcher) will shoot grenades by themselves when using the grenadier AI style.

 

It seems to work from what little testing I've had time to do so far, but I'll have to test it and optimize it a bit more before I'd feel safe to let someone else try it.

 

 

---

 

* = There is one slight problem that there's no way to prevent from happening AFAIK. It appears that the game is hardcoded to issue an Attack action to all party-members who aren't already in combat when the player clicks on the Attack/Combat Feat GUI button.

 

So if you control a ranged character and click on a far-away target to attack, all the melee NPCs in the party would rush to that target no matter how far away it is.

 

Unless I'm missing something this isn't scripted, or at least isn't using the standard AI script. But I have some idea of how to intercept and cancel the order for Defensive NPCs that'd work in most cases.

Link to comment
Share on other sites

I've now cleaned it up a bit, tested it a bit more and added some countermeasures to break off their hardcoded attack action when you press the Attack/Combat Feat button on the GUI. If you want to test it, download this file, unpack and put in Override.

 

Edit: There is also a version available with an installer that will make it automatically integrated with the High Level Force Powers mod I have made. This version can be downloaded here

 

To summarize what I've changed:

1) Jedi Support -

* NPC will stay within 10m of the party Leader and only attack targets it can reach from there with its current weapon or force powers.

* Will use the best in a series of force powers, for example never use Wound if the NPC knows Choke. Whirlwind and Wave are exceptions to this since what they do is so different and both have their uses.

* Added limited Sanity check for force power usage. For example, NPC will not cast Horror/Insanity on a target already trapped in a stasis field or already horrified.

* Will always use the best in a series of Combat Feats, for example never use Flurry if the NPC knows Master Flurry.

 

2) Grenadier -

* Party Droids will use their Droid Weapons (flame throwers etc) every now and then, and use combat feats (rapid shot, power blast...) a bit more often. G0T0 will use its droid scrambler against other droids.

* NPC will stay within 10m of the party Leader and only attack targets it can reach from there with its current weapon.

* Will always use the best in a series of Combat Feats, for example never use Flurry if the NPC knows Master Flurry.

* Only party NPCs with a wrist rocket launcher will automatically use grenades (and rockets) with this style selected to make more effective use of those resources.

 

 

I've tested it for a few hours and as far as I can tell it appears to work as intended, with two exceptions, both related to the seemingly hardcoded "Attack my target" action when you press the GUI button.

 

1) If the NPC has force jump, a lightsaber equipped and a clear line of flight to the target you issue an attack action for, they will force jump to it (since jump trigger automatically on a standard attack) even if the target is too far away. Jump is too quick for my workaround to intercept. They'll run back to the party leader right after the jump though.

 

2) If the NPC is more than 5 meters away from the party leader when the attack command is issued, they are out of range of my quick-workaround and will run to the target even if it's too far away, and then run back to the party leader at the end of that combat round.

 

This problem is really only apparent if your party leader is using ranged weapons and the other party NPCs are melee attackers, since if the leader is a melee attacker the target would most likely already be in within the 10m range, or be in range shortly anyway.

 

It also only seems to happen if the NPC isn't already fighting something else.

Link to comment
Share on other sites

AWESOME!!! u know u should post a tutorial about these stuff if u have the time....The force is strong with u!!!;)

 

I'm gonna give this bad boy a spin!! thanx Stoffe, now i owe u BIG TIME!!!

 

EDIT:

/*

DJS-OEI 2/19/2004

This is a specialized On Dialogue Script for henchmen

in KotOR2. The designers wanted a method for allowing the

DLG to be selected based on the current area (or

anything else for that matter). This helps split up the

dialogues to make them more manageable. Since the default henchman script calls k_ai_master, there was no way to use anything other than the attached DLG. Below, I have copied all of the relevant script from k_ai_master, allowing selection of the DLG without compromising the current functionality. We just

need to be sure that if the k_ai_master script changes in the

Henchman OnDialogue event, we'll need to mirror that here. It's

unlikely to happen, though.

*/

 

 

I don't get it, what does dlg scripts have to do with combat?

:confused:

Link to comment
Share on other sites

Originally posted by J_Slash

I don't get it, what does dlg scripts have to do with combat?

:confused:

 

The combat AI uses a variety of "shouts" to communicate orders/requests to other NPCs behind the scenes. For example if one of the party members picks up a target and attacks it, it shouts "ATTACK_MY_TARGET", and any friendly NPCs within hearing range who aren't preoccupied with something else that hears the shout will join the battle and attack the target of the shouter.

 

Such shouts are picked up and handled in the OnDialogue event script of the NPCs. Most standard NPCs use the OnDialogue script in k_ai_master, though party members have their own custom scripts that does not use that file, but include the combat AI script directly.

 

As such, those files had to be recompiled and included so they'll use my modified version of the combat AI.

Link to comment
Share on other sites

OMG!! i give up!! i was already having a hard time understanding the k_ai_master, now i KNOW this is out of my league, so i'll just leave the masters do their magic!!

 

Oh the 1800's, it was a much simpler time!!!:violin:

 

Thanx Stoffe, u've been a great help..:)

Link to comment
Share on other sites

stoffe - Thanks for making this! Haven't had a chance to try it, but it sounds great.

 

 

:D Any chance of releasing the .NSS?:D

 

I've wanted to play with AI ever since the first time I got a "mighty" Sith Lord to 50% health, after which he did nothing but cast feeble Drain Life!

 

while (HP < (MaxHP / 2))

{

//gotta have this game out by xmas, so.....

DrainLife();

}

 

:p

 

Thanks

Link to comment
Share on other sites

Originally posted by DarthSilius

[b

:D Any chance of releasing the .NSS?:D

[/b]

 

I suppose I could, but since I'm not quite ready to give up on those two problems listed above it's something of a work in progress. And as such the code is quite messy with a bunch of debug printouts and other things sprinkled throughout it.

 

I think I'll add the source to the archive in a few days when I've either fixed those problems or given up, if someone's interested. :)

 

Originally posted by DarthSilius

I've wanted to play with AI ever since the first time I got a "mighty" Sith Lord to 50% health, after which he did nothing but cast feeble Drain Life!

 

while (HP < (MaxHP / 2))

{

//gotta have this game out by xmas, so.....

DrainLife();

}

[/b]

 

If you just want to play with AI in general though, the standard code can be found in Scripts.bif.

 

Though you might want to start with k_inc_force first and correct the bugs with Drain Life and Death Field. Their description in-game doesn't mention a damage/drain cap any more, so I'd recommend fixing it by removing the cap in the code. Makes them a bit more lethal when they drain for 100+ damage at higher levels. :)

 

Doing a quick fix for the heal issue though isn't that hard, just need to add a randomizer condition to the healing routine. Since if the healing routine triggers, it will block off all other combat actions until it no longer triggers.

 

 

I guess they didn't put much work into the enemy force use AI since there are so few enemies in the game that uses any force powers to speak of. (Which I don't really mind, since they were so over-abundant in KotOR that you didn't feel one bit special as a Jedi. :) )

Link to comment
Share on other sites

I just updated the archive with the source code as well, in case someone wish to test using this but already have the necessary files modified by some other mod.

 

As far as I remember there is no actual change in any of the hen-dialog NSS files, they just need to be recompiled to use any changes made in the include files, along with k_ai_master. I still included all the necessary files (I hope) to make it easier to compile. There's a batch file with all the files that need to be compiled.

 

That said, is anyone actually interested in testing/using this thing or should I not post more if/when I modify other things with the AI?

 

And if someone did test the files I posted earlier, did everything seem to work OK or did you run into any problems?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...