• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJass] (System) CustomInventory

By far the biggest inventory system for Warcraft 3.
It's designed to have optional features, like FullScreenInventory-UI.

With a little bit of modification you can use this Inventory System in the normal Warcraft 3 Inventory too.

It is written in vJASS and has the following features:
- 12 Slot Equipment
- MPI
- Very flexible
- Easy to add bonuses to items
- Item Stacking
- Item Forging
- Item Sets (With bonuses)
- Inventory fixes warcraft 3 bugs (Double pickup bug)
- Fast
- Gives the ability to add your own areas with a little bit of code

A small note on the classes:

##############################################################################
# USER INTERFACE - CUSTOM WINDOW
##############################################################################
---------------
CWDestructable
---------------
It's an object that has an destructable for a local player.
(Such as icons, borders and more)

---------------
CWTrackable
---------------
This is basically an object that triggers player events for hovering the icons (CWDestructable).
Whenever an event occurs, it fires an action to the CustomWindow

---------------
CustomWindow
---------------
A collection of CWTrackable and CWDestructable. Every destructable will have an trackable object.
So whenever you hover over or click a trackable, this will be fired.
You will use this object to create hooks to the inventory system.

##############################################################################
# CUSTOM WINDOW - HOOK AND EXTENDING
##############################################################################

---------------
CIAll
---------------
This is a container object of items. It has conditions for pickup and drop and is the base
class for any container, like Slots, Potions, Equipment or even spell slots that you could create!
It has a variety of methods like adding, removing and checks and throws errors.

---------------
CIActions
---------------
This is a library which only use is to find out what the user wants to do. It supports up to 5
different steps which can be done in a row so if you need to build up something complicated here you go.
This action decides when to move, drop, pick and destroy items. It's bound to CIWindow and uses its
events to trigger / delegate events to the CISlots/CIEquips/CIPotions objects.

---------------
CIContent
---------------
This is a little help class for the CIActions object which puts a wrapper around the Equipment,
Potions and Slots. It will also update the camera.

---------------
CIWindow
---------------
This is the hook between CustomWindow, CIActions and the CustomInventory. It also provides
fake units to provide the Interface Functionality and delegates events to CIActions.

---------------
CISlots / CIEquips / CIPotions
---------------
The containers you see (Top left, top right and bottom left) are basically these objects.
They have special / unique conditions for pickup / drop and handle when to add or remove bonuses from the hero.

##############################################################################
# CUSTOM INVENTORY - CORE
##############################################################################

---------------
CIForging
---------------
This module forges items. You can combine any items and merge them to a bigger item. This will
always happen when your inventory updates.

---------------
CIStacking
---------------
You like items that can stack in your Inventory? Well this module is for you!
Create stackable items and make a maximum conditions. Item stacking is automatic, whenever
inventory updates.

---------------
CISet
---------------
Don't we all love this thing from World of Warcraft? Collecting items of a special set and
then get some bonus stuff once we have all of them. If you are cool, use this feature. It
even supports SET STACKING!

---------------
CIAttachment
---------------
Not done yet.

---------------
CIBonus
---------------
This is the hook between items and the unit state modifier library. You can use this module
to add and remove bonuses to the hero on the fly whenever needed.

---------------
CIError
---------------
Throw errors to the user whenever something bad happens.

---------------
CIEventHandler
---------------
Like every other Inventory system, we need some kind of hook for pickup/drop actions to
connect them with our CustomInventory. This will trigger the CustomInventory events.

---------------
CIEvents
---------------
Name may not be completely self-speaking, but this actually triggers the events on the item.
But only when the unit really has the item. (Safety layer)

---------------
CIItemDrop
---------------
This will allow pickup/drop actions of the items WITHOUT triggering the inventory events.
It will be required for many things so this module is a life safer!

---------------
CIItemInfo
---------------
Wouldn't it be cool if items could display what they are in a multiboard. Yes it would.
This module is exactly for that.

---------------
CIItemBoard
---------------
Yes, this is the multiboard which displays all the item statistics. It uses hooks to get
the attached events from the CUstomWindow.

---------------
CIItemProtection
---------------
Every item has states, like locked, owend, equiped and such. This module gives the ability
to change the states and make them available.

