Scaling costs for items/currencies


#1

Hey!

I’ve got an item that I’d like to make more expensive to buy the more you have of them (inventory slots basically). Am I correct in thinking that the only way to do this is to make that item as a currency and then have one Currency Conversion for each number of inventory slots you might already have?

As in:
Currency Conversion to use when inventory slots = 10: 100 Gold -> 1 Inventory Slot
Currency Conversion to use when inventory slots = 11: 120 Gold -> 1 Inventory Slot
etc.

Would cause a whole lot of Currency Conversions though. Any way to handle this some other way?


#2

Hey Oscar

The simplest thing might be to implement the purchase logic yourself via a Cloud Code script. If you are representing inventory slots as a currency, you could have a “buy new slot” script that calculated the cost of the new slot based on the current number of slots, and then implemented the purchase by just increment the slot currency. You could also use a Metadata object to store the slot count->cost mapping as JSON, if it couldn’t be determined from a simple formula.

I can think of a few other ways (like having a specific purchase item for each slot number), but most of them will involve creating a Catalog item for each slot number, which I think is what you wanted to avoid with your currency conversion idea.

Hope that helps.

Thanks
Mike


#3

Mm yeah, I suppose I’ll do a Cloud Code script.
I didn’t think about not using virtual purchases or currency conversions, but I guess I could just manually add and subtract currencies.

Thanks!