short Player5sshort Player20sshort Player100sshort PlayerOwesshort ExchangeInshort ExchangeOutshort Billsshort Changeset ExchangeIn to 100set ExchangeOut to 43set Player5s to player.GetItemCount MoneyNCR5set Player20s to player.GetItemCount MoneyNCR20set Player100s to player.GetItemCount MoneyNCR100set PlayerOwes to ExchangeInIF Player100s >= 1 && PlayerOwes >= 100 set Bills to (PlayerOwes / 100) IF Player100s >= Bills player.RemoveItem MoneyNCR100 Bills set PlayerOwes to (PlayerOwes - (Bills * 100)) set Player100s to (Player100s - Bills) ELSEIF Player100s < Bills player.RemoveItem MoneyNCR100 Player100s set PlayerOwes to (PlayerOwes - (Player100s * 100)) set Player100s to 0 ENDIFENDIFIF Player20s >= 1 && PlayerOwes >= 20 set Bills to (PlayerOwes / 20) IF Player20s >= Bills player.RemoveItem MoneyNCR20 Bills set PlayerOwes to (PlayerOwes - (Bills * 20)) set Player20s to (Player20s - Bills) ELSEIF Player20s < Bills player.RemoveItem MoneyNCR20 Player20s set PlayerOwes to (PlayerOwes - (Player20s * 20)) set Player20s to 0 ENDIFENDIFIF Player20s < 1 && PlayerOwes >= 20 && Player100s >= 1 set Bills to (PlayerOwes / 20) player.RemoveItem MoneyNCR100 1 set Player100s to (Player100s - 1) set Change to (5 - Bills) player.AddItem MoneyNCR20 Change set Player20s to (Player20s + Change) set PlayerOwes to (PlayerOwes - (Bills * 20))ENDIFIF Player5s >= 1 && PlayerOwes >= 5 set Bills to (PlayerOwes / 5) IF Player5s >= Bills player.RemoveItem MoneyNCR5 Bills set Player5s to (Player5s - Bills) set PlayerOwes to (PlayerOwes - (Bills * 5)) ELSEIF Player5s < Bills player.RemoveItem MoneyNCR5 Player5s set Player5s to 0 set PlayerOwes to (PlayerOwes - (Player5s * 5)) ENDIFENDIFIF Player5s < 1 && PlayerOwes >= 5 IF Player20s < 1 player.RemoveItem MoneyNCR100 1 set Player100s to (Player100s - 1) player.AddItem MoneyNCR20 5 set Player20s to (Player20s + 5) ENDIF IF Player20s >=1 set Bills to (PlayerOwes / 5) player.RemoveItem MoneyNCR20 1 set Player20s to (Player20s - 1) set Change to (4 - Bills) player.AddItem MoneyNCR5 Change set Player5s to (Player5s + Change) set PlayerOwes to (PlayerOwes - (Bills * 5)) ENDIFENDIF player.AddItem Caps001 ExchangeOutset JordyDialogue.NCROnHand to (JordyDialogue.NCROnHand + ExchangeIn)set JordyDialogue.PlayerNCROnHand to (JordyDialogue.PlayerNCROnHand - ExchangeIn)set JordyDialogue.PlayerCapsOnHand to (JordyDialogue.PlayerCapsOnHand + ExchangeOut)
It successfully pulls out the appropriate amount of mixed NCR bills, until $100 total has been removed, and then gives the player 43 caps. Seems pretty obvious that the temporary variables defined at the start of the script are working fine.
Now on another NPC, I have this...
short Player5sshort Player20sshort Player100sshort Owedshort Billsset Player5s to player.GetItemCount MoneyNCR5set Player20s to player.GetItemCount MoneyNCR20set Player100s to player.GetItemCount MoneyNCR100set Owed to 200player.RemoveItem MoneyNCR5 1player.RemoveItem MoneyNCR20 Player20sIF Player100s >= 2 player.RemoveItem MoneyNCR100 2 set Owed to 0ELSEIF Player100s == 1 player.RemoveItem MoneyNCR100 1 set Owed to 100ENDIFset Bills to (Owed / 20)IF Player20s >= Bills && Owed >= 20 player.RemoveItem MoneyNCR20 Bills set Owed to 0ELSEIF Player20s >= 1 && Owed >= 20 player.RemoveItem MoneyNCR20 Player20s set Owed to (Owed - (Player20s * 20))ENDIFset Bills to (Owed / 5)IF Player5s >= Bills && Owed >= 5 player.RemoveItem MoneyNCR5 Bills set Owed to 0ELSEIF Player5s >= 1 && Owed >= 5 player.RemoveItem MoneyNCR5 Player5s set Owed to (Owed - (Player5s * 5))ENDIF
I added the line to remove a single $5, and to remove $20's equal to Player20s, just as a test. However the only thing this script does when I hit that dialogue topic, is remove a single $5 -- seems apparent that something isn't working correctly with the temporary variables that I'm setting.
...anyone have any clues as to what I'm missing here?
