edited March 22 in ORK Scripting

I am using Ork Frameword 2.

In my current project I have buttons to use Abilities which are displayed via GUI Box and Shortcut Settings. At some point I need to be able to disable all buttons but one (I am doing a tutorial and I don't want the player to be able to click on another button than the one I specified).
I know that I could use variables but I feel it wouldn't be the "cleanest" way to go since I have several abilities I would have to have a bool for every ability (because I can't 'use object variable' since I have general variables I need to keep). So this is my last resort option and I want to be sure I tried everything before I go there.

So I tried the following via script :
foreach(AbilityShortcut ability in abilities)
   if (ability.GetShortName() != "abilityname")
      ability.Setting.useableIn = UseableIn.None;
It does grey out the buttons we need but when we click on the ability left we have this error :
NullReferenceException: Object reference not set to an instance of an object
ORKFramework.Combatants.CombatantAbilities.GetStatusChanges (ORKFramework.StatusPreviewInformation& info) (at :0)
ORKFramework.Combatants.CombatantStatus.GetStatusChanges (ORKFramework.StatusPreviewInformation& info) (at :0)
ORKFramework.Combatants.CombatantStatus.ResetStatus (System.Boolean checkDeath) (at :0)
ORKFramework.Combatants.CombatantStatus.Tick (System.Single time) (at :0)
ORKFramework.Combatant.Tick (System.Single time, System.Single battleTime) (at :0)
ORKFramework.CombatantHandler.Tick () (at :0)
ORKFramework.ORKCore.FireTick () (at <8f6deff85b39442eaccd50a0d7f3d6e3>:0)
ORKFramework.ORKHandler.Update () (at <8f6deff85b39442eaccd50a0d7f3d6e3>:0)
It seems probably not the best approach since I am trying to change temporarily the way the abilities can be used.
So in the end I wonder, is there a way to "control" the buttons and disable them somehow? I've looked into it a while and can't seem to find anything.
Or is my attempt a good idea but I've overlooked something causing this error? Any idea what it could be about?

Thank you for any answer.
Post edited by AnneLaure on
  • Yeah - changing Useable In like that makes an active ability into a passive one, which would usually initialize some other settings in the editor that are needed to work. Doing that in-game like this will naturally cause errors.

    The easiest way I see to do this, without having to set up individual blocking variables/conditions for each ability, would be to have click-blocking HUDs displayed above the other buttons ...
    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!
  • Ok thank you ! :)
Sign In or Register to comment.