Salk

[KotOR] AI scripts for NPC

Recommended Posts

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.