Hey guys, i’m trying and searching for more then a week to solve this problem. I simply can’t make my item affect my player. I’m using 1 script to the item and 1 to the stats of the player. But i can’t make it work. In this example i’m trying to use a painkiller, the Painkiller is tagged as Painkiller and it need to increae my health. These are the 2 scripts i’m working with:
Script in the playerstats:
/* Using the painkiller */
var painkillerhealth : boolean = false;
var painkillercur = 300;
function usepainkiller ()
{
if (painkillerhealth == true)
{
Health += painkillercur;
}
}
Script in the inventory:
private var painkilleritem : PlayerStatsV2; //playerstatsv2 is the name of my player stats script.
[...]
function Start()
{
painkilleritem = GameObject.Find("Player").GetComponent(PlayerStatsV2);
}
[...]
function UseEffect ()
{
if ( gameObject.tag == "Painkiller")
{
painkilleritem.painkillerhealth = true;
}
}
Can anyone please help me?? This is what i need to do so i can finally finish my game! =D