Salk

[KotOR] AI scripts for NPC

6 posts in this topic

Hello!

 

I do not know how many of you agree with me but I personally hate that all 3 AI scripts in the game include the running into mines and making it impossible for the Player to withhold an attack.

 

The file aiscripts.2da has 3 AI states set for these 3 scripts: 0 (Default), 4 (Grenade) and 5 (Jedi).

 

Checking the .tlk file I found reference to more scripts: Aid, Melee, Ranged and No Script.

 

Now, I'd happily settle for the No Script and manage each of the party members in combat. Is there someone that knows more about those 3 AI states? I suppose that 1, 2 and 3 might be legitimate values and I am going to test that but if there is someone that has some tips, I'd welcome that wholeheartedly.

 

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

I'm just going to leave this here...

 

(for the record, plans rock, but I don't know if it works...)

 

788PBAO.png

Share this post


Link to post
Share on other sites

It'd be great if they did work but I don't think Bioware ever coded those additional NPC scripts.

 

Changing state to a number between 1 and 3 resulted in a "No script" behavior. Same if I set it to 6.

Share this post


Link to post
Share on other sites

It'd be great if they did worked but I don't think Bioware ever coded those additional NPC scripts.

 

Changing state to a number between 1 and 3 resulted in a "No script" behavior. Same if I set it to 6.

 

Hi Salk, just saw this thread.

 

You're correct -- Bioware never really added functionality for those NPC scripts. There's a bunch of places in k_inc_generic and k_inc_gensupport where you can clearly see they intended to, but apparently never got around to it.

 

Adding support for them isn't too hard, though. Just involves a lot of hooking into GN_DetermineCombatRound() and its myriad associated functions. I've got a Passive script working now in my Enemy Enhancer mod that can be selected and used just like any other. The Ranged and Melee ones shouldn't be hard, either...I just haven't had any time this week to fool around with it. :-(

Share this post


Link to post
Share on other sites

Well, if not this week, perhaps the next one! ;)

 

I am positively thrilled at this Enemy Enhancer project of yours!
 

Share this post


Link to post
Share on other sites

Hello!

I am resurrecting this thread because I think it is better to do that rather than open a new topic of very similar content.

What I am trying to do is figure a few things out about AI behavior in combat. I have made the No Script option available for party members and it does prevent the blind charge forward when that is undesirable (ex. mines ahead) but it does nothing to help in the case of shouts.

The AI uses GEN_I_WAS_ATTACKED as shout and that triggers responses found in the k_inc_generic script. 

I added a new entry to aiscript.2da which sets "aistate" to 6.

What I thought to do was to compile k_ai_default.nss using a k_inc_generic.nss with the following change:
 

/*(line 1053)*/ void GN_RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID)
{

...

/*(line 1061)*/ int nNPC_AI = GetNPCAIStyle(OBJECT_SELF); //Determines how the individual should react in combat

...

/*(line 1085)*/ if(GetPartyMemberByIndex(0) != OBJECT_SELF && nPartyAI != PARTY_AISTYLE_PASSIVE && !GetPlayerRestrictMode())

...

}

changed to:

/*(line 1053)*/ void GN_RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID)
{

...

/*(line 1061)*/ int nNPC_AI = GetNPCAIStyle(OBJECT_SELF); //Determines how the individual should react in combat

...

/*(line 1085)*/ if(GetPartyMemberByIndex(0) != OBJECT_SELF && nPartyAI != PARTY_AISTYLE_PASSIVE && !GetPlayerRestrictMode() && nNPC_AI != 6)

...

}

Can anyone confirm that this is a good enough solution?

I would very much rather have someone with expertise and familiarity with scripting be in charge of the code but alas, blinkyzero's project has never seen a public release anywhere and the author has not been seen for well over a year now.

Thanks for your attention.

Cheers!

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now