Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Brennan · Aug 20, 2010 at 03:17 AM · javascriptlevelfreeexperience

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]; 
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brennan · Aug 20, 2010 at 05:09 AM 0
Share

i got this error when i saved the script

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

avatar image matyicsapo · Aug 20, 2010 at 09:33 AM 0
Share

yeah it's guiTextEXP.text not guiText

avatar image xToxicInferno · Aug 21, 2010 at 04:59 PM 0
Share

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

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

A node in a childnode? 1 Answer

Need help with a proficiency system(experience system) 1 Answer

Simple EXP Script In Javascript 0 Answers

Iphone Unity and Best book . 1 Answer

Unity webplayer crashing browser when it is loaded and unloaded into a page using JavaScript 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges