Is there a way for me to use use an item in a combatant's inventory from script?

Similar question for a skill in a skill list.

Thanks in advance,

  • edited September 2018
    Ok, so I looked into the API, and got
    this.combatant.Inventory.GetContent(false, true, false, false,1,true)[1].Use(this.combatant,player,true)
    typeID is if I only want to get a certain type of item from the inventory. I used "-1" to get all.

    Still looking into the skill part.

    Not sure what "checkParent" is for though.
    Post edited by iunami on
  • Getting an item from inventory:
    ItemShortcut item = combatant.Inventory.GetItem(id);
    id is the ID/index of the item (in the editor).

    Getting an ability:
    AbilityShortcut ability = combatant.Abilities.Get(id);
    id is the ID/index of the ability (in the editor).

    Both return their respective instances of an IShortcut interface, which provides the Use function to use the item/ability, e.g.:
    ability.Use(user, targets, useAction);
    user is a Combatant that will use it.
    targets is a List of the targets to use it on.
    useAction is a bool, which determines if it'll use an actual animated action (true) or just do the calculations (false).
    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.