i will detail the error at the bottom, here is the code, the weird language is just my comments in norwegian:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// serializable er for at vi skal kunne bruke dette i andre scripts denne classen lar oss definere stats
[System.Serializable]
public class stats
{
[SerializeField]
private int baseValue;
public int GetValue()
{
return baseValue;
}
}
using UnityEngine;
public class playerStats : MonoBehaviour
{
//health staten og currenthealth for å gjøre så vi kan miste liv
// get private set er for at man ikke kan modifie den fra et annet script
if (currentHealth <= 0)
{
Die();
}
}
public virtual void Die ()
{
//somehow die
//er her bare for å fjerne en error
Debug.Log(transform.name + “died”);
}
}
the error i get is cannot easily convert type stat to int, the thing is tho damage and armor are stats that can be converted to int, and works with the calculation. if i change currenthealth to stats then suddenly i get the error that currenthealth cant be converted to int and therefore cant be used in math with damage and armor but those are also stats, no matter what i do this makes no sense.
you probably need to make the base value public instead of private
anyway you will get a lot less headache if you just delete the stats stuff and make everything int, unless you will develop the stats class in the future what you have now is pretty pointless