Search Unity

[Released] NextGear Inventory System. Dual wielding and special item effects are now possible

Discussion in 'Assets and Asset Store' started by Zurusona-Kitsune, Sep 5, 2014.

  1. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    NextGear inventory system
    Update :
    version 0.8.3
    fix a bug in the NextGear_ItemDatabase class which caused errors when trying to display an item's effect fields
    added a button to the NextGear_ItemDatabase inspector to allow users to manually import saved items into a database.

    Details :
    A powerfull inventory system that intend to break the limitations found in common unity inventories.
    This asset includes a lot of features that I see are missing in the others inventories on the asset store.

    One of the rare inventory with the ability to equip dual swords and 2 handed weapons.
    Finally let your imagination free as you customize your character the way you truly imagined it.



    Amazing and simple item creation system that allows you to make any effects you desire on consume.
    You wish to make a scroll of teleport, an item that will summon a minion, a rune that cast a spell and invoke some particle effects,
    make all items surrounding you react to that said spell or even make some simple health, mana and elixir potion.
    All is possible with the "ItemEffect".



    Visually edit your inventory attributes in the editor.
    Choose the number of slots, size, and even how many pages your inventory have and see it update in real time.



    NextGear inventory system was made with extreme power and versatility in mind,
    while keeping the ease of use as simple as possible.
    Populating your scene with items is child play.
    Open Nextgear inventory's custom "ItemFinder" window and drag and drop a sword or a potion into your scene view or even in the inspector.



    Every parts are customizable. And a lot of inspector scripts were written to make the process streamlined.



    The package include a step by step tutorial which is mainly made of prefabs to drag and drop into your scene for simple setup in your game
    It also include an example scene to showcase all the features.

    The end goal of this project is to have the best inventory system om the asset store. One that can rival AAA games' inventory.
    So support me and any input that can help me improve NextGear inventory system will be very welcome.
    Once the new unity GUI is officially out and more stable, I will update this asset to support it without the need of NGUI if possible and anyone who bought it will get this upgrade for free.


    ----some of the features :
    1. the inventory support equipments and items(stackable and non-stackable ones)
    2. dual wielding weapons
    3. 2 handed weapon
    4. Display equipment on character model
    5. possibility to equip without display equipment item(ex: rings and trickets)
    6. Custom ItemEffect.
    7. ItemEffect can be stacked onto one item to create multipurpose items (ex : elixir)
    8. Item requirement on use(ex: character cannot drink a health potion on full health)
    9. items cooldown
    10. drag and drop items from the inventory to your world
    11. click on an item in the world to add to your inventory
    12. possibility to have a squad base inventory(individual inventory per character)
    13. Custom unity window to drag and drop items into your scene view or your inspector
    14. possibility to rename every body part to use the inventory for non character(ex: vehicles parts)
    15. Many custom inspectors to make editing a simple and quick process.
    16. individual sound slot for each item when you drop them in your inventory or consume them.
    17. equipments stats and stats requirement.
    18. automatically check if character have enough stats to equip the item and add equipment stats to the character.
    19. so much more I probably forgot half of the other features
    ------Here is an example of an item effect script(the effect is shown in the video at the top)-----
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class FusRoDah : NextGear_ItemEffect
    5. {
    6.     //you make you own variables in classes that inherit NextGear_ItemEffect
    7.     public GameObject particleEffect = null;
    8.  
    9.     //method which controls what happens when using an item
    10.     public override void activate(GameObject character, NextGear_InGame_Items item)
    11.     {
    12.         Collider[] hitColliders =  Physics.OverlapSphere(character.transform.position, 3.5f);
    13.  
    14.         for(int i = 0; i < hitColliders.Length; i++)
    15.         {
    16.             Rigidbody rb = hitColliders[i].attachedRigidbody;
    17.  
    18.             if (rb != null)
    19.             {
    20.                 rb.AddExplosionForce(3000f, character.transform.position, 300f, 1.0f);
    21.             }
    22.         }
    23.  
    24.         if(particleEffect != null)
    25.         {
    26.             Vector3 position =  character.transform.position;
    27.             GameObject.Instantiate(particleEffect, position, Quaternion.identity);
    28.         }
    29.     }
    30.  
    31.  
    32.     //method where you write the requirement necessary to use the item. For this example this is not necessary
    33.     /*public override bool CanBeActivated(GameObject character, NextGear_InGame_Items item)
    34.     {
    35.         return true;
    36.     }*/
    37.  
    38.  
    39.     public override object Clone()
    40.     {
    41.         FusRoDah effect = ScriptableObject.CreateInstance<FusRoDah>();
    42.         effect.particleEffect = this.particleEffect;
    43.         return ScriptableObject.CreateInstance<FusRoDah>();
    44.     }
    45. }
    this code find all rigidbody around the character and create an explosion effect that push away all the rigidbodys while instantiating a cloud particle effect.

    As you see, the code is simple and to the point.
    You can also harness the same powerful ItemEffect system in your game.​
     

    Attached Files:

    Last edited: Mar 21, 2015
  2. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Looks nice. Seems to be an extension of the inventory example provided with NGUI. I did something similar in my current game. Good luck with this.
     
  3. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    You are right since I used the NGUI inventory example to build on top. I did ask for authorization to distribute it.
    But this is much more than a simple extension as it contains far more than the original offered.

    As far as I saw It is the only inventory system in unity store with dual blade, 2 handed weapon support, stats requirements, and which allow to make any items imaginable not just a stats changing potion.

    In the video I made for example, I made an item capable of physically pushing any rigidbody items around the character while casting a particle cloud effect. When doing it I had the FusRoDah scream from Skyrim in mind.

    The Item effect script you need to inherit to create an effect is so powerful you can create your own variables in there and they will automatically be displayed on the inspector.
    You can already see it in the "summon sword" picture(the book item).
    Under "Item effect" you can see 2 variable created specifically for the summoning effect.
    The first entry is for the 3d model, the second entry is for the particle effect.
     
    Last edited: Sep 6, 2014
  4. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    I just finished replacing all the 3d models. I tried to submit the asset again but I get a connection error.
    I'll try again later.
    Hopefully this asset will be on the store soon.
     
  5. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
  6. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    the first video tutorial have been uploaded to youtube :
     
  7. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Now that unity 4.6 is out I'm studying the new UI system to upgrade NextGear inventory system.
     
  8. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    I've made a tooltip for the new UI and I am going to share it for free on the asset store.
    Here is the example :
    http://www.fastswf.com/I3TcjAY

    I also already done the drag and drop for the updated inventory system.
     
    Last edited: Dec 2, 2014
  9. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    After working a bit on updating NextGear inventory to the new UI, I decided to try to separate the logic from the interface.
    This will take me a bit longer to do but it would allow us to easily adapt the code to any UI in the future.

    If I'm able to do so, I will support both unity4.6 UI and NGUI with it.
     
  10. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    691
    I hope you don't mind two quick questions that occurred to me playing with the demo: first off, I notice that the shoulder pads have a left and right version, which the NGUI version did not- does your code work by taking a model of a single shoulder pad, spawning that in one shoulder socket, and rotating it for the other one, or is it a single model of two shoulder pads?

    Second, can the equip system actually deform clothing around the model, so if I equip a shirt, the sleeves and sides will twist and move as the character does? If it does that efficiently, that alone is easily worth the price of the asset.
     
  11. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    No worries I welcome questions. They always help to show the abilities or limitations of assets.

    For your first question, yes that's how it works in the current demo actually. Both shoulders are the same. I was using the second shoulder item to test some features that's all.

    For your second question, no there is no cloth deformation though I would love to add this feature in the future.
     
  12. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    691
    Wow, thank you for the fast reply, on a holiday no less! I appreciate your quick answers, and hope you have excellent luck developing this :)
     
  13. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    You're welcome. merry Christmas
     
  14. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Hi - I have a question about the example scene included with NextGear.

    Why is there no ItemDatabasePrefab in the Hirearchy for the example scene (NextGearInventorySystemDemo)?

    The tutorial in readme.txt states this is required in the scene, along with the ScriptContainer prefab.

    ScriptContainer is in there but ItemDatabasePrefab isn't.
     
  15. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    The itemDatabase also works within the hierarchy.
    So you can create one as a prefab without needing to set it and reload it in every scene.

    Happy new year.
     
  16. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    I added an ItemDatabase to the example, but it does not see the existing items in the example. Is it possible to add an ItemDatabase to the scene, to see all existing the existing items created for the example?

    Also, how do I get ItemFinder panel to work in the example scene? ItemFinder does not show the items from the example for some reason.
     
  17. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    It's not possible to make an ItemDatabase see existing items.
    Each ItemDatabase have their own data so you can make a ConsumableItemDatabase, a weaponItemDatabase, etc.

    It's strange that the ItemFinder doesn't display the items. I don't have access to unity right now but I'll test this as soon as I can and I will PM you once I find out why
     
  18. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    I think I found the reason the items are not showing in the itemFinder. I think before uploading the asset to the store, I must have accidentally deleted the ItemDatabase that hold those items.
    The Items still exist as a scriptableObject which is the reason the scene still works fine.

    I'll add a way to import existing NextGear_DB_BaseItem to the ItemDatabase.

    Please PM me an email address so I can send you the new ItemDatabase class once I've updated it since the asset store will probably take a while before they accept it
     
    docgonzzo likes this.
  19. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Version 0.8.3 is now online.
     
  20. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Thanks for looking into this issue. Sorry for not getting back to you sooner - I'm only working part-time on this project.

    Now, when I open the ItemFinder window, it sees only a "New Stackable Item" with a "W_Book07" icon. This item is from an ItemDatabasePrefab located in the example scene folder (not the actual scene). Something still is not right here.

    There is now a copy of the "ItemDatabasePrefab" under the example folder:
    Assets\NextGear inventory system for NGUI\

    Is there a way to change or define where the ItemFinder is looking for the items?
     
  21. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Sorry I forgot to add all the items back to the database before uploading it.
    Basically I used the 3 items in the database as test to see if the new features are working but due to constant heart palpitation I kept having, I wanted to upload it as soon as possible in case I started to really feel sick and forgot to delete those test items.

    to make the scene work as intended please select the database, add the icon atlas found in the "NextGear inventory system for NGUI/Atlas" folder.
    Delete the 3 existing item in the database(this will also delete the files).
    Then you'll have to click the new "import item files" and import each item individually into the database one at a time.(all the items are found in the "NextGear inventory system for NGUI/NextGear_Inv_Example scene/DB_items/Resources" folder)

    I will fix this omission and reupload again with the scene correctly setup.

    Also to answer your question, the itenFinder only looks through existing database.
     
    Last edited: Jan 8, 2015
  22. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Thanks again for clearing things up. I applied your fix and its working now.

    What is the best way to instantiate items at runtime directly to the Inventory? In the example, I see that the PanelInventoryManager also has a script attached called "AddItemToInventory.cs" that instantiates "InGame_Base_Items" directly the inventory at runtime. However, the desired item must be dragged over from the ItemFinder to the Inspector to be added to the list.

    Is it possible to get a reference to the InGame_BaseItem that i want to instantiate through the ItemDatabase, so I can instantiate directly to the inventory? This way, i would only need a reference to the ItemDatabase in my script, instead of each individual InGame_BaseItem (dragged from ItemFinder).

    I hope my question makes sense!
     
  23. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    The way items are structured, you have the NextGear_DB_BaseItem which is what the database create and hold a list of, then you have the InGame_Base_Items.

    If you think of items in diablo games, you have a wooden sword in the database.
    But all the wooden swords you find in the game are not the same. For example you would have rotten wooden sword or a legendary wooden sword.

    Basically the wooden sword Item in the database is NextGear_DB_BaseItem(well a NextGear_DB_BaseEquipmentItem that inherit the NextGear_DB_BaseItem actually).

    The rotten wooden sword or a legendary wooden sword you'll find in the game have a link to the wooden sword database item but hold their own extra information too. That would be the NextGear_InGame_Base_Items.

    If you look in the NextGear_ItemDatabase class, there is a list called items. This is what you are looking for.
    I created a method to easily find the item too. So you can do something like that :

    Code (CSharp):
    1.  
    2. public NextGear_ItemDatabase myDatabase;
    3. public NextGear_UIInventory myInventory;
    4.  
    5. public NextGear_InGame_BaseItem CreateItem(string ItemName)
    6. {
    7. //find the item in the database
    8. NextGear_DB_BaseItem DBItem = myDatabase.FindByName(ItemName);
    9. //instantiate the InGameItem
    10. NextGear_InGame_BaseItem inGameItem = DBItem.CreateNextGearInGameItem();
    11.  
    12. return inGameItem;
    13. }
    14.  
    15. public void AddItemToInventory()
    16. {
    17. NextGear_InGame_BaseItem item = CreateItem("NameOfmyItem");
    18. int emptySlot = myInventory.findEmptySlot();
    19. //the replace method would return the Item in the slot but in this case it would just return null
    20. //since the slot is empty.
    21. myInventory.Replace(emptySlot, item);
    22. }
    23.  
    24.  
     
    Last edited: Jan 9, 2015
  24. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19

    I see now - Thanks so much for all the help!
     
  25. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Just a quick update.
    I'm still working on separating the UI to it's logic. This is a long process because the code need to be malleable to adapt to any UI that can exist in the asset store and also because there is so much code in the project and the UI is tangled within the logic making it difficult to separate the 2.

    I'm also removing the inventory slot logic and putting it into managers.
    Basically an inventory slot react differently depending where it is created from.
    For example right clicking a shop's inventory slot would buy an item while right clicking a character's inventory slot would consume that item.
    Now that managers will handle this, it will be much easier to create new behaviors such as a character, shop or chest manager.
     
  26. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Hello again!

    For my game, I will need to add another GameObject variable to the NextGear_DB_BaseEquipmentItem class. This would be very similar to the Attachment variable, where you can drag and drop the sword prefab on the item while it's showing in the Item Database.

    I would like to be able to drag/drop the desired GameObject prefab on to the item while it is showing in the Item Database.

    It appears I will need to add a new GameObject variable to the NextGear_DB_BaseEquipmentItem class as well as the NextGear_DB_BaseEqupimentItemInspector. Is there anything else that I will need to change for this? Does the serialization surrogate need to be changed as well?

    Any help or tips you can provide on adding a new GameObject variable to the NextGear_DB_BaseEquipmentItem would be very helpful!


    Thanks!
     
  27. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    you don't need to touch the serialization surrogate classes.
    You will need to update the NextGear_DB_BaseEquipmentItemInspector to display the new entry. with something like that :

    If this is the case then to make the item save the new field when you change it's value you will need to update the NextGear_DB_BaseEquipmentItemInspector class with something like that :

    Code (CSharp):
    1.  
    2. public static new void DisplayInfo(NextGear_DB_BaseItem item, NextGear_ItemDatabase db, NextGear_ItemDatabaseInspector itemDBInspector)
    3.     {
    4.         ShowBaseInfo(item, db, itemDBInspector);
    5.         ShowNewGameObjectVariable((NextGear_DB_BaseEquipmentItem)item, db);
    6.         ShowEquipmentInfo((NextGear_DB_BaseEquipmentItem)item, db);
    7.     }
    8.  
    9.     /// <summary>
    10.     /// Method to display the new gameObject entry
    11.     /// </summary>
    12.     /// <param name="item">Item.</param>
    13.     /// <param name="db">Db.</param>
    14.     protected static void ShowNewGameObjectVariable(NextGear_DB_BaseEquipmentItem item, NextGear_ItemDatabase db)
    15.     {
    16.         GameObject go = (GameObject)EditorGUILayout.ObjectField("New gameObject", item.myNewGameObjectField, typeof(GameObject), false);
    17.  
    18.         if (go != item.myNewGameObjectField)
    19.         {
    20.             item.myNewGameObjectField = go;
    21.            
    22.             EditorUtility.SetDirty(item);
    23.         }
    24.     }
    25. }
    26.  
    You'll also need to the DisplayInfo method in NextGear_DB_WeaponItemInspector class the same way.
     
  28. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Thanks for the quick reply!

    Can you show an example on how/where I would update the NextGear_DB_BaseEquipmentItemInspector class to display the new GameObject variable entry?

    Also, where should I add this new variable in the NextGear_DB_BaseEquipmentItem class? Do I just make the variable and that's it (i.e. 1 line of code)??

    Thanks again!
     
  29. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Just add the new variable at the top of the NextGear_DB_BaseEquipmentItem class like any other class fields.
    In my example, I added the line : public GameObject myNewGameObjectField;
    in the NextGear_DB_BaseEquipmentItem class.
    So just rename it to whatever variable name you wish.

    If you add the code to the NextGear_DB_BaseEquipmentItemInspector like in my example, the new variable will appear in the DatabaseInspector when you chose an equipment.
    In the future, I'll see if it's possible to add custom fields to an item just by adding a small script to an item type.

    Once I finished the new version, I'll start making a diagram to make an overview of what each class do.
     
    Last edited: Jan 28, 2015
  30. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    OK i understand now. Thanks again!
     
  31. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    You're welcome
     
  32. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Hello Again!


    I see there is a delegate in the NextGear_SetupCharacterStatsAndEquipment class called delegateCallAfterEquip.

    I have another script with a reference to the character's SetupCharactStatsAndEquipment.

    My script uses the delegate to see if the inventrory has changed.

    Is there a way for the delegate know whether the item is being removed or added to the inventory? Right now it executes when both removing and adding.
     
  33. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    In my script, i am executing this method with the delegate

    Code (CSharp):
    1. public void InventoryChanged(NextGear_InGame_BaseEquipmentItem item, int slotType, bool slotIsUnique, string slotUniqueName)
    2.     {
    3.         Debug.Log ("inventory changed");
    4.  
    5.         if(item==null)
    6.              Debug.Log ("item removed");
    7.  
    8.         else
    9.             Debug.Log ("item added");
    10.  
    11.     }
    When the item is null the item has been removed. But how can I know which item was removed?
     
  34. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Currently the delegate doesn't differentiate between equipping and unequipping items. I am looking at the code to see if it's currently possible to retrieve slots info, otherwise I might need to change the call to retrieve the slot being changed.

    Actually "slotType" do tell you what kind of item is being removed but if you have multiple slot of the same entry type(ex multiple ring slots) then it won't know exactly which slot has changed.

    you can find the slotType in the "editor">"Edit equipment skit list" window
    there the slotType is the ID

    I just tested some code to display which slot has changed.

    you can do that in the delegate

    Code (CSharp):
    1. public void InventoryChanged(NextGear_InGame_BaseEquipmentItem item, int slotType, bool slotIsUnique, string slotUniqueName)
    2. {
    3.    
    4.   int slotPositionInList = NextGear_SlotData.FindSlotPositionByID(slotType);
    5.   Debug.Log(NextGear_SlotData.Instance.SlotList[slotPositionInList].name);
    6.  
    7. }
    as for the item being removed, the "item" argument is what you are looking for.
     
    Last edited: Feb 5, 2015
  35. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    For me, it would be helpful to have two different delegates.

    One delegate is called when the item is added. The other when the item is removed.

    This way we will always know the item (never will be null) and whether it's being removed or added.

    Is there somewhere in CharSetupStatsAndEquipment that could execute a remove item delegate?
     
  36. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    In the CharSetupStatsAndEquipment look at the Equip method.
    This is where the delegate is being called from.
    You could add another delegate there to fit your need.

    just change the code to something like that :
    Code (CSharp):
    1. if (DoSomethingAfterEquip != null)
    2.         {
    3.             if (item != null)
    4.                 DoSomethingAfterEquip(item, slotType, slotIsUnique, slotUniqueName);
    5.             else
    6.                 UnequipDelegate(item, slotType, slotIsUnique, slotUniqueName);
    7.         }
     
    Last edited: Feb 5, 2015
  37. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19

    In the code above, the item will still be null when UnEquipDelegate is executed.

    I still won't know which item was removed.
     
  38. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    You'll have to modify the code slightly to get which item was removed then.
    edit the delegate like this :
    Code (CSharp):
    1. public delegate void delegateCallAfterEquip(NextGear_InGame_BaseEquipmentItem item, NextGear_InGame_BaseEquipmentItem removedItem, int slotType, bool slotIsUnique, string slotUniqueName);
    at the top of the equip method add this line :
    Code (CSharp):
    1. NextGear_InGame_BaseEquipmentItem removedItem = null;
    then a bit further in the equip method before the line
    if (item == null)
    {...
    add this code:
    Code (CSharp):
    1. removedItem = slotInfo.item;
    and of course at the end of the equip method, update the last line :
    Code (CSharp):
    1. DoSomethingAfterEquip(item, removedItem, slotType, slotIsUnique, slotUniqueName);
    Finally don't forget to update your delegate method like this :
    Code (CSharp):
    1. public void InventoryChanged(NextGear_InGame_BaseEquipmentItem item, NextGear_InGame_BaseEquipmentItem removedItem, int slotType, bool slotIsUnique, string slotUniqueName)
    2. {
    3.    
     
    Last edited: Feb 5, 2015
  39. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Yes, this works. The item (added and removed) is always available to the delegate now.

    Thanks for being available, and providing excellent support on this product!
     
  40. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    you're welcome. I enjoy helping and it help promoting the asset too.
     
  41. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Hello again!

    Currently, when you drag/drop an item out from the NextGear UI to the 3D environment, the item's 3D model (i.e. attachment) appears in the environment.

    Is it possible to change the place the item goes when dragged/dropped to the world?

    Instead of the item appearing in the 3D environment, it would be better for me if the item just went to an "Inventory Template" I have set up.

    I basically want items to stay in the NextGear UI at all times.
     
  42. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    I think I have figured it out.

    In the file clickEventFallThrough.cs you can comment out the code calling method "DropItemInScene()". This basically stops all drop capability outside the UI.
     
    Last edited: Feb 10, 2015
  43. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    You are right, the clickEventFallThrough.cs script contain the logic which decide where the item will appear in the world.

    Also if you select the "background UI block click through" GameObject, you'll see it has a script that forward the drop event to the main camera.
    if you remove that script, you can make a custom one that will put the item into your inventory template.

    There is also the script "NextGear_DropCanceler".
    If you put that script on the "background UI block click through" GameObject, the item will be put back in it's original slot.
     
  44. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    NextGear_DropCanceler does the job.

    I will figure out later how to force it to the inventory template on drop. Maybe I wont need to do that anymore..

    Thanks!
     
  45. docgonzzo

    docgonzzo

    Joined:
    Dec 10, 2013
    Posts:
    19
    Hello Again!

    I was wondering if you could recommend how to go about setting up pre-loaded inventories for prefab enemies...

    What I'm trying to do is setup some prefab enemies, each with a different set of items in their inventories. I would like the enemies to be instantiated at run-time, with these items.

    If I build an enemy in the scene, I can simply drag/drop items to the "Slot List" on NextGear_CharSetupStatsAneEquipments. Then, when I start the game, the items appear on the attachment points properly. However, if I now save that enemy as a prefab (i.e. save as prefab and delete from scene), the drag/drop associations are lost in the inspector.

    Ideally, the prefab enemies would equip their items immediately after instantiation, without involving the UI.

    The final goal is to move the items to a UIInventory representing the floor when the enemy dies.
     
  46. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    Hi, I've been looking into this problem and it seems it is a limitation of scriptableObject as they need to be saved to disc to be serialized.
    One way around it is to equip the prefab enemy with items then drag it into the scene, doing so let the gameObject keep the items.

    For the next update I will change all the NextGear_InGame scripts class to a monobehavior so that it should work properly in the future.
    I am currently rethinking how everything works to improve the inventory system and make it easier to expand and maintain so it is a good time for me to make such change to avoid this kind of problem.
    The update is quite a big change so it will take me a while to finish it.
     
  47. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    After further testing I noticed that once you close unity and reopen it, the prefab lose the connection to the items anyway so I wrote a new script to bypass that problem.
    This is only a temporary solution until I finish the new update but at least this will allow you to add items to your enemy prefabs.
    I Tried to upload the asset today but got a connection error. I'll try again later or tomorrow.
     
  48. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Zuru-sonaKitsune ,

    Any chance of making a uGUI compatible/functional version? NGUI does seem to be 'slipping away'?
     
  49. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    This is what I'm currently working on.
    Outside of health issues, the reason it's taking me quite a while to make it is because I'm using this update to completely rethink how everything works to make it easier to expand and to be compatible with multiple UI such as uGUI and NGUI.
     
  50. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Zuru-sonaKitsune ,

    Sorry to hear about the health and hope you're back on track soon.

    I think what you're saying sounds v promising.

    I'd started a few times to try and get my own inventory systems together because all the others aren't comprehensive enough or don't 'talk' well enough to things like Playmaker or aren't encrypted and so on.

    I suppose my wish list then for a new inventory system, aside from all the standard stuff, might include:-

    - item types, subtypes etc - add new ones
    - a system which 'understands' handedness of items;
    - parent item types used as templates for new items;
    - generating new items from parents/templates or otherwise easily and in runtime;
    - items also have unlimited additional properties with perhaps some basic ones as standard like slotsize, weight, etc;
    - purchase and sale prices and rarity scales;
    - items also have unlimited additional attribute fields which can be bools, ints, floats, strings, icons, texture3ds, gameobjects, sounds, effects etc;
    - requires, preferred, excluded, exclusive stats;
    - easy to construct multiple inventories, with tabs, scroll bars, multiple themes, easy to slot in ui to change themes;
    - support for recipes, ingredients, multiple craft systems;
    - spawning of items in containers, stashes, generally;
    - shops, merchants, banks, containers, and contained, locks, traps;
    - mount points - ability to easily and in runtime equip items not just to character/equipment sheets/ui but also to 3d human etc;
    - far more flexible equipment and character pages;
    - tooltips;
    - journals, log-books, log-ins, HUDs...

    ... Well, I can dream.... ;)

    If you do create something new, do post something here and elsewhere...