im trying myself with NWNCode and am currently trying to fix a script to the barbarian rage feats.
I need to find out wich barbarian rage feat the character has.
(I cant use the barblvl since feats are buyable on the module).
I thought to use GetHasFeat, but since there is only one Barbarian Rage Feat in the FEAT_* it wont help.
The lexicon does state on GetHasFeat that: “It may well return the amount of times it is useable, although it hasn’t been checked.”
Has anyone tried this yet? Getting the amount of times rage is useable might be just as good.
The FEAT_* constants stand for numbers that correspond to rows in feat.2da. I think you should be able to use GetHasFeat to check for specific feats by using the row number directly:
gethasfeat returns 1 if player has the feat and feat has:
- no uses (passive)
- unlimited uses (divine might/shield)
- limited uses and player has still at least 1 use remaining
when player depletes all the feat uses per day function returns 0. function doesn’t return anything else than 1 or 0 even when the feat has more uses than 1.
in case of rage, while it looks as single feat each version of rage has its own feat with own id, so you can check specifically if player has the version with 5 uses, 4 uses, 3 uses etc. just as TheBarbarian suggested and then code things appropriately
it would be bit different for feats such as stunning fist or turn undead whose uses are dependant on ability modifier or character level…
You may wanna edit your unlimited use example; divine might/shield uses a turn undead attempt for each use.
They do but the feat itself has unlimited uses which appears on quickbar/radial menu as an activeable feat with no number indicator. The feat can be activated unlimited times itself, only a feat’s script prevents the feat to grant any benefit when player has no turn undead uses, however the feat can still be used.
It’s like every time you post I learn something new.
Unfortunately I have no awards to give.