---------------
CIItemDest
---------------
Simple module for setting the destructable (icon) for the CustomWindow.

---------------
CIItemSeek
---------------
Module which is build to search and collect information about the inventory.
Find out how many items of which type you have that are not stacked, find out how many duplicated
items you have and even if you have errors in your inventory indexing.

---------------
CIItemSlot
---------------
Small module that adds classes to the items. You can only equip items with the right class
on the right positions.

---------------
CIItemEffect
---------------
This module allows to attach effects to an item wearer. Do whatever you want, but keep in mind
that one item has a maximum of 3 effects.

---------------
CIPowerup
---------------
Not done yet.

---------------
CISetup
---------------
Changes the area around the inventory to be black and create the UI for all players.


---------------
CustomItem
---------------
The item object itself. Will trigger and get triggered from all kind of sources.
Modules are completing the collection of members and methods.

---------------
CustomInventory
---------------
The main object. It forges, stacks, creates sets, triggers events, gets triggered and uses
optional modules to provide the full repository of features to the user.



-Fixed a bug found by Dr. Boom:
Dead units were able to change the inventory and caused bugs.
-Also added a little bit of documentation.


Keywords:
CustomInventory, Inventory, Custom, Anachron, FullScreen, Module, vJass, Stack, Forge, Combine, Set, Powerup, Drop, Equip, Equipment, Equip, System
Contents

CustomInventory - 0.2.2.6 (Map)

Reviews
18:27, 18th Feb 2010 The_Reborn_Devil: Ohsh- That describes pretty much what I'm thinking. My eyes were sore even before I was done reviewing half of the code. The code looks really good and I couldn't find just one little thing that would be...
Wohoo, 1k downloads this night. Thanks everyone for downloading.
You can tell me the idea here, you know.

Edit:
Attachment system. Does that mean attaching weapons and removing the original "Hammer" and giving a claw or what?
Wait, no, it will NOT remove the original hammer. The user will have to do it. Its impossible to do such things with triggers.
You will basically be able to attach anything on any position to the unit.
 
Level 13
Joined
Jun 9, 2009
Messages
1,129
Ok i will screen it and post here. It will look like man(background) and on that background paste inventory slots, on hand left of background paste inventory slot hand left etc...
Here is picture to get what im talking about : UI.JPG
But on this UI is double more inv slots. I think that you have get what im talking about?
 
Yes, but I don't like it, sorry.

Edit:
I was thinking about making a little information box for the hero where you can see
the actual stats of him, like +Dmg, +Armor etc.
(You will hover the hero in the inventory and you'll see the name, level, item bonuses and such)

To bad I can't get the basearmor, basedamage etc.

Anyway, what do you guys think about it?
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
Haha. Anachron you misunderstood me.
I saw the "He should update the UI instead of leaks" by Warcraft, and i wrote to him "He should fix the leaks" but i didn't see there were a whole new page.
And the "Slow here" means that somebody else had already wrote.
I will be testing the new UI for the first time NOW.
Sorry for making me not-understandable :)
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
OK. First time it worked great. 2nd time i got (several (minor)) bugs :

1. I clicked the "Clarity potion" in lower left corner, but it targetted the "Hood of epic awesomesauce" right to the right of it. (lol word mixup)

2. Clawns of attack. (Clowns of attack you mean?). Well the point is, you got a 'n' too much

3. The "Stat shower" (Upper right corner) were kind of slow to show the stats of the weapon i had my mouse on. Is this a coincedence, or do my computer suck?
 
1. I clicked the "Clarity potion" in lower left corner, but it targetted the "Hood of epic awesomesauce" right to the right of it. (lol word mixup)
I guess that is a tracking problem then, I'll check whether this is possible.
Maybe I have forgotten to change the trackables somewhere, I'll check that.
Bigger size > causing selection bugs) Please also make sure you select the images in the middle.

2. Clawns of attack. (Clowns of attack you mean?). Well the point is, you got a 'n' too much
I really suck at English.

