Armour

Hi again .
So armor thing , problem.I have health script which contains (health and armour variables).So i wanted like when damage is taken
if armour <0 {health -=50}.And if if armour >0 {armour -= 50}.
But how can i do that with from other script
Here’s what i have

Pick up and Mine damage

var script : Health;

function OnTriggerEnter(hit : Collider)
    {   
        if(hit.gameObject.tag == "HealthUP")
        {   
		script = GetComponent("Health");
		script.healt += 55;
            Debug.Log("You picked up the key!");
            Destroy(hit.gameObject);
			}
		if(hit.gameObject.tag == "ArmourUP")
        {   
		script = GetComponent("Health");
		
		script.if(armor<0)
		{
		healt -=50;
		}
		script.if(armor>0)
		{
		armor -=50;
		}
            Debug.Log("You picked up the key!");
            Destroy(hit.gameObject);
			
			
			
}
}

how can i get it to decrease value from Health script.I get some error with

Any help or tips.

-3DK

‘if’ is not a component from the script Health.
You probably want to do something like this(if armor health are variables from the script Health):

if(script.armor <= 0)
{
    script.health -= 50;
}
else if(script.armor > 0)
{
    script.armor -= 50;
}

Thank you Falin this is what i needed.

No Problem, glad that I was able to help. :slight_smile: