Having a problem increasing number of equipment slots

Discussions, Solutions & How To with Inventory
User avatar
Adam
Site Admin
Posts: 106
Joined: 07 Aug 2009, 14:54
Location: London, UK
Contact:

Re: Having a problem increasing number of equipment slots

Postby Adam » 06 May 2011, 15:31

Here's a quick overview on "How to create new equipped slots":
http://www.youtube.com/watch?v=030KZKtbmBg

What this shows is:

Increase the "Equipment Slots" array.
Update the details for each new slot.
- Slot Name
- Slot Type
- Slot Icon
- Slot Position (which I may refactor to slow anchor in a future release)


If Slot Position is not updated, or is identical to another slot, only the last drawn slot will be visible, as it will be on top. Is may seem to be that new slots are not being created if the details are not updates, as all the new slots will draw one on top of the other, masking the other slots below. You can see this in the video when I update the new slot details but give the new slots the same new Slot Position.

If you need to have new Slot Types, you will need to edit InventoryManager.cs in your IDE. At the top of this script you will find:

Code: Select all

public enum SlotType {Head, Chest, Waist, Legs, Feet, Back, Neck, Hands, Ring, MainHand, OffHand, Bag, Empty}


This line of code may be edited to be any slot type you choose. This should propagate thru to the Inventory Items and the Inventory Item Editor as well. Please NOTE: I would suggest that you keep "Empty" as one of the SlotTypes.

Lastly, you will probably need to change the size of the "Character" window to accommodate an new icons. If the new icons are placed outside of the bounds of the "Character" window, they wont be visible.

Image Image

User avatar
Adam
Site Admin
Posts: 106
Joined: 07 Aug 2009, 14:54
Location: London, UK
Contact:

Re: Having a problem increasing number of equipment slots

Postby Adam » 06 May 2011, 15:43

Is this what you were needing?

If I've missed the point, let me know!

User avatar
Adam
Site Admin
Posts: 106
Joined: 07 Aug 2009, 14:54
Location: London, UK
Contact:

Re: Having a problem increasing number of equipment slots

Postby Adam » 06 May 2011, 19:43

Hard coded to 12? That shouldn't be true. If it is, it's an oversight...

- edit -

In Awake()?

I have:

Code: Select all

equipped = new List<InventoryItem>();
for (int i = 0; i < equipmentSlots.Length; i++) {
   equipped.Add(null);
}


Which should be based on what the developer puts in for the number of slots in the inspector...

If the package on the site has hard coded numbers, then I'm sorry... I'll double check that.

Could you look a the script and post the script name (just to be sure) and the line number where you changed 12 -> 24?

User avatar
Adam
Site Admin
Posts: 106
Joined: 07 Aug 2009, 14:54
Location: London, UK
Contact:

Re: Having a problem increasing number of equipment slots

Postby Adam » 06 May 2011, 19:59

You seem to be correct. The uploaded package seems to have:

Code: Select all

equipped = new List<InventoryItem>();
for (int k = 0; k < 12; k++) {
   equipped.Add(null);
}


This should be changed to:

Code: Select all

equipped = new List<InventoryItem>();
for (int i = 0; i < equipmentSlots.Length; i++) {
   equipped.Add(null);
}


And I will get a point upgrade up on the eStore asap so everyone can have the proper code, and to prevent the chance there is other stale or obsolete code in the current package.


Return to “Inventory (for Unity Gui)”

Who is online

Users browsing this forum: No registered users and 1 guest