Skip to content

GetHasFeat question.

ShadowMShadowM Member Posts: 573
edited May 2020 in Builders - Scripting
Is there anyway to find out if a character has a feat on bic(character file) vs given from bonus feat from equipment or both?
GetHasFeat will return true for both. I need to know if the player character has it from selecting it as a feat or if it been given as bonus feat from an item or both. Can we get this function updated or a new one that return the information, like 1 has it on bic 2 has it on equipment 3 has it on both.

Comments

  • ProlericProleric Member Posts: 1,281
    For now, you could cycle through the equipped items' item properties, looking for bonus feats. GetItemPropertySubType will identify the feat in question.

    If GetHasFeat is TRUE but the item search fails, the feat must be on bic.
  • ShadowMShadowM Member Posts: 573
    Proleric wrote: »
    For now, you could cycle through the equipped items' item properties, looking for bonus feats. GetItemPropertySubType will identify the feat in question.

    If GetHasFeat is TRUE but the item search fails, the feat must be on bic.

    Thanks for the response and yes I thought about that, but that does not cover all the other cases. I need to also know if it is on a item that it only on the item and I also need to know if it on a item and on the bic.
  • ShadooowShadooow Member Posts: 402
    Create a copy of player, strip him from all items and use GetHasFeat after that.

    also, for feat that has uses, use this (taken from Community Patch 1.72):
    int GetKnowsFeat(int nFeat, object oCreature)
    {
    if(GetHasFeat(nFeat,oCreature)) return TRUE;
    IncrementRemainingFeatUses(oCreature,nFeat);
    int bHasFeat = GetHasFeat(nFeat,oCreature);
    if(bHasFeat)
    {
    DecrementRemainingFeatUses(oCreature,nFeat);
    }
    return bHasFeat;
    }
  • ShadowMShadowM Member Posts: 573
    Shadooow wrote: »
    Create a copy of player, strip him from all items and use GetHasFeat after that.

    also, for feat that has uses, use this (taken from Community Patch 1.72):
    int GetKnowsFeat(int nFeat, object oCreature)
    {
    if(GetHasFeat(nFeat,oCreature)) return TRUE;
    IncrementRemainingFeatUses(oCreature,nFeat);
    int bHasFeat = GetHasFeat(nFeat,oCreature);
    if(bHasFeat)
    {
    DecrementRemainingFeatUses(oCreature,nFeat);
    }
    return bHasFeat;
    }

    That a interesting way of doing it. I think I do that and a combination of on enter/level/ equip counters. Wish they just update the core function though.
  • Strife_and_DiscordStrife_and_Discord Member Posts: 17
    There is another interesting idea to try @ShadowM :

    You could try to utilize the NWNX_ON_ITEM_EQUIP_BEFORE NWNX_EVENT for this.

    1. Subscribe the NWNX_ON_ITEM_EQUIP_BEFORE event on Module load and associate it with some listener script.
    2. Before the item is being equipped and this event fires you can check the item for X feat and also the creature equipping the item(OBJECT_SELF) for the same X feat.

    This way you can get a result before the item is equipped. This is untested and will require checking though.
Sign In or Register to comment.