Arrow Homogenizer

Started by LoveLess, April 28, 2022, 07:34:52 AM

Previous topic - Next topic

LoveLess

Been a longstanding weirdness that there are several ammunition that exist in the game that have the exact same name, description and item properties... Yet they don't stack. So having something that made them able to do so based entirely off their item properties alone would be wonderful. This would also allow the players to pick and choose which stack they want to put the arrows into, if they are the exact same, and not require the creation of anything more complex than what is below. All NWN cares about when it comes to stacking is the tag, after all.

    object oTarget = GetSpellTargetObject();
    string sTargetTag = GetTag(oTarget);
    string sNewTag;
    itemproperty ipCurrent;

    if(GetBaseItemType(oTarget) == BASE_ITEM_ARROW ||
                GetBaseItemType(oTarget) == BASE_ITEM_BOLT ||
                GetBaseItemType(oTarget) == BASE_ITEM_BULLET)  //&& != eldritch archer modified
    {
        ipCurrent = GetFirstItemProperty(oTarget);

        while(GetIsItemPropertyValid(ipCurrent))
        {
            sNewTag += IntToString(GetItemPropertyType(ipCurrent))
                            + IntToString(GetItemPropertySubType(ipCurrent))
                            + IntToString(GetItemPropertyParam1(ipCurrent))
                            + IntToString(GetItemPropertyParam1Value(ipCurrent));
            ipCurrent = GetNextItemProperty(oTarget);
        }

        SetTag(oTarget, sNewTag);
    }



Might need something extra like ignoring temporary item properties, but I couldn't think of a reason that would really generate an issue currently given the ones that exist are very short durations.