Hello,
As the title suggests, I'm trying to write some code to get a combatant's selected defence subattribute. It's for a HUD to show HP, etc.

Looking at the ORK source code I've been able to get a combatant's defence attribute and what appears to be the list of subattributes, but I cannot figure out how to find the subattribute I set in the ORK Framework.

var defAttr = combatant.Status.GetDefenceAttribute(0).BaseAttribute;
Debug.Log($"{combatant.GetName()} Defence Attr {defAttr.GetName()}");

var defSubAttr = defAttr.attribute[1];
Debug.Log($"Sub Attr {defSubAttr.GetName()}");


Here's an example of how the Defence Attribute is set for a combatant:
image

Thanks for your help
  • The GetDefenceAttributeID function gives you the current defence attribute of the combatant:
    DefAttrID defID = combatant.Status.GetDefenceAttributeID(index)
    DefenceAttributeSetting defenceAttribute = ORK.DefenceAttributes.Get(defID.RealID);
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks, unfortunately it's still unclear to me how I'm able to access the selected subattribute from the DefenceAttributeSetting. Given the screenshot above, I want to be able to log "Fire" or whatever the selected element is for that combatant. Appreciate the help.
  • Ah, sorry, forgot that part:
    DefAttrID defID = combatant.Status.GetDefenceAttributeID(index)
    DefenceAttributeSetting defenceAttribute = ORK.DefenceAttributes.Get(defID.RealID);
    DefenceSubAttribute subAttribute = defenceAttribute.attribute[defID.GetID()];
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • That worked, thanks a bunch!
Sign In or Register to comment.