edited June 2020 in ORK Support
Hi
I am implementing a custom skill slot bar.

Not a default assignment, in running games, through learned skills
I want to assign/remove them to/from a shortcut slot in real time.

1.Is there a function to register/delete the current abilities of the combatant in the short cut slot through scripting?

2.Assuming the ability level registered in the short cut slot is 1, the player has learned a new level (2).
In this case, the ability in the short cut slot is automatically updated??
Or is there a function that can be updated?

3.3. I wrote the following code to get the ability reuse time.

AbilityShortcut abs = (currentShortcut as AbilityShortcut);
float abilityCooldownTime = abs.GetReuseTime(playerCombatant);

However, I also want to get the duration of the status effect caused by the abilities. (To indicate in ui how long it lasts)
ORK.StatusEffects.Get(1)
The above code can only get the values set in the editor.
Is there a function that can be obtained through the combatant class in a running game?
(Because the Ability Level 1 status effect duration and Level 2 duration are different.)
thanks!
Post edited by KESHYAS on
  • 1) You can access/change a combatant's shortcuts like this, e.g. resetting something on the current active shortcut list:
    combatant.Shortcuts.Current[index] = null;
    index would be the shortcut's index, e.g. 0, 1, etc.
    If you want to assign something, just use that shortcut (e.g. an AbilityShortcut of the combatant) instead of null.

    You can also get other shortcut lists via combatant.Shortcuts.GetList(index).

    2) Should be the case. The shortcut in a slot and the actual ability are one and the same thing - so updating the ability's level (or changing the use level e.g. via menu or battle menu) will also affect the shortcut.

    3) That's not really possible - at least not that easy. Generally, you can access the status effects applied to a combatant via combatant.Status.Effects, but there's no direct way to tie an effect to be caused by a specific ability. You could go through the status changes of the ability and check for the status effect IDs it uses, but that doesn't mean that the effects are caused by the ability.
    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!
  • edited June 2020

    public void RegisterShortcut() {
    for (int i = 0; i < 7; i++)
    {
    if(ORK.Game.ActiveGroup.Leader.Shortcuts.Current[i] != null)
    continue;
    if(ORK.Game.ActiveGroup.Leader.Abilities.Has(ORK.Game.ActiveGroup.Leader.Abilities.Get(id)))
    ORK.Game.ActiveGroup.Leader.Shortcuts.Current[i] = ORK.Game.ActiveGroup.Leader.Abilities.Get(id);

    }

    Thank you for answer!
    I wrote the code above.
    (If the current player's short cut slot is empty and have learned the ability, this is the code to register for the short cut.)

    But if(ORK.Game.ActiveGroup.Leader.Abilities.Has(ORK.Game.ActiveGroup.Leader.Abilities.Get(id)))
    The error occurs in the part.
    Object reference not set to an instance of an object

    Because it is a custom gui
    ORK.Abilities.Get (id).GetIcon();
    Through the code above
    After placing the icon in ugui, I placed the button to register the short cut slot next to it.
    Therefore, in order to prevent you from registering an unlearned skill, you need to put a conditional statement, but I don't know how.

    2. And I want to implement the ability level up custom button.
    The feature exists in Ork's Ability Research Tree, but...
    I want to implement it through scripting.

    for ability lv 2> exp type statusvalue requirement 3
    for ability lv 3> exp type statusvalue requirement 7
    etc..
    When the level up button is pressed, the current level of the ability and the exp type stat value are checked and the new level of the ability is learned.

    Is the code I wrote right?

    public void LevelupAbility () {
    Combatant leader = ORK.Game.ActiveGroup.Leader;
    switch (leader.Abilities.Get (1).GetLevel ()) {
    case 1:
    if (leader.Status[12].GetValue ()> 3){ // exp type value for ability lv up
    leader.Status[12].AddValue (-3, false, false, false, false, false, false, null);
    leader.Abilities.Learn (1, 2, false, false);
    }
    break;
    case 2:
    break;
    case 3:
    break;
    case 4:
    break;
    case 5:
    break;
    }
    }
    Post edited by KESHYAS on
  • edited June 2020
    In your first code example, you try to check if a combatant has an ability by getting the ability from him, you can either directly check for the ID/index or just get the ability and check if it was returned:
    AbilityShortcut ability = ORK.Game.ActiveGroup.Leader.Abilities.Get(id);
    if(ability != null)
    {
    ORK.Game.ActiveGroup.Leader.Shortcuts.Current[i] = ability;
    }


    2) Generally, yes, looks correct. However, you can use ORK's functionality if you set up your abilities that way (e.g. Spend level up type). The AbilityShortcut class has functions for that, e.g. leveling up via spending the exp:
    ability.SpendExperience(user);
    user is the combatant (e.g. your player), ability is the AbilityShortcut (e.g. via ORK.Game.ActiveGroup.Leader.Abilities.Get(id)).

    You can also check if spending is possible (is also done when using the SpendExperience function), e.g. to make the button only available when it's possible:
    if(ability.CanLevelUpSpend(user))
    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!
  • edited June 2020
    sorry for many question

    1. I set 10 maximum levels for each skill in the editor.
    but I cannot enter the Ability Level 1 LevelPoints value.
    Is it intended?

    2. ability.SpendExperience(user);
    The code above seems to be only available for abilities already learned. (Must be level 1 or higher)
    Is it not possible to use the spend function to learn level 1 of a skill (with no instances yet) ?
    Does this require a combination of custom logic like haslearned and addvalue(minus neededValue)?

    3. Ability LevelPoints seems to work a bit strange.
    I set the Ability Level Point requirements as follows:
    Lv 1-0
    Lv 2-5
    Lv 3-7
    Lv 4-10
    ...
    However, the actual consumption of stat points is not the value set for each level, but only the difference between the previous level and the current level requirement.
    (that is, Lv 1 > 2 = 5 , Lv 2 > 3 = 2 , Lv 3 > 4 = 3....)

    Is there any reason it is set as above??

    Because I want to consume LevelPoints value set in each level immediately from exp type stat value.

    4.The startValue value of the status development is not applied.

    Normal type stat values ​​such as STR, DEX, and AGI are reset to the start value of the status development when the player is spawned.

    However, the problem is that the skill point (expType) stat value is not initialized to the start value.

    The settings of this stat are as follows.
    Type-Experience
    Experience Type -None
    Max Value Type-max value (0~ 99999)
    Earn on Level Up-false
    Class Development-false
    From Minimum-false
    Init to Level-false
    Use Level Difference-false

    my game's gamedesign :

    This stat value is not obtained at level up, but can be obtained through a specific event.
    the type of status development was set to None and the start value was set to 100 For testing,
    but after spawning the player (level 1), the value obtained through the getValue() function was 0.

    Can the exp type stat value be initialized through the status development?

    thanks a lot!!!
    Post edited by KESHYAS on
  • 1+2) That's only to level up already known abilities.
    To first learn the ability, you'll need to do it via:
    combatant.Abilities.Learn(id, level, true, true);
    id is the ID/index of the ability, level the level (so usually 1 to learn the 1st level).
    To reduce the exp, you already found the correct way (via the combatant's status AddValue function).

    For non-code stuff, there's ability development, that can be used to spend something (e.g. exp) to learn new abilities (and also new levels).

    3) Yeah, that's because abilities (and equipment) keep their own experience, e.g. if level 2 requires 5 exp, the ability will have 5 exp at that point and will continue gaining exp, not resetting back to 0.

    4) Enable Init To Level to have the exp initialized to the value defined in status development. This is only done when first intializing a new combatant (e.g. the player) to their starting level.
    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!! Solved!
    one more thing
    Ability development seems to be a function that simply acquires the ability of the level set at the corresponding player level for free.
    Is there a way to consume exp type stat value with ability development??
  • Ah, sorry, I meant Ability Trees, ability development is just an automatic learning of an ability when reaching a defined level :)
    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.