Search Unity

S-Inventory: Equipment, Crafting, Skill Bar, Item Groups, Containers & Merchant (C# & JS)

Discussion in 'Assets and Asset Store' started by OussamaB, Jul 29, 2013.

Thread Status:
Not open for further replies.
  1. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The docs actually cover all the details about working with S-Inventory. If you mean that you're looking for tutorials that show you to integrate S-Inventory with a specific game type (RPG or FPS) then I don't think that's currently available. The reason is that everyone uses the asset in their specific game project so I can't cover tutorials for everything. But If you have any question or face any issue, please don't hesitate to contact me. I will try answer you ASAP.
     
  2. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Is the the item that you need collect in that quest an S-Inventory item?
     
  3. s0lt4r

    s0lt4r

    Joined:
    Jun 9, 2015
    Posts:
    13
    I was more so looking for a tutorial of all of the parts implemented step by step. Like an explanation of the demo scene that comes with the package.
     
  4. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    No, it happens with differente kind of objects.

    Another question.

    When I use a item in the skillbar, then the "icon" component disappears from the skillbar.
    How can I returns that slot to its initial state?



    I wrote this code in InventoryEvents

    Code (CSharp):
    1. public void OnSkillBarItemUsed (Item ItemObj)          
    2.     {
    3.         if (debug) Debug.Log("Just used "+ItemObj.Name+" from "+ItemObj.SkillSlot+" skill bar slot.");
    4.         UsedSkillBarItem(ItemObj);
    5.  
    6.      
    7.         if(ItemObj.Name == "hoguera")
    8.         {
    9.             necesidades.UsarKitFuego();      //To use the item
    10.            
    11.         }
     
    Last edited: Oct 9, 2015
  5. solideuk

    solideuk

    Joined:
    Nov 29, 2014
    Posts:
    41
    Hi,

    When dragging an inventory item, the icon is not usually fixed to the cursor position, any idea how this can be fixed?

    Thanks
     
  6. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    That's actually what the documentation is for. You can use the prefabs directly or follow the documentation to see how these prefabs are created step by step.
     
  7. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    The error is caused by the collectable item being destroyed by the "CollectionItem" script while S-Inventory tries to add that item into the inventory. You can either remove the "Item" script from that item and only use it in quests or modify the "CollectionItem" script by eliminating the line where the item gets destroyed.

    As for your other question, can you clarify what's the initial state of the slot?
     
  8. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    If the dragged item icon position is fixed exactly in the cursor position, the UI system wouldn't be able to identify the target drag slots "OnMouseEnter" events because the dragged item icon will be always blocking it. However, I'll look if Unity introduced a way yo ignore events with a UI elements which will allow us to fix the dragged item icon at the cursor position.
     
  9. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    Sorry, I re-read your question and I gave you the wrong answer.
    All of my recollectable objects are items of S-Inventory (stone, vegetable, mushrooms, etc.)

    I have eliminated the line where the item gets destroyed and the error disappear, but no matter which object catch some that are not those of the quest is added when I collected it.
    The "item/target name" is marked with the name of the quest item.

    The state that has at the beginning of everything, with nothing added.
     
  10. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    This is because the object is considered as an S-Inventory item so it's normal that the player can pick it for the inventory even when the quest is not active. I think what you're looking for is to remove the "Item" script from that item as I suggested in my last post.

    When the item is used (and there's nothing left of the item if it's consumable) then it will be removed from the skill bar and the icon UI image will be hidden since there's nothing to show. That's the initial state of the skill bar slot.
     
  11. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    I have written :"Destroy(GetComponent<Item>());" (in CollectionItem script) when the player picks up the object. This is the way to do that?
     
  12. solideuk

    solideuk

    Joined:
    Nov 29, 2014
    Posts:
    41
    Any update on this?
     
  13. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Simply remove the "Item" object from the object and use the default "CollectionItem" script. That will do it.
     
  14. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    You have to add a "Canvas Group" component to all the drag slots image objects then and disable "Interactable" and "Blocks Raycasts". Then open these scripts: "InventoryUI", "SkillBarUI", "ContainerUI" and "EquipmentUI" and search for this line:
    Code (csharp):
    1. +DragSlot.GetComponent<RectTransform>().rect.width/2
    with this:
    Code (csharp):
    1. -DragSlot.GetComponent<RectTransform>().rect.width/2
     
  15. solideuk

    solideuk

    Joined:
    Nov 29, 2014
    Posts:
    41
    Thanks. Though it didn't seem to work.

    Any suggestions?
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Is the drag slot position still the same as before? If yes, please check you've the code modification correctly like I described in the last post.
     
  17. solideuk

    solideuk

    Joined:
    Nov 29, 2014
    Posts:
    41
    It starts off at the pointer position, but when begin to move it begins to go out of sync and off from the cursor point.
     
  18. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Please send me your "InventoryUI" script in an e-mail.
     
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Just received the script. And as I mentioned in one of my replies, you've forgotten to modify "InventoryUI" script. Search for this line:
    Code (csharp):
    1. +DragSlot.GetComponent<RectTransform>().rect.width/2
    And change it to this:
    Code (csharp):
    1. -DragSlot.GetComponent<RectTransform>().rect.width/2
     
  20. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    But if I do that, we can't use those objects when I will use for other things.
    I needed to do at runtime. How could do this at runtime?
     
  21. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    Ok. But when a use OnSkillBarItemUsed to generate a prefab ("firepit" = "Hoguera" in spanish) with "Instantiate", then I can make endless firepits.
    The firepit is marked as "usable" and "Destroy in use" in the Item script.

    I tried to destroy the GameObject but it doesn't work.
     
  22. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I don't get it. What other things is the item going to be used for? If you want it to be an S-Inventory item, then the player will be able to pick it outside the quest. If not then the player will only interact with it when the quest is active.
     
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I don't see the connection between this and having the spell bar slot to its initial state (which happens automatically by the way).
     
  24. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36

    This is what happens when reload the game. I hover over it and I am not using Dialogue System. But the save and load is checked it the InventoryManager. When i drop the Item nothing appears. The Image isn't there either just the name :? Im using Realistic FPS Prefab
     
  25. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hi, mind if you can clarify the problem? I can't understand what's wrong from the screenshot you've provided.
     
  26. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    I have save and load checked in the inventory Manager. when i play the scene and pick up example a can it works. The Icon shows and when I drop it it shows but lets say I pick the can up then relaunch the game the Icon is gone and when I drop the can its invisible.
     
  27. Harokel

    Harokel

    Joined:
    Nov 2, 2012
    Posts:
    51
    Sorry for having taken so long time to respond you. We are in campaign of crowdfunding and we haven't time for anything :-(

    Could you talk by Skype next week? If you can, tell me day and hour, please. Thanks!
     
  28. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    For each S-Inventory item you create, the icon sprite must be named exactly like the item name and must be placed in the "Resources" folder in order to make the save and load feature work correctly.
     
  29. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Yes, next Friday will be good. PM me your Skype ID please.
     
  30. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    oh my gosh i feel so dumb aha. Thanks your the man :)
     
  31. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    the icons load but when I drop the items nothing is there :/
     
  32. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    If you mean that items don't appear as game object when you drop them from the inventory then you should use the "Spawn" drop type in the "InventoryManager" inspector.
     
  33. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    It is on "Spawn" already.
     

    Attached Files:

  34. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Make sure that the items prefabs are also in the Resources folder besides the icons. Sorry for the late reply, I was away in the past week.
     
  35. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Still doesn't work and for some reason the swords, shields and ect. dont either.
     
  36. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Isn't it working for the items in the demo scene? Have you tried re-importing the asset?
     
  37. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Currently working on the next update. The update will include changes to the vendor component of the asset including a more custom UI window.

    I've also decided to stop supporting JS in future updates.
     
  38. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Just submitted update v1.28:

    - Added dragging and dropping feature for all UI windows.
    - You can now assign a name, for each vendor, that will appear in the vendor UI window.
    - Make one slot and create others based on that slot.
    - Items in the vendor UI window are now shown along with their prices and the currency type.
    - Changed the way item slots are created in the vendor UI window: You just create one slot and the rest will be created depending on settings you choose from the inspector.
    - You can now play a sound effect when the player can't afford to purchase something from a vendor.

    Here are two screenshots showing the two styles you can switch between for the vendor UI window: Choose the amount of slots per row, the horizontal and vertical spacing and the positions of the items' icons, text fields and currency icon.


     
  39. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    S-Inventory v1.28 is now available on the asset store!
     
  40. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Update 1.29 has been submitted with even more vendor features:

    - Added the option to allow a double mouse click to move an item back from a vendor to the inventory after attempting to sell it.
    - Added option to allow a double mouse click to purchase an item from a vendor.
    - Added a button that will allow the player take back all the items (when attempting to sell them) from a vendor at once (Note that the player can still double click or select one item at time).
    - Added the option to show the item's info in the vendor menu when hovering the mouse over it.
     
  41. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    S-Inventory 1.29 is now available on the asset store!
     
  42. FlamingFur

    FlamingFur

    Joined:
    Dec 30, 2015
    Posts:
    9
    Do you have a demo for the Unity Project 2D Platformer?
     
  43. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Not at the current time, but S-Inventory supports 2D as well. In fact, many of the users have been using S-Inventory in their 2D projects.
     
  44. FlamingFur

    FlamingFur

    Joined:
    Dec 30, 2015
    Posts:
    9
    I’ll try to complete my project. Thanks for anwsering my question ^w^. Please note me if you have any 2D demo.
     
  45. darrennorthcott

    darrennorthcott

    Joined:
    Jun 17, 2014
    Posts:
    20
    I'm having difficulty getting the UI elements to scale to a retina screen (iPad)... any thoughts?

    Cheers
     
  46. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
  47. darrennorthcott

    darrennorthcott

    Joined:
    Jun 17, 2014
    Posts:
    20
    I actually got it to work: added a canvas scaler to the S-Inventory Canvas object and then disabled the SetPosition() on the UI scripts. However, now when I drag the items, they seem to drift away from the pointer and back towards it depending on where the cursor is... I tried the fix you mentioned above (replace the line of code with -) but it still doesn't work... thoughts?
     
  48. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    I've tried adding the Canvas Scaler to the canvas object and it broke dragging and dropping items and panels. I'm looking into a solution that will make dragging and dropping work with whatever canvas scaler position. While I'm on that, can you check if there's another solution that will allow you to scale the UI elements? I don't know the issue exactly but if they are too small or too big, you could manually scale each one of them without having to use a canvas scaler on the whole canvas.
     
  49. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Just submitted a new update which will add the items weights feature:

    - Set the weight for each item.
    - Set the maximum weight for the inventory.
    - Display the "CurrentWeight/MaximumWeight" in the inventory panel.

    The update will add the option to require currency to craft an item in a recipe, you can pick the currency name and amount and the player will be required to have that amount so that he crafts the item:

     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    S-Inventory v1.30 is now available in the Unity Asset Store!
     
Thread Status:
Not open for further replies.