edited November 2020 in ORK Scripting
Hello
Is there a way to create an item through a script and send it to the player (leader) inventory??

ItemShortcut item = new ItemShortcut(int itemID, int quantity);

1. How can I create an item this way and then send it to the inventory??

2. This is a question on another topic. What is the usecase of notification? Is it used to show info text in the gui box?

3. and.. does 'show Console' check box means that it is showed at unity console window?
Post edited by KESHYAS on
  • 1) Well, you already have the code for creating the item, you only need to add it to the inventory of the player, e.g.:
    ItemShortcut item = new ItemShortcut(itemID, quantity);
    ORK.Game.ActiveGroup.Leader.Inventory.Add(item, true, true, true);

    itemID is the ID/index of the item, quantity is the quantity, the 3 passed on true control if this'll show notifications, console texts and mark the item as new (if you're using those settings).

    2) Notifications are, well, pop-up notifications that are visible for some time. You can define how inventory related notifications look and behave in Inventory > Inventory Settings > Notification Settings.

    3) No, that's for the ORK in-game console, see Game > Console Settings. You can display it via a Console type HUD, and also output it to Unity's console. The console is usually disabled in new projects, so even if you pass on to show console texts in the inventory, it will only display it if the console is set up to be used.
    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 November 2020
    Thank you!
    But... the code above seems to only create those in the'Items' category of the editor.

    I want to create and get weapons and armor.
    Should I use an equipshortcut? However, it requires 4 parameters.
    What do i need to pass?
    Post edited by KESHYAS on
  • For weapons:
    EquipShortcut item = new EquipShortcut(EquipSet.Weapon, id, level, quantity);
    For armors:
    EquipShortcut item = new EquipShortcut(EquipSet.Armor, id, level, quantity);
    id is the ID/index of the weapon or armor, level the level (e.g. 1), quantity is the number of weapons/armors.
    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.