x


How to create a Expierence system for every kill

THE LEVELING UP SCRIPT HAS BEEN RECIEVED THANKS TO JOSHUA NO NEED FOR THE LEVELING UP SCRIPT NOW I JUST NEED A SCRIPT FOR RECIEVING THE EXP POINTS THANK YOU.

Well i want to make a experience bar system in unity3d. I went through and found some answers but they didnt help me much. So want to make it so that Everytime you kill someone you get 5 experience out of 50 at level 1. Then when you level up your going to need more then 50 experience. You will need 100 at level 2. Then level 3 you need 100. So you need to just double everytime you level up. and one you see your profile it shows a special texture like for a level 1 there is a Red dot and level 2 there are 2 red dots and at level 3 there are 3 red dots then level 4 it changes from dots to stars and so on. Oh and if you complete challanges your get like a extra 50 experience points and so on. So is there any way to do this. Just give me a full script and under it tell me what to do to use and if you want explain on how they work.

Well i have tried and here is my code for holding expierence points. Change it as much as you want.

var exp = 1;
var expneeded : int = 50;
var level : int = 1;
var level1symbol : GUITexture;
var level2symbol : GUITexture;
var level3symbol : GUITexture;
var level4symbol : GUITexture;
var level5symbol : GUITexture;
var level6symbol : GUITexture;
var level7symbol : GUITexture;
var level8symbol : GUITexture;
var level9symbol : GUITexture;
var level10symbol : GUITexture;


function Update ()
{
    if ( level = 1)
    {
        var expneeded = 50;
        level1symbol.mesh = true;
        level2symbol.mesh = false;
        level3symbol.mesh = false;
        level4symbol.mesh = false;
        level5symbol.mesh = false;
        level6symbol.mesh = false;
        level6symbol.mesh = false;
        level7symbol.mesh = false;
        level8symbol.mesh = false;
        level9symbol.mesh = false;
        level10symbol.mesh = false;
    }
    else ( level = 2 )
    {
        level1symbol.mesh = false;
        level2symbol.mesh = true;
        level3symbol.mesh = false;
        level4symbol.mesh = false;
        level5symbol.mesh = false;
        level6symbol.mesh = false;
        level6symbol.mesh = false;
        level7symbol.mesh = false;
        level8symbol.mesh = false;
        level9symbol.mesh = false;
        level10symbol.mesh = false;
    }
}

Well is keeps going with the else if ( level = . )

Thank you.

more ▼

asked Apr 25 '11 at 04:19 AM

Kashaunzilla gravatar image

Kashaunzilla
34 17 19 28

"Just give me a full script and under it tell me what to do to use[...]" this sentence made me turn away. That, and the code doesn't look like a very sincere try, but I don't want to judge skill, only ethic.

Apr 25 '11 at 04:30 AM by0log1c

"Just give me a full script" no one is going to do that.. try it yourself and if you have a specific question I'd love to help.

Apr 25 '11 at 04:31 AM Joshua

Haha, posted while I was still typing, BY0 :p. Also, in your if( level = 1) statement you should write level == 1 and in your else statement you should say else if ;)

Apr 25 '11 at 04:32 AM Joshua

Hey thanks dude i will try it, and i forgot to add the double ='s it was late and i needed some rest so i was rushing and also forgot to put the if statement in it too. So i am going to try it, thanks man.

Apr 25 '11 at 08:35 PM Kashaunzilla

There have been no errors now then Joshua can you help me withing recieving the exp points from when the enemy dies. If ou know of the character damage script from fps tutorial from unity3d i would like it to be eddited from there please. Thanks dude, saw some of your badges and dude thats great, you got like 7 badges i have 3 or 4. Keep up the good work

Apr 25 '11 at 08:54 PM Kashaunzilla
(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

This should get you started

var exp = 0;
var expNeeded = 50;
var level = 1;
var currentLevelSymbol : Texture;
var level1symbol : Texture;
var level2symbol : Texture;
var level3symbol : Texture;
var level4symbol : Texture;
var level5symbol : Texture;

function Start(){
    expNeeded = 50;
}

function Update (){
    AddjustCurrentExp(0);

    if(exp >= expNeeded){
        exp = 0;
        level += 1;
    }

    if(level >= 1){
        currentLevelSymbol = level1symbol;
        expNeeded = 50;
    }
    if(level == 2){
        currentLevelSymbol = level2symbol;
        expNeeded *= 2;
    }
    if(level == 3){
        currentLevelSymbol = level3symbol;
        expNeeded *= 2;
    }
    if(level == 4){
        currentLevelSymbol = level4symbol;
        expNeeded *= 2;
    }
    if(level == 5){
        currentLevelSymbol = level5symbol;
        expNeeded *= 2;
    }
}

function AddjustCurrentExp(adj) {
    exp += adj;
}

function OnGUI(){
    GUI.DrawTexture(Rect(10,10,30,30), currentLevelSymbol, ScaleMode.ScaleToFit, true);
}
more ▼

answered Apr 25 '11 at 06:25 AM

Aydan gravatar image

Aydan
180 29 37 47

(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:

x64
x22
x7
x2

asked: Apr 25 '11 at 04:19 AM

Seen: 1505 times

Last Updated: Apr 25 '11 at 08:50 PM