warrior basestats unity javascript

hey everyone I am making an morpg and was wondering If my Warrior basestats is good or
if I need to improve it. This is one of my classes in my game. I have two more with the same stat
names so here is my code:

var name : String;
var level : int;
var curExp : int;
var maxExp : int;
var buff : int;




var health : int;
var energy : int;

var might : int;
var defense : int;
var magic : int;
var luck : int;




function Update() {
	
	
	BaseStats();
	Vitals();
	AddEXP();
	LevelUp();

}
// These are his stats for the game
function BaseStats()
{
	level = 1;
	curExp = 0;
	maxExp = 100;
	buff = 0;

	might = 75;
	defense = 80;
	magic = 25;
	luck = 41;

	
}

// These are his Vitals
function Vitals()
{
	health = 100;
	energy = 100;

}
// exp to add to this class 
function AddEXP()
{
	var exp : int = 1;
	curExp += exp;

}

// to level up the player
function LevelUp()
{
	if(curExp >= maxExp)
	{
		level++;
		maxExp += 10;
		
		might += 4;
		defense += 5;
		magic += 2;
		luck += 2;
		
		curExp = 0;
	
	}

}

so look it over and tell me if this good or if I need to add some thing.this also has no errors to it.

anyone can help and tell me if this is good or not.

i think its cool!

so I don’t need to add nothing

Looks good to me, only suggestions I have are nitpicking but I’ll share them anyway.

Vitals() could be SetVitals() ? That is a bit more descriptive.

function AddEXP()
{
    var exp : int = 1;
    curExp += exp;
}

Could be:

function AddEXP(exp)
{
    curExp += exp;
}

Allow you to specify the amount of exp set when calling the function. I could be wrong on how the variable is passed here, I don’t know Javascript. :face_with_spiral_eyes:

Good luck!

Thanks for the tip. Now I am having trouble with my Character Generator I want to get my warrior stats class and enter a name
in the GUI.TextField but I get errors when I put char1.name?
this is what I put to get the warrior stats script:

this line is what is giving me problums:

var Char1 : Warrior;

Char1 = GetComponent(Warrior);

Char1 = GUI.TextField(Rect(360,2,100,25),String.Empty);

What I am trying to do is enter a name in the text field but some how I can’t enter a name when I hit play?