The AI doesn't want to use my custom feats

Hi, i created some custom feat that are spell-like(feats with an spell attached), no matter what i try, the AI don’t want to use them.

I read that the Category determines how the AI use the feat/spell but i can’t make it work.

In Feats.2da i have the following:
Category: 22

In Spells.2da:
Category: 22
Usertype: 1

I don’t know if i need to do something else in other .2da files.

i think you have to start by telling the Nwn2 core AI that your new feats actually exist:

nwn2_ai_2da_editor

basically you want to [backup and then] add entries to HenchSpells.2da

i wrote the app but tbh have used it only to check up on stuff that already exists; I’ve never used it to add new spells/feats, there are likely others who could advise you better on that,

 
Reading the docs should give you a bit of a handle on what’s going on though

That probably is the problem, i have a problem with that app though, it say “That file doesn’t appear to be HenchSpells, HenchRacial, or HenchClasses.2da”, i tried with the unmodified version of those files that are in the game folder and the modified from the mod TonyK’s Companion and Monster AI and i got the same error.

hm, i see that …

Somebody put an extra column into HenchSpells somewhere along the way (“Label”). The app checks the # of cols to decide which 2da it’s loading.

The version of the 2da that I have, and used to test the app has that column so i’ll have to look over some code and perhaps adapt it to deal with those 2das that don’t have it.\

eta: 1-24 hrs

 
If anyone knows where the HenchSpells.2da with a “Label” col hails from pls let me know.

The neverworker app allows you to add a Label. I tried to use it but is too complicated to use, it opened the files though, the problem is that i couldn’t find documentation about it.

Edit: I added an extra column after the column 0 called “Label” and it worked, but i think that you should have a version for the files by default.

good stuff, i must be using a version from Neverworker

I got an unlabelled 2da to load okay … am now trying to get the labels to show on the tree (and output them to file as it sounds like Neverworker can do)

ver 1.3

Isn’t there a HenchFeats.2da or something like that?, i still can’t make the AI to use my feats. Also, where are the HenchRacials and HenchClasses .2da files in the game folders? I can’t find them either.

at a glance it looks like HenchRacial and HenchClasses are exclusive to TonyK’s AI. (I don’t see them in /Data/2DA*.zip)

there’s no HenchFeats (feats are spells/spellabilities, often called featspells in the core AI)

If you’re loading from a saved game, new entries in HenchSpells won’t work, iirc. [actually it shouldn’t matter; since you’re adding brand new entries they ought be picked up here] (if I remember correctly) when a game loads, the AI iterates over all the entries in HenchSpells and stores them on the module-object for quicker access; i believe it checks the InfoVersion of each entry against the InfoVersion in HenchSpells, and if they’re the same, the loading sequence bypasses the entry (because it already has the spell/feat stored on the module-object). You can try setting the InfoVersion of your custom feats to something other than “22” … eg. “23”

Or you can try starting a new game (unless that’s what you’re already doing)

 
btw, the stock coreAI is somewhat different than TonyK’s – so it might handle InfoVersion etc. differently

Another possibility is that you’re assiging the feats to a monster/NPC that’s using the NwN1 AI scripts. They don’t use the 2das … instead, their event-scripts ( nw_c2_default* ) use functions from ‘nw_i0_generic’. That is, they do not use the gb_* or hench_* scripts (<- what i call the core AI).

Where is that InfoVersion? I can’t find it, maybe that is the problem, since the creature that i use to test the AI is a summon. TonyK’s scripts have “nw_c2_default*” but they come only in .NCS so i can’t check them, but i assume they include gb_* or hench_* scripts.

In nwn2_ai_2da_editor, the InfoVersion can be accessed under Options->Set Core AI version

note: of course you can change it, that’s just how much my sense of humor dries up while programming …

in the hench* scripts, if you want to go there, the constants are

const int HENCH_SPELL_INFO_VERSION      = 0x16000000; // ie. 22
const int HENCH_SPELL_INFO_VERSION_MASK = 0xff000000; // shift >> 24

 
Tony released his source, but it’s inside both/either the Erf and Hak editions. An erf or hak file can be opened with NWN2Packer v1.9 [nwn2packer_20080808.zip]. The .nss files are inside both haksource and erfsource archives

i guess you should also double check that your summon has uses for the feat, and that the feat is set up to have uses, etc.