# Why does my buyable effect not work

**URL:** <https://forums.moddingtree.com/t/why-does-my-buyable-effect-not-work/1349>\
**Category:** Modding Developers\
**Created:** [January 13, 2024, 10:06pm UTC](https://forums.moddingtree.com/t/why-does-my-buyable-effect-not-work/1349 "2024-01-13T22:06:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhavir\_Gabriel](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/rhavir_gabriel/32/926_2.png) [@rhavir\_Gabriel](https://forums.moddingtree.com/u/rhavir_Gabriel)\
**Post date:** [January 13, 2024, 10:06pm UTC](https://forums.moddingtree.com/t/why-does-my-buyable-effect-not-work/1349/1 "2024-01-13T22:06:32Z")

</div>

buyables: {  
11: {  
title: “test”,  
unlocked() { return hasUpgrade(“N”, 21) },  
cost(x) {  
return new Decimal(2000).mul(Decimal.pow(2, x))  
},  
canAfford() {  
return player[this.layer].points.gte(this.cost())  
},  
buy() {  
let cost = new Decimal (1)  
player[this.layer].points = player[this.layer].points.sub(this.cost().mul(cost))  
setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1))  
},  
display() {  
return “Cost: " + format(tmp[this.layer].buyables[this.id].cost) + " points” + "  
Bought: " + getBuyableAmount(this.layer, this.id) + “  
Effect: Boost nice points gain by x” + format(buyableEffect(this.layer, this.id))  
},  
effect(x) { return new Decimal(1).add(x || getBuyableAmount(this.layer, this.id)).pow(398762)  
}

---

<div class="post-metadata">

**Author:** ![Acyth3](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/acyth3/32/849_2.png) [@Acyth3](https://forums.moddingtree.com/u/Acyth3)\
**Post date:** [January 31, 2024, 12:44am UTC](https://forums.moddingtree.com/t/why-does-my-buyable-effect-not-work/1349/2 "2024-01-31T00:44:33Z")

</div>

```
    11: {
        title: "Experiment Regime I",
        unlocked() { return hasUpgrade("mE", 11) },
        cost(x) {
            let exp1 = new Decimal(1.2)
            let exp2 = new Decimal (1.1005)
            let costdef = new Decimal(2)
            if (hasUpgrade('mE', 13)) exp1 = exp1.minus(0.05) // hell yea!
            if (hasMilestone('mE', 16)) exp2 = exp2.minus(0.015) // hell yea!
            if (getBuyableAmount(this.layer, this.id).gte(20)) exp2 = exp2.add(0.0245)
            return new Decimal(costdef).mul(Decimal.pow(exp1, x)).mul(Decimal.pow(x , Decimal.pow(exp2 , x))).div(buyableEffect("mE", 13)).floor()
        },
        display() {
            return "Cost: " + format(tmp[this.layer].buyables[this.id].cost) + " Meta-Experiments" + "<br>Bought: " + getBuyableAmount(this.layer, this.id) + "<br>Effect: Boost Meta-Crystal(s) gain by x" + format(buyableEffect(this.layer, this.id))
        },
        canAfford() {
            return player[this.layer].points.gte(this.cost())
        },
        buy() {
            let cost = new Decimal (1)
            player[this.layer].points = player[this.layer].points.sub(this.cost().mul(cost))
            setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1))
        },
        effect(x) {
            let base1 = new Decimal(1.46)
            let base2 = x
            let expo = new Decimal(1.012)
            if (hasUpgrade('mE', 12)) base1 = base1.add(0.12)
            if (hasUpgrade('mE', 14)) base1 = base1.add(0.15)
            if (hasUpgrade('mE', 32)) base1 = base1.add(0.35)
            if (hasMilestone('mE', 14)) base1 = base1.add(0.1)
            if (hasUpgrade('mF', 22)) base1 = base1.add(0.8)
            let eff = base1.pow(Decimal.pow(base2, expo)).times(buyableEffect('mE', 14).pow(0.2))
            if (hasUpgrade('mE', 35)) eff = eff.times(25)
            return eff
        },

```

},

Refer to this if your still confused

Note: wherever your trying to boost it, lets say gainMult; then you need to apply it like ;

if(getBuyableAmount(‘mE’, 11).gte(1)) mult = mult.times(buyableEffect(‘mE’,11)
