Caves of Qud

Caves of Qud

Customize your Adventures
Download, share and create mods for Caves of Qud.
Learn More
Daisy 3 11 Dec, 2023 @ 9:51pm
Would someone help me mod the merchant's loot tables?
Ever think about how buying out a grenadier's inventory every time they're stocked up doesn't help them to expand? Ever think about how proselytizing a gemcutter into giving away all their all their precious rocks doesn't bankrupt them?
Some times I feel like these are exploits, because when you terrorize and steal from a merchant over and over. You'd think they would go thirsty.

I want to make a mod that alter's what the merchants in the game will stock based on how valuable the items in their inventory are. So that if you do allot of business with a merchant then the items they sell might go up a tier. But if you constantly steal from them they won't restock their inventory.

The basic pseudo code I have in mind goes a little like this.
before they restock, I want to add the base water value of the merchant's inventory to a variable attatched to the merchant.
Just after they restock their inventory, the value of those items are subtracted from that variable.
Then what loot tables the merchant will restocks with is based on that variable. A title is appended to the merchant's name. Ranging something like this

destitute (Nothing) <

Failing (half of what they're normally sell, or lower tier items.) <

functioning(Current base game item table.) <

flush(Twice their normal items, or items of 1 teir higher than normal) <

Opulent. (They more regularly stock a special set of items, or rare items. Bookbinders sell shrodinger's pages, Grenadiers sell missile launchers and stock piles of all tiers grenades, kippers sell drops of nectar, gunsmiths sell laser weapons, and ichor merchants sell the rare liquids: cloning draught, sunslag, warm static and neutron flux.)

I would love to code this myself but I don't know anything about coding and I bounce off it whenever I try to learn. So I need a little help.