# How to make a layer boost things

**URL:** <https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202>\
**Category:** Modding Developers\
**Created:** [August 20, 2021, 2:31pm UTC](https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202 "2021-08-20T14:31:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gapples2](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/gapples2/32/15_2.png) [@gapples2](https://forums.moddingtree.com/u/gapples2)\
**Post date:** [August 20, 2021, 2:31pm UTC](https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202/1 "2021-08-20T14:31:10Z")

</div>

## Making the effect
You should already have a layer, if you don't then make one. Add an effect() function to your layer. It should look like this:

```javascript
effect(){

},

```

You’ll have to return a Decimal in the effect function. If you want to make an effect like boosters in PT you do:

```javascript
effect(){
  return Decimal.pow(2, player[this.layer].points)
  /*
    you should use this.layer instead of <layerID>
    Decimal.pow(num1, num2) is an easier way to do
    num1.pow(num2)
  */
},

```

If you want +1x point gain per layer point do:

```javascript
effect(){
  return player[this.layer].points
  // you can also add .times(multiplier) on to it
},

```

You can also use exponents/logarithm.

```javascript
effect(){
  return player[this.layer].points.max(1).pow(5).log10().max(1)
},

```

## Implementing the effect
If you want the effect to multiply point gain then you need to add something on to getPointGen() like this:

```javascript
function getPointGen() {
  if(!canGenPoints())return new Decimal(0)

  let gain = new Decimal(1)

  ...

  gain = gain.times(tmp.<layer>.effect)
  /*
    whenever you need to use an effect, use tmp not layers
    this would multiply gain by the effect
    but you can use any math thing
  */
  return gain
}

```

Multiplying another layer’s gain is also simple.

```javascript
gainMult(){
  let mult = new Decimal(1)

  ...

  mult = mult.times(tmp.<layer>.effect)
  /*
    if it's a static layer you need to divide
    (replace .times with .div)
  */
  return mult
}

```

## Making the description
Everything has been implemented but the player can't see the effect. You need to add another function into the layer.

```javascript
effectDescription(){

},

```

That’s where you put what the effect does.  
If you do this:

```javascript
effectDescription(){
  return "multiplying point gain by " + format(tmp[this.layer].effect)
  /*
    use format(num) whenever displaying a number
  */
},

```

It will display this: “You have layerAmt layerName, multiplying point gain by layerEffect”  
Once you do that, you’ll have a working layer effect the player can see!

---

<div class="post-metadata">

**Author:** ![thepaperpilot](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/thepaperpilot/32/74_2.png) [@thepaperpilot](https://forums.moddingtree.com/u/thepaperpilot)\
**Post date:** [August 20, 2021, 2:46pm UTC](https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202/2 "2021-08-20T14:46:14Z")

</div>

> [@gapples2](#):
>
> ```auto
> /*
> if it's a static layer you need to divide
> (replace .times with .div)
> */
> 
> ```

Gosh it still bugs me that the static gain formula works this way 😠

---

<div class="post-metadata">

**Author:** ![Jakub](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/jakub/32/266_2.png) [@Jakub](https://forums.moddingtree.com/u/Jakub)\
**Post date:** [September 12, 2022, 7:31pm UTC](https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202/3 "2022-09-12T19:31:38Z")

</div>

Fixed the part showing that you can use exponents or logarithms

---

<div class="post-metadata">

**Author:** ![thepaperpilot](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/thepaperpilot/32/74_2.png) [@thepaperpilot](https://forums.moddingtree.com/u/thepaperpilot)\
**Post date:** [September 13, 2022, 12:22am UTC](https://forums.moddingtree.com/t/how-to-make-a-layer-boost-things/202/4 "2022-09-13T00:22:36Z")

</div>

good catch!
