How can I limit the resources I receive to a certain value?

Hello there.
I’m new to TMT, so I’m asking for help. I have a layer whose resource has a limit (cap), conventionally 20 units. How can I limit the resource I receive depending on what I already have?

1 Like

TMT doesn’t talk to new players

put a .min(20) on your prestige gain formula

for example:

    getResetGain() {
        return player.points.div(10).root(2).floor()
    },

becomes

    getResetGain() {
        return player.points.div(10).root(2).floor().min(20)
    },

and

getNextAt() {
    return getResetGain('p').pow(2).times(10)
}

becomes

getNextAt() {
        if (getResetGain('p').add(player.p.total).gte(20)) {
            return Decimal.dInf
        } else {
            return getResetGain('p').pow(2).times(10)
        }
}

some months has passed in prev comment