Skip to content

How do you handle the bug that doesn't track Unacquire gold?

LuckyDayLuckyDay Member Posts: 7
edited July 2019 in Builders - Scripting
OnUnacquireItem doesn't trigger when gold is lost.

OnAcquireItem does trigger but doesn't recognize that it is gold or even anything. There is a simple fix that can handle this using GetModuleItemAcquiredStackSize()
int getGoldAcquired();

void main()
{
    object PC = GetModuleItemAcquiredBy();
    int goldAcquired = getGoldAcquired();

    string message = "You picked up " + IntToString(goldAcquired) + "gp";
    AssignCommand(PC, SpeakString(message));
}

int getGoldAcquired()
{
    int totalGold = 0;
    object PC = GetModuleItemAcquiredBy();
    object item = GetModuleItemAcquired();

    if(GetIsObjectValid(item) == FALSE)
    {
        totalGold = GetModuleItemAcquiredStackSize();
    }

    return totalGold;
}

OnUnacquireItem does not have an equivalent for GetModuleItemAcquiredStackSize() - it would probably be called GetModuleItemLostStackSize()

So nothing is triggered when gold is lost. This is a bug that's been around forever. There's lot's of times a scripter might want track this as you can track the loss of gear but you can't gold (the lexicon says that the issue extends to stacked items but it contradicts itself on this I haven't found this problem in testing yet, at least when I drop something).

How do other people handle this?

Comments

  • ShadowMShadowM Member Posts: 573
    I handled it by making a new base item of gold. I have not found a need to track gold lose or have used other workarounds related to it. Nice work around with stacksize. I think I tried that too, but it had some issues some money systems I wanted, so went with the new base item.
Sign In or Register to comment.