Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

GetHasFeat question.

ShadowMShadowM Member Posts: 571
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: 876
    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.

    Ɲ𝔦𝔤𝔥𝔱Ʀ𝔞𝘷𝔢𝔫ShadowM
  • ShadowMShadowM Member Posts: 571
    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: 395
    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;
    }

    ShadowM
  • ShadowMShadowM Member Posts: 571
    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.