- Home /
Experience System
i wanted to ask the people of unityAnswers if they could answer my question... i wanted to make a gui text where when it get to a certain number other numbers change it... (i know not that descriptive...) basically i wanted them to start out there experience like this... 1/1000 | 1 after you got to 1000 it would change to this 1000/2000 | 2 i hope you understand where im getting at (1 is current experience 1000 is the goal and | 1 is the level...) Please consider in helping me...
EDIT:
i just need help with this last thing.... i dont know much about javascript but someone help me with this
var yourGUITextVariable;
var accumulatedExperiencePoints;
var levelExpRequirements;
var currentLevel;
function Update(){
yourGUITextVariable.text = accumulatedExperiencePoints + "/"
+levelExpRequirements[currentLevel+1];
}
Answer by xToxicInferno · Aug 20, 2010 at 03:28 AM
I am assuming you want something like this:
var guiTextEXP : GUIText; var accumulatedExperiencePoints : int = 0; var levelExpRequirements : int = 1000; var currentLevel : int = 1;
function Update () { if(accumulatedExperiencePoints >= levelExpRequirements) { levelExpRequirements += 1000; currentLevel += 1; } guiTextEXP.guiText = accumulatedExperiencePoints+"/" + levelExpRequirements + "|" + currentLevel; }
That should work pretty good for you, if not leave me a comment and i, or someone more experienced can help you out.
i got this error when i saved the script
Assets/Scripts/Experience System.js(10,1): BCE0053: Property 'UnityEngine.Component.guiText' is read only.
Ah, sorry, i wrote this with out testing as i had no way to test it aside from making a entire exp system...sorry.