Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
HashinBrowns

XP Issues, Simple Problem

Question

Hey guys, I dont have much time to type at the moment so no time for formalities. As of right now this function in my script is not working an I'm not quite sure if it is actually created wrong or if something else in the entire script is causing it not to work.  The script adds the xp just fine but it never actually levels up for some reason.

Please login or register to see this code.

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts


  • 0

Like TheMars said, you'll need to add xp. All you'll have to do is add a parameter to your function and say xpCount += myParameter

Share this post


Link to post
Share on other sites
  • 0

I have that, when my object explodes, the xp is added according. Even the xp GUI updates but for some reason the level never does anything. I have a GetComponent in my explosion of my prefab script that looks like this.

Please login or register to see this code.

Share this post


Link to post
Share on other sites
  • 0

Everything else works perfectly though, I don't think I need to call the function because that method works perfectly fine for my xp, it just doesn't level up. I am calling the variables, to add everything when the object explodes. The function blows stuff up so it wouldn't go anywhere anyways, it has to be on the enemy prefab.

Share this post


Link to post
Share on other sites
  • 0

What TheMars is trying to say is the level up function has to be called. Yes the explode function is called but the level up function never does. Change function name to AddExperience instead of LevelUp and add a parameter to call how much xp is given. Then change levelMaster.xpCount += myXpValue; to levelMaster.AddExperience(myXpValue); then at the beginning of the add experience function, xpCount += myParameter; then the rest of the code you had in there prior

Share this post


Link to post
Share on other sites
  • 0

Everything else works perfectly though, I don't think I need to call the function because that method works perfectly fine for my xp, it just doesn't level up. I am calling the variables, to add everything when the object explodes. The function blows stuff up so it wouldn't go anywhere anyways, it has to be on the enemy prefab.

Share this post


Link to post
Share on other sites
  • 0

My internet keeps going out and posting responses late, I tried to post that before you and ocular posted the two statements that I saw afterwards. It wasn't clear that you wanted me to call the function LevelUp(), I was thinking you meant the Explode function earlier but now I understand. Also I tried that and it worked so thanks, sorry for the misunderstanding. I'm not at home right now and the connection is really bad so my post timer is off and I can't see your posts until the internet comes back up too.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...