- Home /
Question is off-topic or not relevant
how dose this script look?
hey I made this javascript in unity for my game that is a online rpg I have three classes this is for my warrior class the other two will have the same stat names but will have different stats. So if someone can look this script over and tell me if I need to change a line or two?
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;
}
}
Way too many questions. Better of posting this in this in the forums : forum.unity3d.com
Before I realized you wanted turn-based, I wrote this :
Where did you see an RPG tutorial in JS ?! All I know of is BergZerg Arcade : http://www.youtube.com/playlist?list=PLE5C2870574BF4B06
http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html
This question shouldn't exist anymore. Someone with more karma should close it.
Follow this Question
Related Questions
rotation won't work someone please help? 0 Answers
Sstop the car on reaching finished line [Problem 0 Answers
A node in a childnode? 1 Answer
accessing a variable from one script in another with Unity 1 Answer
combat grid not working 2 Answers