using System.Collections;PS : my script isn't finished i can end it myself but i can't find a way to get this status value :D
using System.Collections.Generic;
using UnityEngine;
using ORKFramework;
using ORKFramework.Behaviours;
public class ORKFallDamage : MonoBehaviour {
public int health;
public float lastPosition;
public float fallDistance;
public GameObject player;
private CharacterController controller;
// Use this for initialization
void Start () {
controller = gameObject.GetComponent ();
player = GameObject.Find("Player(Clone)");
Combatant combatant=ComponentHelper.GetCombatant(player);
Debug.Log (combatant.Status [1]);
health =combatant.Status[1];
}
// Update is called once per frame
void Update () {
if (lastPosition > gameObject.transform.position.y) {
fallDistance = +lastPosition - gameObject.transform.position.y;
}
lastPosition = gameObject.transform.position.y;
if (fallDistance >= 5f && controller.isGrounded) {
}
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!
E.g.: if you want to get the current value of the stat:
health = combatant.Status[1].GetValue();
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
health -=1
it doesn't change the status value sorry i don't really understand, to make it faster how could i just sub 1 hp when my player takes fall damage i'm stuck : my fall damage script :void Update () {
health = _combatant.Status [1].GetValue ();
if (lastPosition > gameObject.transform.position.y) {
fallDistance +=lastPosition - gameObject.transform.position.y;
}
lastPosition = gameObject.transform.position.y;
if (fallDistance > 5 && controller.isGrounded) {
Debug.Log("On se prend un poitn de degat");
//health = _combatant.Status [1].GetValue ();
health -= 1;
ResetSystem ();
}
if (fallDistance < 3 && controller.isGrounded) {
Debug.Log ("Chute non létale");
ResetSystem ();
}
if (fallDistance > 15 && controller.isGrounded) {
Debug.Log ("On est sensé mourrir");
//health = _combatant.Status [1].GetValue ();
health -= instantDeathVal;
ResetSystem ();
So the variable health contains the value type retrieved by Status.GetValue().
To change its value via script, you need to use Status.SerValue(newValue).