How to make upgrade costs go up

Hey, I’ve been trying to make it so that, when you buy an upgrade, the price of 2 other upgrades go up, but it seems like price can’t be changed, or something like that, anyone knows how to change the price of an upgrade dynamically ?

2 Likes

If you want to change upgrade prices dynamically, you have to turn cost into a function.

cost(){return new Decimal(1)}

Then, if you wanted to change the costs you could do something like this:

cost(){
  if(hasUpgrade("layerid",12)){
    if(hasUpgrade("layerid",13))return new Decimal(20)
    else return new Decimal(5)
  }
  else return new Decimal(1)
}
// order of upgrade ids doesn't matter
2 Likes