I'm trying to make the player character learn an ability through script. I'm using the code
StringBuilder skill = new StringBuilder();
skill.Append("Ability Name");
ORKFramework.LearnAbility.Learn(ComponentHelper.GetCombatant(gameObject), ref skill);


I'm not sure if this is the correct way to pass in the ability I want the character to learn. I'm also getting an error saying
An object reference is required for the non-static field, method, or property 'LearnAbility.Learn(Combatant, ref StringBuilder)' [Assembly-CSharp]csharp(CS0120)
  • edited March 2021
    No, that's not the correct way, this is:
    combatant.Abilities.Learn(id, level, true, true);
    id is the ID/index of the ability, level the level you want to learn - the rest is for showing notification and console texts.
    combatant naturally is the combatant who should learn the ability :)
    Post edited by gamingislove on
    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!
  • Even after learning the ability, it doesn't appear in the character's ability select menu. Do I have to write a line that adds the ability to the selection menu? If so, how?
  • No, that'll happen automatically - the function would return true if the ability was learned, maybe check that.

    Generally, this is the same function that's used by ORK to learn a new ability, so I'm pretty sure that it's working :)
    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!
Sign In or Register to comment.