• 🏆 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...
Level 18
Joined
Feb 28, 2009
Messages
1,970
No. Everything is ok, I have reinstalled wc3 like week ago same with JNGP.

But if I press instantly esc after the loading to see the inventory, everything shows up correctly.
But do like that:
map loads- pick up like 2 potions to stack them- open inventory fast

EDIT: Works same with other items (there is no need to stack). If you haven`t opened inv before and fast after picking up any item you open it the icons are gone.
 
Level 14
Joined
Mar 30, 2009
Messages
971
i have the same bug as krisserz: when i run game (not from editor and unedited map) and press esc after picking something up then it is all white squares, no icons (i tryed that the time is something less than 10min gametime).

also it is problematic that when im in hero abilities (or spellbook) and press esc to exit it, then ofc the iventory starts (or closes).

and i accidentally rightcliked when in inventory mode, and the hero tryed to walk there and got killed by creeps. lol.
 
Where do I change the title of the multiboard?
CIItemBoard
JASS:
set .itemBoard.title = "CustomInventory [View Item]"

i have the same bug as krisserz: when i run game (not from editor and unedited map) and press esc after picking something up then it is all white squares, no icons (i tryed that the time is something less than 10min gametime).
I really can't imaging what is doing so?! :S


also it is problematic that when im in hero abilities (or spellbook) and press esc to exit it, then ofc the iventory starts (or closes).
YOu can remove it by disabling or removing
CWInventoryWindow

JASS:
call TriggerRegisterPlayerEvent(.CWIntCIFullTrig, Player(i), EVENT_PLAYER_END_CINEMATIC)

and i accidentally rightcliked when in inventory mode, and the hero tryed to walk there and got killed by creeps. lol.
Will create rightclick protection soon :p

I must get any program to make it :S At wc3 replay it lookes alright.
Use CamStudio. Its opensource and good.

But when in replay it looks alright, its definitely not my fault. But I will take a look at it nonetheless.

OKAY, I am getting to have an idea for the white bug.
Do you have a slow or medium pc? It may be that the pc doesn't initialize the values correctly (because of huge content to initialize at my inventory system)
 
Level 14
Joined
Mar 30, 2009
Messages
971
yea, i have a crappy pc.
have you played wow? i had my settings set to as low as possible (except resolution 1200x768 or what ever) and when it rained (or snowed) in the region i was in, then i would lose all ui. lol really similar actually, i would see white buttons instead of the icons when it lagged a little less. at worst case, i wouldnt see any ui at all.
imagine how bad pvp was for me xD, actually raiding ironforge while seeing NOTHING AT ALL wasnt good either. was heavy snow + really many ppl
 
People, all who have bugs please enable DEBUG mode.
(Open JNGP -> [JassHelper - Debug mode] - Save map again and try again)

And please tell me every error.

To make things clear: The trackable model is white!
This means, the destructable objects for the icons are NOT created. That could be because you have a too slow pc or your wc3 has different settings.
If 2nd, save again and test.
 
Level 18
Joined
Feb 28, 2009
Messages
1,970
OKAY, I am getting to have an idea for the white bug.
Do you have a slow or medium pc? It may be that the pc doesn't initialize the values correctly (because of huge content to initialize at my inventory system)
Umm, well. I don`t think I have such a crappy PC. It`s 3.2 GhZ 2gb RAM, GeForce 8400.
 
Level 2
Joined
May 8, 2009
Messages
10
The Inventory shakes very intenese, when i try to Scroll with the mouse.

PS: It looks really great Keep it up!
 
Level 14
Joined
Mar 30, 2009
Messages
971
People, all who have bugs please enable DEBUG mode.
(Open JNGP -> [JassHelper - Debug mode] - Save map again and try again)

And please tell me every error.

To make things clear: The trackable model is white!
This means, the destructable objects for the icons are NOT created. That could be because you have a too slow pc or your wc3 has different settings.
If 2nd, save again and test.

theres a slight issue that i still dont know how to use my JGNP. i got it working once, but not atm. (im not requesting help here and therefore being offtopic. since im too lazy person, then ill just let it go.)

but i think im gonna test it in multiplayer now (2 ppl)
 
found bug when u make pot to right place and later on use all of them the item still stays in ur inventory( system) and u cant move it nor use
Right place? Please elaborate.

looks nice, I can see this used in maps many times from now.
also, gratulations for your dc!
Thanks
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
The only backdraw of this system is the size of terrain it needs to use. You could have compressed the space a lot.

Also from when do DC's for triggers exist???

EDIT:

May i ask in what trigger do you create the unit? And why doesn't it work with preplaced units???

EDIT2:

The system bugged for some reason, refusing to give me description for 1 item no matter what i did(clicking/hovering over it):
 

Attachments

  • bug01.JPG
    bug01.JPG
    78.4 KB · Views: 152
The only backdraw of this system is the size of terrain it needs to use. You could have compressed the space a lot.
I guess 32*32 for an full mpi inventory system isn't much at all. There is no system that only needs one rect until yet.

May i ask in what trigger do you create the unit? And why doesn't it work with preplaced units???
Because I attach the units to the systems. You got to edit CWInventoryWindow and there is an set u = CreateUnit('hpal'..) stuff. That actually created the unit for all players and bind them to the system :p

Also from when do DC's for triggers exist???
From today on.

The system bugged for some reason, refusing to give me description for 1 item no matter what i did(clicking/hovering over it):
It does, just wait a small time after hovering.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Anachron, i waited 2 minutes straight now...the system still refused to equip/show info about the same item(claws) yet they are shown in the inventory :eek:

EDIT:

Tested it 3 more times and confirmed, 1 claws of attack are shown in the inventory but they aren't actually there when you hover/click/try to equip them.

I would advise you to check it out ASAP.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
I recreated the problem 4 times so far.

I can tell you exactly what i did:

Map start:
I pickup all consumables, the shaman claws, i open the inventory all is ok.
I pick up all the claws in the bottom area, open the inventory, hover around them and 1 is bugged, others not.

I think the UI has a flaw somewhere when linking to the data or vice versa, or there might be a minor bug somewhere.

Btw congrats.
 
I recreated the problem 4 times so far.

I can tell you exactly what i did:

Map start:
I pickup all consumables, the shaman claws, i open the inventory all is ok.
I pick up all the claws in the bottom area, open the inventory, hover around them and 1 is bugged, others not.

I think the UI has a flaw somewhere when linking to the data or vice versa, or there might be a minor bug somewhere.

Btw congrats.
Thats not a bug, the forging item just has no information attached to it. Basically because the new claws that has been created by forging does not have a name and such. (I forgot to add it)
 
Level 11
Joined
May 22, 2009
Messages
724
i meant u open the eq window u put ur health potion or mana in the place so u can have them in inentory
later on u use them in fight or smth
when u have 0 in the eq window u still have pot icon that cant be used or moved so its like stuck
 
Level 14
Joined
Mar 30, 2009
Messages
971
spamming the esc button makes it visible for me for a brief moment

if you are talking about the white icons bug, then i just tested, and found out that this is same for me.

i only get icons white when i pick an item up and open inventory before 10gameminutes has passed (the in game time, with the tiny clock and gnoll/rooster sound). if i just click the esc button really much then i can see for a sec the icons that are supposed to be instead of the white ones, including the items i have picked up.

and tested this bug in multiplayer (2). if only one player produces this bug (that is, picks item up after game start, presses esc) then both (all?) players have white icon bug :(
 
Level 8
Joined
May 30, 2009
Messages
266
it's kinda bad that i just screwed up everything here :p
but its not your system, just that jnpg update (to which this system kinda forced me anyway *cough*)
i was happy with it before, but now it seems like my map is lost forever :s


but what i can say is: i had the same bug as kingz
sometimes items randomly bug
mostly that head thing, whenever you pick up too many clawns power ups

gz to so much comments within a few hours :D
 
Here is the replay:
link

Hope it helps.

Also i put your map in the Maps/Downloads folder.

And my WC is on D:\Program Files\Warcraft\... if that matters.
I checked it and yeah, what the hell?
Did you press ESC at loading? Maybe the issue comes through there.

i meant u open the eq window u put ur health potion or mana in the place so u can have them in inentory
later on u use them in fight or smth
when u have 0 in the eq window u still have pot icon that cant be used or moved so its like stuck
Oh, I will check that too. Thanks.

if you are talking about the white icons bug, then i just tested, and found out that this is same for me.

i only get icons white when i pick an item up and open inventory before 10gameminutes has passed (the in game time, with the tiny clock and gnoll/rooster sound). if i just click the esc button really much then i can see for a sec the icons that are supposed to be instead of the white ones, including the items i have picked up.

and tested this bug in multiplayer (2). if only one player produces this bug (that is, picks item up after game start, presses esc) then both (all?) players have white icon bug :(
I don't really know what happens here. Tested everything with The_Reborn_Devil, and it works at it should.

THIS IS EPIC! Congratulations! You made it... it worth it :p
Thanks.

it's kinda bad that i just screwed up everything here :p
but its not your system, just that jnpg update (to which this system kinda forced me anyway *cough*)
i was happy with it before, but now it seems like my map is lost forever :s


but what i can say is: i had the same bug as kingz
sometimes items randomly bug
mostly that head thing, whenever you pick up too many clawns power ups

gz to so much comments within a few hours :D
Why is it lost?
And about the bug: I am checking it.

Comments are more a disease as fine ;D
 
I don't really know whats going on here, I see the normal inventory with all the stuff.

i meant u open the eq window u put ur health potion or mana in the place so u can have them in inentory
later on u use them in fight or smth
when u have 0 in the eq window u still have pot icon that cant be used or moved so its like stuck
I honestly tried to create the bug atleast 10 times, but there was no issue. The potion disappeared automatically.

I didn't press the ESC during loading, i pressed Enter :p

I only pressed ESC when the map loaded :O
What if you wait a second and then press enter?

Okay guys, I was able to recreate the CANNOT PICKUP BUG!
When you press ESC during loading, the inventory system gets fired. So please do not do that.

Okay guys, I also was able to recreate the POTION DOES NOT REMOVE BUG!
When you pick all stuff up and play around, the protection gets bugged. I am thinking about a fix.
 
Level 14
Joined
Mar 30, 2009
Messages
971
I don't really know what happens here. Tested everything with The_Reborn_Devil, and it works at it should.

were you able to reproduce the white icons bug? ill say once more that, you have to pick up any item and then open inventory really soon after game start. if you finish these actions after 10 game minutes (= 5 real seconds?) then it will not bug
 
The print say everything, and no, i don't touch esc in loading screen
were you able to reproduce the white icons bug? ill say once more that, you have to pick up any item and then open inventory really soon after game start. if you finish these actions after 10 game minutes (= 5 real seconds?) then it will not bug
Ofcourse, we did that instantly. I wasn't able to reproduce that bug. Maybe its a bug for initialisation.

i wonder why i was able to equip a clarity potion in my main hand :S
Hugh? THats new. Strange.
 
Top