Hello,

I am trying to find a way to turn items from a lootbox into an itemdata variable that I can use in my NPC inventory.
I wonder if this is possible and if not what a better way to do something like this would be.

Any help is always appreciated.
  • The items in the item box are already items ready to put into the inventory - but you don't even need to do anything complicated, as there's a function to do just that available:
    collector.CollectItem(index, combatant);
    collector is the ItemCollector component, index the index of the item (starts at 0) and combatant is the combatant who collects it.

    Btw, you could have continued this in your other thread :)
    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 23
    I tried to use this, but it think that because I have an older version of ork that it doesn't have CollectItem. So do you perhaps know a different way i could go about this.
    Post edited by Underuser on
  • Which ORK version are you using?

    If the ItemList property is availabe in the ItemCollector component, you can use this:
    IShortcut item = collector.ItemList[0];
    collector.ItemList.RemoveAt(0);
    combatant.Inventory.Add(item, true, true, true);

    This'll get the first item in the list (index 0), remove it from the box and add it to a combatant's inventory.
    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!
  • I have version:2.28.1

    And I have been trying for a while to give my NPC character a compatant script, but I haven't found a way yet.

    how would you go about giving a character a combatant script.
  • Use an Add Combatant component.
    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.