3. The "Stat shower" (Upper right corner) were kind of slow to show the stats of the weapon i had my mouse on. Is this a coincedence, or do my computer suck?
It's normal, that's wc3.
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
I guess that is a tracking problem then, I'll check whether this is possible.
Maybe I have forgotten to change the trackables somewhere, I'll check that.
Bigger size > causing selection bugs) Please also make sure you select the images in the middle.


I really suck at English.


It's normal, that's wc3.

1st of all, you don't suck at english!
2nd WC3 really sucks that hard?
and how should i move it into the middle?? (The items) (and there is literally no chance of people knowing that without asking the author (you))
 
Level 14
Joined
Mar 30, 2009
Messages
971
okay i took some time to test the fsi again too.

- firstly, i found accidentally out that if you click esc excessively fast, then you get a minor bug: the hero (paladin) wont be auto-camera-centered any more if you exit the inventory. this bug lasts until i center the camera to paladin manually (double click on his portrait) or until i move camera with a click (to minimap).
- secondly you had a really minor typo: i think you should use abbreviation "agi" instead of "agy" for agility. this was in the attributes.
- would you mind reminding me again, what was the blue box for? the one next to drop and exit.
- you should implement this feature: when i have an item selected and click again on the same item (re-select it) then it would deselect the item.
- maybe you should make it so that i cant select empty slots: no item - no selection (yellow glow). or is that useful for some reason unknown to me? i have the feeling that it would look better when you cant select empty slots.

:)
 

- firstly, i found accidentally out that if you click esc excessively fast, then you get a minor bug: the hero (paladin) wont be auto-camera-centered any more if you exit the inventory. this bug lasts until i center the camera to paladin manually (double click on his portrait) or until i move camera with a click (to minimap).
I hate stupid users, anyway, I'll fix it by giving it a limit of opening/closing it once in 0,25 seconds. That should fix it.

- secondly you had a really minor typo: i think you should use abbreviation "agi" instead of "agy" for agility. this was in the attributes.
Aww, damn that.

- would you mind reminding me again, what was the blue box for? the one next to drop and exit.
To disselect item. Could be removed on...

- you should implement this feature: when i have an item selected and click again on the same item (re-select it) then it would deselect the item.
... this little idea. Thx.

- maybe you should make it so that i cant select empty slots: no item - no selection (yellow glow). or is that useful for some reason unknown to me? i have the feeling that it would look better when you cant select empty slots.
Well, I don't know. I can implement it. I will check it.

I am currently remaking the example and adding CISetup, a short library where you set up your values for your map so its a hell easier to implement.


#Update - 0.2.2


  • Huge code update.
  • CISetup has some really great settings for implementing the CI easy into your map.
  • Removed disselect button,.. Now you disselect when clicking on an item twice.
  • To many small fixes that I can list them here.
  • Only needs 1/4 of the area from the last UI.
 
Level 8
Joined
May 30, 2009
Messages
266
[*]CISetup has some really great settings for implementing the CI easy into your map.

[*]Removed disselect button,.. Now you disselect when clicking on an item twice.

yehaaw

EDIT

the trackables are not in the same spot as the doodad icons


it shows me actually the potion in the row below

and another thing: when i pick up all items and then go into inventory, it merges the potions upon opening (they take several slots for a very short moment) and leaves empty slots there (screenshot too)
 
Yes, I know that. It's a fail model edit.
I already asked some guys to fix it.

It's not my fault.

and another thing: when i pick up all items and then go into inventory, it merges the potions upon opening (they take several slots for a very short moment) and leaves empty slots there (screenshot too)
Yes, there is no way (good) to fix that.

Edit: Well there is, I'll check.
 
Level 14
Joined
Mar 30, 2009
Messages
971
yes it seemed to me too that 1)potions take longer to stack than before 2)UI takes slightly more (time) to display.

i am sure that:
1) this bug has returned (its one of those bugs that only shows on the first time playing the map on 1 w3 runtime - i.e. you cant reproduce the bug when you restart the map, you have to restart w3):
168864-albums3027-picture27473.jpg


2) i discovered 2 1 new bugs (not that they desperately need fix, but at least you know):
2.1) you can still get information from fsi when you havent opened it i.e when you hover the trackable while inventory is closed, you still see the multiboard + you can see the trackables laying on the ground in the fog. (in case you some1 didnt understand: i didnt open nor close the inventory recently(at least a minute))
168864-albums3027-picture27474.jpg

