Hi i’m kinda new to scripting and i cant get this script to work correctly when i click r i dont gain any XP when i have that implemented though if someone could PLEASE go through the script and tell me wat i did wrong and maybe upload the correct version of the script! Thanksin advance for your help! (and if you find any other problems please comment them below!)
//XP You’ll start out with!
var curXP : int = 0;
//XP Untill next LVL Up!
var maxXP : int = 100;
//LVL To start out with!
var curLVL : int = 0;
//LVL Untill prestiging!
var maxLVL : int = 10;
//Prestige To start out with!
var curPrestige : int = 0;
//Max prestige (maxLVL + maxPrestige = HIGHEST LEVEL POSSIBLE!)
var maxPrestige : int = 5;
//The text type of game object you will need to add in the game!
var lvlText: GUIText;
function Update () {
lvlText.text = " Level " + curLVL + " MaxLevel " + maxLVL + " XP " + curXP + " XPUntillNextLevel " + maxXP;
if (curXP == maxXP) {
levelup ();
}
if (curLVL == maxLVL) {
prestige ();
}
}
if(Input.GetKeyDown(" r ")) {
curXP += 10;
}
function levelup () {
curXP = 0;
maxXP = maxXP + 100;
curLVL ++;
}
function prestige () {
if (Input.GetKeyDown(" + ")) {
curLVL = 1;
curPrestige = 1;
curXP = 0;
}
}