I’m creating an “RPG” project and i created this script but it doesn’t work i got this error:
ArgumentOutOfRangeException: index is less than 0 or more than or equals to the list count.
The script:
#pragma strict
function Start () {
var Tom : Personnage = new Personnage();
}
class Character
{
var ID : Array = new Array("Human","20","false");
function Start (){
if(ID[2] == "false"){
ID.Push("welcome.");
}else{
ID.Push("you're not allowed to enter HERE GET OUT!!!");
}
}
function Character (){
Debug.Log("You are an " + ID[0] + " you have " + ID[1] + " of health " + ID[3]);
}
}
HELP!