2.2) when you have moved your camera target to somewhere near the trackable area, then it doesnt return the camera to the hero.
wait a minute... that isnt a bug, thats a feature... lol sorry nvm this one ^^"

btw have you removed multiplayer atm? (or there never was that and i forgot).
anyway id like to test it in multiplayer (but im too lazy to edit the map myself every time you announce an update, or actually, every time i test the updated version)
 
1) this bug has returned (its one of those bugs that only shows on the first time playing the map on 1 w3 runtime - i.e. you cant reproduce the bug when you restart the map, you have to restart w3):
Its wc3, not my system.

you can still get information from fsi when you havent opened it i.e when you hover the trackable while inventory is closed, you still see the multiboard + you can see the trackables laying on the ground in the fog.
Yes, that's wanted. Users told me not to force the map boundaries to update.

This is NOT a bug.
But I'll disable multiboard displaying for non-active inventories anyway.

btw have you removed multiplayer atm? (or there never was that and i forgot).
anyway id like to test it in multiplayer (but im too lazy to edit the map myself every time you announce an update, or actually, every time i test the updated version)
You can easily make it multiplayer, I redid 40% of the CI actually,..
 
Level 14
Joined
Mar 30, 2009
Messages
971
Its wc3, not my system.
hmm at least it seemed to me that there was no bug like that at some point...
but i might confuse it to a second (3rd, 4th...) testrun (as this bug only shows at first test).

EDIT:
You can easily make it multiplayer, I redid 40% of the CI actually,..
actually i only meant the paladin spawn. since i just played it in multiplayer, but only p1 red had a unit (and therefore a inventory).
 
actually i only meant the paladin spawn. since i just played it in multiplayer, but only p1 red had a unit (and therefore a inventory).
Yes, I only added the paladin for the first player.
Anyway, I will fix this now.

#Update - 0.2.2.1

  • You can't change inventory stuff during normal gameplay, even when you see it.
  • Multiplayer test are available again.
 
Level 14
Joined
Mar 30, 2009
Messages
971
i tested multiplayer too and sorry, but i cant say without flaws. :(

as a minor bug: the paladin image-model-thing flickers for all players (when they have their inventories opened ofc) when a player closes or opens his/her inventory. the borders show this tendency too.


as a major bug: when several players (in this case 2) try to pick up same item then one of them gets an item into inventory that doesnt really exist - it shows icon, has no description, can be dropped, cannot be equipped or used.
we didnt plan this bug (timing and targeting), but simply as we picked up the items from the ground at the beginning of the game (not 0.1 seconds after start, normal pick up), we occasionally happened to click the same items. at least on one testrun we kinda rushed to pick up the items. generally we got about an average of 2 cloned items: one player would have the real thing and the other one the clone (which has the flaws mentioned before). when the clone was dropped it couldnt be picked up at first try (by the carrier of real item)* but would vanish on the second pick up (maybe it merged with the real item?).

* i think it might be connected to the former bug of picking up items too fast maybe. it displayed the same error message "cant pick this up you already have this item" or whatever it was :).
also when 2 players pick items up at fairly normal pace, then the total sum at which the system registers the pick up event equals to too fast pickup. and thats why it bugs. imo.
call EndWallOfText() :p
 

as a major bug: when several players (in this case 2) try to pick up same item then one of them gets an item into inventory that doesnt really exist - it shows icon, has no description, can be dropped, cannot be equipped or used.
What, how did you manage that?

* i think it might be connected to the former bug of picking up items too fast maybe. it displayed the same error message "cant pick this up you already have this item" or whatever it was :).
also when 2 players pick items up at fairly normal pace, then the total sum at which the system registers the pick up event equals to too fast pickup. and thats why it bugs. imo.
Hmmm.. I have tested it, and we hadn't such flaws, we even tried picking the same item on the same time.

It's nearly impossible that you can still pickup when you have the item.
Besides, it's not a new bug.

I did not change the general working of the systems.


#Update 0.2.2.2

  • You shouldn't be able to add one items to two inventories at the same time anymore.
 
Top