Search Unity

*UPDATE* Inventory Master - Inventory System written with the new UI System 4.6 *UPDATE*

Discussion in 'Assets and Asset Store' started by Sander1991, Dec 12, 2014.

  1. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi also i seem have a problem adding Attributes there used to be a editor window? only way is to edit them inside resource folder, thanx :D
     
  2. Feeble1

    Feeble1

    Joined:
    Jan 20, 2014
    Posts:
    19
    Has anyone been able to build and run this without errors?
     
  3. Farooqui

    Farooqui

    Joined:
    Mar 9, 2014
    Posts:
    23
    How do I check an item in inventory? for example , if I picked 10 grenades, how do I print out grenades and call them in game?
     
  4. Farooqui

    Farooqui

    Joined:
    Mar 9, 2014
    Posts:
    23
    Anyone? I understand mainInventory.deleteAllItems(); basically deletes the whole inventory, but how do I delete one specific item? maybe using itemID? I wish this was simpler :(
     
  5. Akermay

    Akermay

    Joined:
    Dec 1, 2013
    Posts:
    1
    Hi,

    How can I remove/uninstall Inventory Master from Unity?
     
  6. antiNT

    antiNT

    Joined:
    Apr 9, 2015
    Posts:
    5
    When the asset will have a save system please? It's so important.
     
  7. Schedim

    Schedim

    Joined:
    Sep 22, 2015
    Posts:
    10
    Is this still being developed? It is listed as free in the asset store, but if it lacks save system it feels like a dud however nice it looks...
     
  8. Z3r0Sign4l

    Z3r0Sign4l

    Joined:
    Oct 23, 2014
    Posts:
    11
    Hello,

    I was wondering how can I use the Inventory System with Photon.

    I create the game object late with:
    GameObject player = PhotonNetwork.Instantiate("Player", Utils.getRandomPosition(), Quaternion.identity, 0 );

    Now how can I attach the script and set the parameters so it works correctly? I tried:
    player.AddComponent<PlayerInventory>();
    player.GetComponent<PlayerInventory>().inventory = GameObject.FindGameObjectWithTag("MainInventory");
    player.GetComponent<PlayerInventory>().characterSystem = GameObject.FindGameObjectWithTag("EquipmentSystem");

    But the inventory and charactersystem public variable dont set....

    Any help would be fantastic, Im working on a demo that can be played here:
    http://langerztechnologies.net/hackandslash/

    Kind regards,
     
  9. Joeronimoe

    Joeronimoe

    Joined:
    Dec 15, 2015
    Posts:
    12
    Seems to be missing the UFPS scripts that you talked about in the YouTube video about integrated this into UFPS. Please include those scripts or point me to where I can find them.
     
  10. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Hey Everyone,

    I have added a weight attribute to an item, how can I read all of the items in my inventory and return a total weight?

    Cheers M.
     
  11. SolAZDev

    SolAZDev

    Joined:
    Nov 26, 2013
    Posts:
    8
    Is there a way to implement the Hotbar for mobile? Y'know the common click to use/consume feat?
     
  12. goyadark

    goyadark

    Joined:
    Dec 14, 2015
    Posts:
    1
    I need to equip with a button insted of drag and drop, there is a way?
     
    SolAZDev likes this.
  13. Matt-Face

    Matt-Face

    Joined:
    Mar 24, 2013
    Posts:
    22
    Is this system unsupported now? I just imported it into a blank project in unity 5.3.3f1 and got a whole lot of missing scripts etc.
     

    Attached Files:

  14. Matt-Face

    Matt-Face

    Joined:
    Mar 24, 2013
    Posts:
    22
  15. jorn818

    jorn818

    Joined:
    May 12, 2013
    Posts:
    100
    Have you ever considered a ''hand option'' so if I equip a weapon it will apear in my hand (this can be done with empty gameobjects)
     
  16. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Did anyone manage to use different BlueprintDatabases, for example to have different types of workstations ?
     
  17. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Had to do a workaround but it works now
     
  18. Sander1991

    Sander1991

    Joined:
    Aug 25, 2014
    Posts:
    162
    BIG UPDATE
    The asset is getting a rework soon. I know I haven't answered the most of the email which I got and I also know that there are bunch of small bugs in the asset itselfs. I am really sorry for that, but I had a lot of stuff to do and this will be the past soon. I am actually recoding the complete project with way better structured code and better editor scripting parts for you as a customer. Here are some pictures, where you can see the first changes and new features which will come soon ;):




    More is coming soon! I hope you like the update so far!
     
    Last edited: Apr 20, 2016
    Joeronimoe likes this.
  19. Schedim

    Schedim

    Joined:
    Sep 22, 2015
    Posts:
    10
    Fantastic news!
    Really looking forward to use this. I hope the code will flow smoothly from your fingers. :)
     
  20. Sander1991

    Sander1991

    Joined:
    Aug 25, 2014
    Posts:
    162
    Here is another update. These are the current Inspector scripts for the inventory parts[still WIP]:

    Inventory:


    Equipmentsystem with custom slot skins:



    Hotbar:


    Craftingsystem as Slotsystem:


    Craftingsystem as ListSystem:


    Hope you like it so far! Pictures how it does look like in playmode will come soon!
     
    Schedim, simulism and jf3000 like this.
  21. Saikox

    Saikox

    Joined:
    May 5, 2016
    Posts:
    1
    Hi,

    Im trying to add items to MainInventory from code using the public method: inv.addItemToInventory(itemID, itemValue);

    The item is added to the right slot but... is Invisible!!! all the components on the gameobject are OK, i dont know what to do, im looking 4 the "add an item" GUI method and is exactly the same on my code.

    What can i do? anybody have had the same problem or a seemed one?
     
  22. GOLDY00

    GOLDY00

    Joined:
    Mar 16, 2013
    Posts:
    139
    Hi all I wanna know I wanna make a Gui sorts like war of the Vikings is this possible so a button that says helmets it views all helmets that are selectable and it's got a slider and you click on it and it appears on character beside thanks
     
  23. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    May I please get the scripts to use this with ufps from someone please? I have sent a message and have kept checking into this and I still haven't gotten the scripts. I would greatly appreciate it if anyone can help me out.
     
  24. Dalquist

    Dalquist

    Joined:
    Jun 26, 2016
    Posts:
    2
    Is there any way to save your inventory so it doesn't reset when loading or reloading a scene? The author mentioned he was working on this functionality in an earlier post. Any updates?
     
  25. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    @Sander1991 - Thanks so much for this asset - I've made quite a few modifications to fit my own needs, but this gave me a great starting point.
    However, one thing I'm stuck on - has anyone had success modifying the system to use a joypad input? Current operations seem very heavily-tied to the mouse input, and although I've tried several ways to override the input, including using Rewired and InControl, I just can't seem to get the behaviour I want. Anyone else got a solution?
     
  26. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Replying to myself I guess, but I did eventually find a way around this. Essentially I had to ignore all of the "ConsumeItem" etc. type scripts since they're all hardcoded to listen to mouse clicks rather than a more abstract event like "Select" or "Cancel". Instead I've added a new class onto each slot cover that ties into the Unity event system and fires on any input - be that joypad, mouse, keyboard, whatever, and then hands on the appropriate action depending on what item is currently in the slot.
     
  27. omerselman

    omerselman

    Joined:
    Mar 5, 2016
    Posts:
    20
    hello everyone;
    here is the script i am using. Simply it instantiate object from folder to a child position in screen when i equipt. when i unequipt it destroys. it suppose to work both sides but it only works if i drag item from character equiptment screen to inventory. when i swap or drag or inventory to equiptment screen it adds attributes and item but on screen as child it destroys existing adding the dragged one and destroys it too.
    can you check the loop and offer me a good idea to make it work both sides.
    as you see i addes numbers for debugs to see the loop. it loops more then it suppose to .
    no item in equiptment slot and drag or swap from inventory to equipment slot pattern = 2 -4
    drag item out of equiptmen slot pattern = 7-8
    drag existing item out from equipment slot and swap with inventory item = 7-8-1-7-8-2-4
    drag from inventory slot to equipment slot and swap with equipment item = 1-7-8-2-4-7-8 ( this loop cause problem)
    thanks.
    Code (CSharp):
    1.  void EquipWeapon(Item item)
    2.     {
    3.         if (item.itemType == ItemType.Weapon)
    4.         {
    5.             if (EquipedWeapon != null)
    6.             {
    7.                 Debug.Log("log1");
    8.                 UnEquipWeapon(item);
    9.             }
    10.             EquipedWeapon = (GameObject)Instantiate(item.itemModel, playerHand.transform.position, playerHand.transform.rotation);
    11.             EquipedWeapon.transform.SetParent(playerHand.transform);
    12.             Debug.Log("log2");
    13.             if (HPMANACanvas != null)
    14.             {
    15.                 Debug.Log("Log4");
    16.                 UpdateManaBar();
    17.                 UpdateHPBar();
    18.             }
    19.         }
    20.     }
    21.  
    22.     void UnEquipWeapon(Item item)
    23.     {
    24.         if (item.itemType == ItemType.Weapon)
    25.         {
    26.             if (EquipedWeapon != null)
    27.             {
    28.                 Debug.Log("Log7");
    29.                 Destroy(EquipedWeapon);
    30.             }
    31.             if (HPMANACanvas != null)
    32.             {
    33.                 Debug.Log("Log8");
    34.                 UpdateManaBar();
    35.                 UpdateHPBar();
    36.             }
    37.         }
    38.     }
     
  28. FungusMonkey

    FungusMonkey

    Joined:
    Jun 30, 2016
    Posts:
    41
    Why am I getting this error?
    NullReferenceException: Object reference not set to an instance of an object
    DragItem.OnEndDrag (UnityEngine.EventSystems.PointerEventData data) (at Assets/InventoryMaster/Scripts/Item/DragItem.cs:85) Wjen I grag to drop am item/
     
  29. IanSmellis

    IanSmellis

    Joined:
    Nov 2, 2014
    Posts:
    26
    When I click the links to the ScriptAPI and Documentation I get this error.

     
  30. SnStarr

    SnStarr

    Joined:
    Mar 6, 2014
    Posts:
    23
    I haven't seen Sander answer questions in over a year and a half. Also, he hasn't made any planned update announcements in almost a year. I am going to assume support for this asset is dead. Since I have pretty much learned the system in and out, and have never had a problem with errors or anything like a lot of you have, I will try to revive the Support for this asset as best as I can. This is just something I am doing in my free time, because I like the asset and I am friends with Sander and I just want to help the community of users that also like this asset.. So until Sander returns to this thread or starts supporting here himself again, any questions you have I will try to answer. Post them here.

    @Darren_Therrien
    You need to assign either a model or a item sprite for the item you are dragging in the itemdatabase..

    @Saikox
    The item you are adding either has no sprite or the alpha level of the sprite is set to transparent level

    @IanSmellis
    The website no longer exists.

    @SolAZDev
    Refer to Tazoshimi's answer above. Thats what you are looking for my friend.

    @Dalquist
    Was a planned feature as far as I knew
     
    IanSmellis likes this.
  31. barbasu

    barbasu

    Joined:
    Dec 2, 2016
    Posts:
    2
    Hey SnStarr maybe you will be able to help me out. Basically i am trying to figure out which part of code is used to add items to inventory from craft system. I wanted to add something like a crafting timer. When you click on the result slot with certain item lets say cooked food it would wait a few sec and then put it in inv instead of doing that instantly.

    Any hints appreciated.
     
  32. SnStarr

    SnStarr

    Joined:
    Mar 6, 2014
    Posts:
    23
    @barbasu In the ConsumeItem Script.

    Its on this script I would place a few variables and a couple of boolean value checks that will determine if player right clicks the result slot to consume item..then start a timer to run..once the timer counts down...THEN run the AddToInventory method...And dont forget to reset the timer value so that it can run again at some point whenever the player crafts again..etc.I hope this helps. If you have any other questions feel free to email me at SnStarrGames@gmail.com


    Also, for anyone interested, im currently working on an implementation of a script that will allow you to add UI button Gameobjects to the HotBar to be able to use the HotBar as a spell bar like in World of Warcraft style. Once its working I will add the code here for anyone interested.
     
    Last edited: Mar 16, 2017
    IanSmellis likes this.
  33. barbasu

    barbasu

    Joined:
    Dec 2, 2016
    Posts:
    2
    I thought its that part as its the only one adding items to inventory. Thank you.

    I was confused as there is nothing that allows mouse input to be used on it but it works.

    I'll start working on it.
     
  34. IanSmellis

    IanSmellis

    Joined:
    Nov 2, 2014
    Posts:
    26
  35. wnfakind

    wnfakind

    Joined:
    May 23, 2014
    Posts:
    2
    Hello, I'm wondering if anyone knows if this can be implemented into a 2D RPG game. I've noticed the tutorials have been done using 3D. I'm fairly new to programming and unity and currently have the essentials for my game, except an inventory system which seem's far beyond my capacity.

    I would assume Vector3 would be the only change dealing with the scene and the player. because the UI is on a 2D plane. If anyone can inform me please do.
     
  36. shuskry

    shuskry

    Joined:
    Oct 10, 2015
    Posts:
    462
    HI @SnStarr @SnStarrGames !

    I have a little question, I use a prefab to do my game, and this prefab is instanciate aftrer the start of the game, so when i assign the inventory to the player, it's don't activ it when i use it :/

    Unity said :
    UnassignedReferenceException: The variable inventory of PlayerInventory has not been assigned.
    You probably need to assign the inventory variable of the PlayerInventory script in the inspector.
    PlayerInventory.Update () (at Assets/InventoryMaster/Scripts/ExampleScript/PlayerInventory.cs:305)

    I know this error, but when i assign the PAnel inventory like in the video , it's don't work..

    Can you help me ?

    Thx if you read me ! Have a good day!
    (sorry for my bad explain i'm french ^^ )
     
    Last edited: Apr 13, 2017
  37. Alpha_Null

    Alpha_Null

    Joined:
    Apr 20, 2017
    Posts:
    1
    Has anyone found a way to reference the items in the inventory during gameplay?
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    This is from the Dialogue System for Unity's Inventory Master Integration (a free download on the Dialogue System Extras page). Feel free to lift some of the code for your own scripts. The code below lets you reference the item database and the player's inventory to check if the player has an item, and to give and take items from the player's inventory.

    InventoryMasterLua.cs
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. namespace PixelCrushers.DialogueSystem.InventoryMaster
    4. {
    5.  
    6.     /// <summary>
    7.     /// This class provides Lua functions to access InventoryMaster.
    8.     /// </summary>
    9.     public class InventoryMasterLua : MonoBehaviour
    10.     {
    11.  
    12.         private ItemDataBaseList m_itemDatabase = null;
    13.         private Inventory m_mainInventory = null;
    14.         private Inventory m_characterInventory = null;
    15.  
    16.         public ItemDataBaseList itemDatabase
    17.         {
    18.             get
    19.             {
    20.                 if (m_itemDatabase == null) m_itemDatabase = (ItemDataBaseList)Resources.Load("ItemDatabase");
    21.                 return m_itemDatabase;
    22.             }
    23.         }
    24.  
    25.         public Inventory mainInventory
    26.         {
    27.             get
    28.             {
    29.                 if (m_mainInventory == null)
    30.                 {
    31.                     var playerInventory = FindObjectOfType<PlayerInventory>();
    32.                     if (playerInventory != null && playerInventory.inventory != null)
    33.                     {
    34.                         m_mainInventory = playerInventory.inventory.GetComponent<Inventory>();
    35.                     }
    36.                 }
    37.                 return m_mainInventory;
    38.             }
    39.         }
    40.  
    41.         public Inventory characterInventory
    42.         {
    43.             get
    44.             {
    45.                 if (m_characterInventory == null)
    46.                 {
    47.                     var playerInventory = FindObjectOfType<PlayerInventory>();
    48.                     if (playerInventory != null && playerInventory.inventory != null)
    49.                     {
    50.                         m_characterInventory = playerInventory.characterSystem.GetComponent<Inventory>();
    51.                     }
    52.                 }
    53.                 return m_characterInventory;
    54.             }
    55.         }
    56.  
    57.         public void OnEnable()
    58.         {
    59.             Lua.RegisterFunction("PlayerHasItem", this, SymbolExtensions.GetMethodInfo(() => PlayerHasItem(string.Empty)));
    60.             Lua.RegisterFunction("GiveItemToPlayer", this, SymbolExtensions.GetMethodInfo(() => GiveItemToPlayer(string.Empty)));
    61.             Lua.RegisterFunction("TakeItemFromPlayer", this, SymbolExtensions.GetMethodInfo(() => TakeItemFromPlayer(string.Empty)));
    62.         }
    63.  
    64.         public void OnDisable()
    65.         {
    66.             Lua.UnregisterFunction("PlayerHasItem");
    67.             Lua.UnregisterFunction("GiveItemToPlayer");
    68.             Lua.UnregisterFunction("TakeItemFromPlayer");
    69.         }
    70.  
    71.         public bool PlayerHasItem(string itemName)
    72.         {
    73.             if (itemDatabase == null || mainInventory == null || characterInventory == null)
    74.             {
    75.                 Debug.LogWarning("PlayerHasItem(): Can't find Inventory Master components.");
    76.                 return false;
    77.             }
    78.             var item = itemDatabase.getItemByName(itemName);
    79.             if (item == null)
    80.             {
    81.                 Debug.LogWarning("PlayerHasItem(): Can't find item '" + itemName + "' in ItemDatabase.");
    82.                 return false;
    83.             }
    84.             var foundItem = mainInventory.getItemGameObjectByName(item) ??
    85.                 characterInventory.getItemGameObjectByName(item);
    86.             var result = (foundItem != null);
    87.             Debug.Log("PlayerHasItem('" + itemName + "') is " + result);
    88.             return result;
    89.         }
    90.  
    91.         public void GiveItemToPlayer(string itemName)
    92.         {
    93.             if (itemDatabase == null || mainInventory == null)
    94.             {
    95.                 Debug.LogWarning("GiveItemToPlayer(): Can't find Inventory Master components.");
    96.                 return;
    97.             }
    98.             var item = itemDatabase.getItemByName(itemName);
    99.             if (item == null)
    100.             {
    101.                 Debug.LogWarning("GiveItemToPlayer(): Can't find item '" + itemName + "' in ItemDatabase.");
    102.                 return;
    103.             }
    104.             Debug.Log("GiveItemToPlayer('" + itemName + "')");
    105.             mainInventory.addItemToInventory(item.itemID);
    106.         }
    107.  
    108.         public void TakeItemFromPlayer(string itemName)
    109.         {
    110.             if (itemDatabase == null || mainInventory == null)
    111.             {
    112.                 Debug.LogWarning("TakeItemFromPlayer(): Can't find Inventory Master components.");
    113.                 return;
    114.             }
    115.             var item = itemDatabase.getItemByName(itemName);
    116.             if (item == null)
    117.             {
    118.                 Debug.LogWarning("TakeItemFromPlayer(): Can't find item '" + itemName + "' in ItemDatabase.");
    119.                 return;
    120.             }
    121.             if (!TryRemoveFromInventory(mainInventory, item))
    122.             {
    123.                 if (!TryRemoveFromInventory(characterInventory, item))
    124.                 {
    125.                     Debug.LogWarning("TakeItemFromPlayer(): Can't find item '" + itemName + "' in player's inventory.");
    126.                     return;
    127.                 }
    128.             }
    129.         }
    130.  
    131.         private bool TryRemoveFromInventory(Inventory inventory, global::Item item)
    132.         {
    133.             var itemGameObject = inventory.getItemGameObjectByName(item);
    134.             var itemOnObject = (itemGameObject != null) ? itemGameObject.GetComponent<ItemOnObject>() : null;
    135.             if (itemOnObject == null)
    136.             {
    137.                 return false;
    138.             }
    139.             else
    140.             {
    141.                 Debug.Log("TakeItemFromPlayer('" + item.itemName + "')");
    142.                 inventory.deleteItemFromInventoryWithGameObject(itemOnObject.item);
    143.                 inventory.updateItemList();
    144.                 return true;
    145.             }
    146.         }
    147.  
    148.     }
    149.  
    150. }
     
  39. ecmr

    ecmr

    Joined:
    Feb 5, 2017
    Posts:
    2
    All your documentation links are dead :(
     
    IanSmellis likes this.
  40. Torulo

    Torulo

    Joined:
    May 15, 2015
    Posts:
    4
    Is there any way to revive documentation?

    I'm having problems with this asset, anyway i love it.
    The problem is when dragging items out of inventory. With a 10 item stack it doesn't drop, when i split into two stacks of 5 one of them is "droppable" the other don't. Somehow when i use crafting systems i can't get the result items.

    I know it's buggy, but i'm so pacient i can win the struggle. Just need a bit help. Documentation would help a lot. Thanks a lot for letting us use this for free.:)

    Problem with dropping items was there were created in 2 different moments. Deleting them and adding to inventory again worked as fix
    "
     
    Last edited: Jun 3, 2017
  41. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    It's very hard to make changes without documentation. It would be a great help if someone can share it.
     
  42. Maxwell111

    Maxwell111

    Joined:
    Nov 12, 2016
    Posts:
    1
    I need the Inventory Master manual, but the link is broken, please someone send me the manual!
     
  43. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    I take it there is no docs inside the actually asset?? I don't use this, but most assets do. Looks like he shut down his site.
     
  44. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    The bat is dead. Bury it.

    But on a different note I was using this and it became very broken even after manually upgrading it. I was even using both versions since there was one that worked with ufps.

    I think if you message the Dev he could probably provide you docs. Which is how I got it a long time ago. I also deleted my ufps project before anyone asks
     
  45. Defective_Donut

    Defective_Donut

    Joined:
    Aug 12, 2017
    Posts:
    1
    If anyone's still looking for the documentation you can find them both here and here using the Archive.org

    Hope that helps!
     
    Last edited: Sep 28, 2017
  46. Rinz23

    Rinz23

    Joined:
    Dec 3, 2017
    Posts:
    4
    Hi
    Working with Inventory master for a couple of weeks and I really like it.
    but Im trying to get rid of the equip item on right mouse click, and I cannot seem to find it in the scripts where this event is handled.
    Does anyone have any clue where to look?
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    ConsumeItem.cs's OnPointerDown method. Line 38 checks for right mouse click:
    Code (csharp):
    1.  if (data.button == PointerEventData.InputButton.Right)
    and the block of code starting on line 59 equips the item.
     
  48. Rinz23

    Rinz23

    Joined:
    Dec 3, 2017
    Posts:
    4
    Thanks, did not expect to find it in the consume items script.
    I will dive into it and see if I can get it disabled. :)
     
  49. jf3000

    jf3000

    Joined:
    Dec 31, 2013
    Posts:
    166
    Is this project now dead? Nothing has been updated.
     
  50. Cjoshua2

    Cjoshua2

    Joined:
    Nov 30, 2017
    Posts:
    2
    does anyone made a save and load system using this inventory?