Injury System

DoctorCry

New member
Hello! New to Opsive but I have taken a look around and cant seem to find a way to get my injury system up and running. I have animated and created the animation layers to reference and created my object that will be dynamically changing colors depending on the HP value of the character. What would be the most efficient way to reference the health attribute set up by Opsive in a custom script attached to the player character?
 
Last edited:
Take a look at the AttributeMonitor. It is informed through events about attribute changes:
Code:
EventHandler.RegisterEvent<Attribute>(m_AttributeManager.gameObject, "OnAttributeUpdateValue", OnUpdateValue);
 
Take a look at the AttributeMonitor. It is informed through events about attribute changes:
Code:
EventHandler.RegisterEvent<Attribute>(m_AttributeManager.gameObject, "OnAttributeUpdateValue", OnUpdateValue);
I took a crack at it over the past couple of days and could never understand how to reference the health attribute in a separate script. I attached what I am trying to do in a script example. Instead of explicitly declaring the health values and using TextMesh as an example UI element I am trying to use Opsive's built in health system to update the animator to use the injured animations. I am having a tough time understanding how to update the health attribute properly in my example code.
 

Attachments

  • InjureScript.cs
    1.8 KB · Views: 3
In the API section you find an example of how to reference the health:

UCC uses animator parameters to control the animations. You might consider using a blend tree and parameters for your approach as well.
 
Sorry for my ignorance but I still have not been able to get this to work. I wrote an example of what I'm encountering:
1650580518849.png
Error:
1650580537995.png
 
You named your AttributeManager variable "injuryCheck", but in line 19 you try to access it through "m_AttributeManager".
 
Top