- Home /
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.
"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.
"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.
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 ;)
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.
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. $$anonymous$$eep up the good work
Answer by Aydan · Apr 25, 2011 at 06:25 AM
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); }
Answer by rangeray · Oct 20, 2013 at 08:20 PM
What about to program they enemy so it gives you xp too.
Answer by RealSoftGames · Sep 22, 2014 at 12:41 PM
i was thinking about using something with the Tags set to Enemies?