How to Create a Leveling System

by jamescoker1226

<< All Articles | Print

Introduction: Creating a Leveling System​

In the past, I have had several people ask how to make a leveling system in their story-games. What is that, you may ask? It is a system whereby a player of a story-game can earn experience points and, upon the accumulation of a certain number of experience points, earn stat points that can be used to increase certain attributes. Needless to say, it's something that can only be done in the advanced editor with advanced scripting enabled. Regardless, a good leveling system can greatly increase the replayability and general appeal of your story-games. A leveling system is made of three parts:

  1. An EXP System
  2. A "Level Up" Page
  3. A "Level Up" Item

1. Creating an EXP System

An EXP system is the essence of a leveling system. It records the experience points you award to the player for certain tasks, like defeating an enemy or solving a complex puzzle. Then, it compares the number of experience points the player has accumulated to the number needed to level up. When the number of experience points a player has meets or exceeds the number of points needed to level up, the player is awarded stat points that can be used to increase the attributes of the character.

At the core of an EXP system are two variables: one to represent the experience the character already has and one to represent the number of experience points needed to reach the next level. For simplicity, I will refer to the former variable as EXP and the latter as MAXEXP. When you create the MAXEXP variable, set it to the value you think the player should acheive before leveling up. Any time you award the player EXP points, you need to insert something into the script that will evaluate if EXP meets or exceeds MAXEXP. Take the code below as an example:

%EXP := %EXP + 25
%STAT := %STAT + 2

This block of code does several things. It awards the player 25 EXP points, then checks to see if EXP exceeds MAXEXP. If EXP is greater than MAXEXP, MAXEXP is subtracted from EXP. This ensures that EXP in excess of MAXEXP is not lost. Next, MAXEXP is increased by 15, so that it will be slightly harder to achieve the next level. Also, two stat points are added. These come into play when creating the "Level Up" page.

2. Creating a "Level Up" Page

In order to utilize the leveling system, you need a page where the player can spend stat points to level up their character. Create a page and name it "Level Up". Now, the links are the most important components of this page. For each attribute you wish to let the player increase, you will need to create a link that leads back to the "Level Up" page. It is best to name these links "Increase (Attribute Name) by 1". Create also a link that leads to the page the player was on before the "Level Up" page. Sometimes, the fact that the leveling system requires the player to link to the "Level Up" page several times makes it impossible to just use the "Previous Page" destination in the link. The article below provides a means to tackle that issue, though:

Random Encounters/Events: A Scripting Scenario

For each of the attribute links, create a restriction that only allows them to be selected if the player has at least one STAT point. Next, using the links' scripts or the blue plus/minus button, add 1 to the value of the respective attribute and remove one from the STAT variable. Do this for all of the attribute links. While the attribute and "Go Back" links are really all that is needed of a "Level Up" page, it may help to use Berka's on-page variable display tips in order to show the player the current values of the attributes they are changing.

On-page Variable Tricks

Really, the "Level Up" page shouldn't be more than a brief display of the character's attributes and the links. It doesn't hurt to add a little flavoring text to enhance immersion, though. For example:

As you pull the enchanter's scroll out of your satchel, you can feel it probing into your very being. You shudder to think that a mere piece of parchment can see your innermost strengths and weaknesses, quantify, and bend them. Reading the scroll, you see:

  • Strength: %%STR%%
  • Intelligence: %%INT%%
  • Dexterity: %%DEX%%
  • Agility: %%AGI%%
  • Endurance: %%END%%

Seeing the very makings of your being spelled out almost terrifies you, but the scroll beckons to you. It wants to know, what do you wish to change?

There you have it. Still, the "Level Up" page isn't any use without a way to reach it.

3. Creating a "Level Up" Item

In order for the player to access the "Level Up" page, you need to provide them with an item, or a link on every page. Needless to say, most people, authors and players alike, would prefer to use an item. Go to your "Items" page and create an item called "Level Up". Set the default effect for the item as the page "Level Up". This means that the item will always take the player to the "Level Up" page when used. You can set the page on which the item will appear, but there is a better way.

While you can have your item appear on a certain page and remain with the character throughout the game, this causes unnecessary clutter in the player's inventory. By inserting a few blocks of code into the global script, however, you can make it so that the level up item only appears in the player's inventory when they have one or more STAT points. An example:



Now, be sure that you use the correct ID number of your "Level Up" item in the script.


This article is by no means a complete guide to creating leveling systems. There are many different ways to create a leveling system, and I encourage you to explore different methods and always strive to create something original. Still, I hope that I have provided you with some valuable insights that will, at the least, inspire you to become better acquainted with the nuances of the advanced editor.