<spanclass="line"><spanstyle="color:#89DDFF;">}</span><spanstyle="color:#A6ACCD;">))</span><spanstyle="color:#89DDFF;">;</span></span></code></pre></div><p>In this case, <code>points</code> refers to <code>prestige.points</code>, as it's within the <code>prestige</code> layer.</p><h2id="create-a-reset-button"tabindex="-1">Create a reset button <aclass="header-anchor"href="#create-a-reset-button"aria-label="Permalink to "Create a reset button""></a></h2><p>Next, create a button that will perform the reset and generate points. Create a clickable like this:</p><divclass="language-ts"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">ts</span><preclass="shiki material-theme-palenight"><code><spanclass="line"><spanstyle="color:#C792EA;">const</span><spanstyle="color:#A6ACCD;"> convertButton </span><spanstyle="color:#89DDFF;">=</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#82AAFF;">createClickable</span><spanstyle="color:#A6ACCD;">(</span><spanstyle="color:#89DDFF;">()</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#C792EA;">=></span><spanstyle="color:#A6ACCD;"> (</span><spanstyle="color:#89DDFF;">{</span></span>
<spanclass="line"><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#82AAFF;">description</span><spanstyle="color:#89DDFF;">:</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#89DDFF;">()</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#C792EA;">=></span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#89DDFF;">`</span><spanstyle="color:#C3E88D;">Reset for </span><spanstyle="color:#89DDFF;">${</span><spanstyle="color:#82AAFF;">formatWhole</span><spanstyle="color:#A6ACCD;">(conversion</span><spanstyle="color:#89DDFF;">.</span><spanstyle="color:#A6ACCD;">currentGain)</span><spanstyle="color:#89DDFF;">}</span><spanstyle="color:#C3E88D;"> prestige points</span><spanstyle="color:#89DDFF;">`</span></span>
<spanclass="line"><spanstyle="color:#89DDFF;">}</span><spanstyle="color:#A6ACCD;">))</span><spanstyle="color:#89DDFF;">;</span></span></code></pre></div><p>This creates a simple clickable that can only be clicked when the player will gain some amount of the prestige currency, and it displays how much they'll get. This can be further improved by displaying how many points the player will need to generate one more prestige point.</p><h2id="resetting-previous-content"tabindex="-1">Resetting previous content <aclass="header-anchor"href="#resetting-previous-content"aria-label="Permalink to "Resetting previous content""></a></h2><p>Now, return to the <code>main</code> layer. Create a <code>reset</code> feature that receives a list of all the things it needs to reset - in this example, we'll just reset the entire layer:</p><divclass="language-ts"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">ts</span><preclass="shiki material-theme-palenight"><code><spanclass="line"><spanstyle="color:#C792EA;">const</span><spanstyle="color:#A6ACCD;"> reset </span><spanstyle="color:#89DDFF;">=</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#82AAFF;">createReset</span><spanstyle="color:#A6ACCD;">(</span><spanstyle="color:#89DDFF;">()</span><spanstyle="color:#A6ACCD;"></span><spanstyle="color:#C792EA;">=></span><spanstyle="color:#A6ACCD;"> (</span><spanstyle="color:#89DDFF;">{</span></span>
<spanclass="line"><spanstyle="color:#89DDFF;">}</span><spanstyle="color:#A6ACCD;">))</span><spanstyle="color:#89DDFF;">;</span></span></code></pre></div><p>Then, modify the convert button to trigger the reset:</p><divclass="language-ts"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">ts</span><preclass="shiki material-theme-palenight"><code><spanclass="line"><spanstyle="color:#82AAFF;">onClick</span><spanstyle="color:#A6ACCD;">() </span><spanstyle="color:#89DDFF;">{</span></span>
<spanclass="line"><spanstyle="color:#89DDFF;">}</span></span></code></pre></div><p>If you have multiple tiers of resets, you may add an <code>onReset</code> function to each reset that triggers the next reset before it, causing the resets to cascade.</p><h2id="branching-resets"tabindex="-1">Branching resets <aclass="header-anchor"href="#branching-resets"aria-label="Permalink to "Branching resets""></a></h2><p>A common pattern for reset mechanics is to display these various layers in a tree and have the tree propagate the resets for you. There are a couple of utility functions to help you accomplish this: <ahref="./../../api/modules/data/common#createresetbutton">createResetButton</a> and <ahref="./../../api/modules/data/common#createlayertreenode">createLayerTreeNode</a>. You'll typically place the tree itself in the <code>main</code> layer and create a tree node for each layer. Then you can call the tree's <code>reset</code> function with the layer that's resetting, and it will propagate the reset as appropriate.</p></div></div></main><footerclass="VPDocFooter"data-v-c4b0d3cfdata-v-face870a><!--[--><!--]--><divclass="edit-info"data-v-face870a><divclass="edit-link"data-v-face870a><aclass="VPLink link edit-link-button"href="https://github.com/profectus-engine/profectus-docs/edit/main/docs/guide/recipes/prestige.md"target="_blank"rel="noreferrer"data-v-face870adata-v-8f4dc553><!--[--><svgxmlns="http://www.w3.org/2000/svg"viewbox="0 0 24 24"class="edit-link-icon"aria-label="edit icon"data-v-face870a><pathd="M18,23H4c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h7c0.6,0,1,0.4,1,1s-0.4,1-1,1H4C3.4,5,3,5.4,3,6v14c0,0.6,0.4,1,1,1h14c0.6,0,1-0.4,1-1v-7c0-0.6,0.4-1,1-1s1,0.4,1,1v7C21,21.7,19.7,23,18,23z"></path><pathd="M8,17c-0.3,0-0.5-0.1-0.7-0.3C7,16.5,6.9,16.1,7,15.8l1-4c0-0.2,0.1-0.3,0.3-0.5l9.5-9.5c1.2-1.2,3.2-1.2,4.4,0c1.2,1.2,1.2,3.2,0,4.4l-9.5,9.5c-0.1,0.1-0.3,0.2-0.5,0.3l-4,1C8.2,17,8.1,17,8,17zM9.9,12.5l-0.5,2.1l2.1-0.5l9.3-9.3c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.2-0.4-1.6,0l0,0L9.9,12.5z M18.5,2.5L18.5,2.5L18.5,2.5z"></path></svg> Edit this page<!--]--><!----></a></div><divclass="last-updated"data-v-face870a><pclass="VPLastUpdated"data-v-face870adata-v-7b3ebfe1>Last updated: <timedatetime="2023-05-17T05:54:05.000Z"data-v-7b3ebfe1></time></p></div></div><divclass="prev-next"data-v-face870a><divclass="pager"data-v-face870a><aclass="pager-link prev"href="/guide/important-concepts/formulas"data-v-face870a><spanclass="desc"data-v-face870a>Previous page</span><spanclass="title"data-v-face870a>Formulas</span></a></div><divclass="has-prev pager"data-v-face870a><aclass="pager-link next"href="/guide/recipes/save-progress"data-v-face870a><spanclass="desc"data-v-face870a>Next page</span><spanclass="title"data-v-face870a>Display Save Progress</span></a></div></div></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>