i need help on my script i get 3 errors. one is
-player health.js(78,1): BCE0043: Unexpected token: yield.
-player health.js(78,6): UCE0001: ‘;’ expected. Insert a semicolon at the end.
-player health.js(90,1): BCE0044: expecting EOF, found ‘}’.
i can’t get rid of it here is my scripts:
var curHealth : int = 100;
var maxHealth : int = 100;
var healthtext : GUIText;
var curXp : int = 0;
var maxXp : int = 500;
var xptext : GUIText;
var level : int = 1;
function Start ()
{
healthRegen();
}
function Update ()
{
healthtext.text = curHealth + " / " + maxHealth;
xptext.text = "Level" + level + "XP" + curXp + " / " + maxXp;
if(curXp == maxXp)
{
levelUpSystem();
}
if(curHealth < 0 )
{
curHealth = 0;
}
if(curHealth > maxHealth)
{
curHealth = maxHealth;
}
if(Input.GetKeyDown("e"))
{
curHealth -= 10;
}
if(Input.GetKeyDown("r"))
{
curXp += 10;
}
}
function healthRegen ()
{
for(i=1;i>0;i++);
{
yield WaitForSeconds(0.5);
if(curHealth < maxHealth)
{
curHealth++;
}
}
}
function levelUpSystem ()
{
curXp = 0;
maxXp = maxXp +50;
level ++;
maxHealth += 100;
}
not that any of us could tell with that formatting, but you're missing a or have too many { or } or ; somewhere before the first line it's complaining about.
– LoiusNext time you post code, could you please use the code formatting button on it, it makes the code much easier to read.
– randomuseroh my god juste repair my error thanks
– seb-lopez