edited March 2020 in ORK Scripting
Hi,
How can I get the item requirements in script?
when a combatant can't use the item, I want to show which requirements don't match.
I got into this but I can't get any further.
public static void LearnBook(ItemShortcut bookShortcut, Combatant user){
StatusRequirement[] requirements = bookShortcut.Setting.requirement.req;
for(int i = 0; i < requirements.Length; i++){
StatusRequirement req = requirements[i];
StatusRequirementSelection s = req.status;

string useCostText = bookShortcut.GetUseCostText(user);

Debug.Log("type: " + s.type);
Debug.Log("check:" + req.CheckRequirement(user));
Debug.Log("useCostText: " + useCostText);
}
}
How to get the require status ID, the Check Type(equal, greater,etc) and the Check Value ?
Post edited by bitmore on
  • This is pretty complex - basically, the settings field in the StatusRequirementSelection contains the requirement's settings, but it's a different class depending on which requirement it is.

    The setting's class is derived from the BaseStatusRequirementType class, e.g. for status value requirements, the class is StatusValueRequirementType, for level checks it's LevelRequirementType, etc.

    There are over 30 different classes for this - it's a bit complicated, but allows you to extend the requirements with custom checks without having to change anything in ORK's code :)
    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!
  • Thank you very much!
    StatusValueRequirementType is what I need :)
Sign In or Register to comment.