I’m kinda new at this stuff. I thought scripting would be like HTML or something… Anyways, I’m trying to make a simple RPG. To keep from starving, the player must survive on coconuts because I’m too lazy to make other foods. I keep getting the above error… Here’s what I got:
#pragma strict
var Vigor : float = 100.0;
var Satiation : float = 100.0;
function Start () {
}
function Update () {
Satiation -= Time.deltaTime/8;
if(Satiation <= 25){
Vigor -= 0.25;
if(Vigor <= 0){
print ("You Failed.");
}
Vigor = Mathf.Clamp(Vigor, 0.0, 100.0);
Satiation = Mathf.Clamp(Satiation, 0.0, 100.0);
}}
function OnTriggerEnter (other : Collider){
if(other-gameObject.name == ("CoconutCol")&& Satiation <= 90.0){
Vigor += 10;
Destroy (other-gameObject.transform.parent.gameObject);
}
}