x


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]; 
}
more ▼

asked Aug 20 '10 at 03:17 AM

Brennan gravatar image

Brennan
62 14 16 21

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Aug 20 '10 at 03:28 AM

xToxicInferno gravatar image

xToxicInferno
485 24 28 41

i got this error when i saved the script

Assets/Scripts/Experience System.js(10,1): BCE0053: Property 'UnityEngine.Component.guiText' is read only.

Aug 20 '10 at 05:09 AM Brennan

yeah it's guiTextEXP.text not guiText

Aug 20 '10 at 09:33 AM matyicsapo

Ah, sorry, i wrote this with out testing as i had no way to test it aside from making a entire exp system...sorry.

Aug 21 '10 at 04:59 PM xToxicInferno
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3740
x3461
x322
x162
x22

asked: Aug 20 '10 at 03:17 AM

Seen: 1307 times

Last Updated: Jun 05 '12 at 03:03 AM