edited March 9 in ORK Scripting
A few quick questions :D


- How do we modify Armor durability in code?

- How do we equip/unequip objects currently in the inventory via code? We've found the method for adding/removing objects to equipment via ID, but not for moving the item itself from inventory to equipment and vice versa.
Post edited by Kirb on
Tactics RPG Grid Battle System for ORK
---------------------------------------
I make Rune Fencer Illyia: http://www.runefencerillyia.com
Twitter: https://twitter.com/AMO_Crate
  • I found the good thing to look for stuff like that is Source code for Event Steps.

    The item should be auto removed/added to inventory if you select appropriate settings when calling Equip/Unequip.

    For Equipping

    Combatant.Equipment.Equip(int partID, EquipShortcut equip, Inventory inventory, bool keepUnequipped, bool reset);


    So you need
    PartID - this is Equipment Part ID you defined in Inventory.
    EquipShortcut - You can get IShortcut from inventory and thens use (EquipShortcut )iShortcut to cast it into equipment. seems to work for me, but I'm not sure if I'm equipping right instance of item or first instance of item.
    Inventory - Just use Combatant.Inventory
    keepUnequipped - Set this to true and if there was any item inside equipment slot, it will be returned to inventory. Otherwise it's gone.
    reset - No idea :D, I think this marks equipment dirty for hud updates.


    For UnEquipping

    Combatant.Equipment.Unequip(EquipShortcut equip, Inventory inventory);


    Also is Confusing but you can Combatant.Equipment is like lists/Arrays so you can use

    Combatant.Equipment[0]
  • edited March 12
    Cheers, @hellwalker!

    Just need to find the correct way to modify durability on a specific piece, then.
    Post edited by Kirb on
    Tactics RPG Grid Battle System for ORK
    ---------------------------------------
    I make Rune Fencer Illyia: http://www.runefencerillyia.com
    Twitter: https://twitter.com/AMO_Crate
  • Have you tried
    Combatant.Equipment[0].Equipment.ChangeDurability()
    ?
  • edited March 12
    Yep, the ChangeDurability function is the correct one here. Takes the combatant who has it equipped (or you want the calculations based on), the change value and the operator, e.g.:

    combatant.Equipment[0].Equipment.ChangeDurability(combatant, 1, SimpleOperator.Sub);

    When accessing equipment of a combatant, always make checks if there's something equipped on that equipment part:

    if(combatant.Equipment[partID].Equipped)
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.