• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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...
That's bad. Would I be like that every day we wouldn't even see a beta of this system yet.

Edit:
Well, here is the todo-list for the new version:
  • Check whether the to fast picking up bug has been encountered and fix all the places that had to do with it.
  • Display the action that you can do when hovering inventory icons that are not belongting to any items
  • Create the attachment system

The other things will be done in later versions.
 
Basically you are able to apply effects on several attachment points of the units.
About the animation: Well, I could get problems with overlapping animations.

So if you for example have item 1 with animation X, and take item 2 with animation Y, when I remove item X it's shit to reset the animation.

I would limit the animations displayed by hero to 1 and overwrite them if you are fine with that?!
 
Level 16
Joined
Oct 17, 2009
Messages
1,580
Hey it worked tnx a lot


hey sorry to bother you but i've got another problem(i'm really sorry) when i tested it on a very huge map it kinda turned out to be very small in the mini map and everytime i open the inventory i can't see anything just black, plain black pls help

__________________
Current Projects:
Scarlet ORPG ep1: Journey to Hell
dragon_hurlant_by_rinpoo_chuang.jpg
<---- Kinda Big don't you think
 
Last edited by a moderator:
i don't get it, how do i set the location of the inventory and how do i know if its correctly placed?
CWInventoryWindow ->

JASS:
            local real centX = dist2destdist(0.)
            local real centY = dist2destdist(2816.)
These are the X and Y coordinates of the UI centered location.

#Update - 0.2.0.5

  • Important indexing fix of items. Now the 'Already have item' bug can again appear, but shouldn't matter on next pickup. This is due wc3, I will check if I can get an workaround.
 
Last edited:
Level 5
Joined
Mar 11, 2006
Messages
89
This truly is a ground breaking system that you are offering to the warcraft III community. RPG makers can only dream of fully utilizing a system such as this one. However, the problem is that they can only dream. As amazing as this system is, no current save and load system is compatible with saving the items in the breathtaking system that you have created. Thus, no RPG can utilize this system if they choose to have save and load features. Moreover, as amazing as this system is, currently, it is completely useless for RPGs. The only game type that I see this system fit for the moment is Angel Arena or Dota.
The system itself is a 5/5, however, it lacks the ability to be usefully applied to a variety of game types. Since you claim that this is for RPGs, I would have to rate its usefulness towards that purpose as a 1/5. However, I will NOT vote until you have completed this system. So please, for your final version, create a compatible save and load feature with heros and items, otherwise, I will have to vote low on this system.
Yes, my expectations may be high, but if you present a system for the purpose of RPGs you have to complete it and ensure that it works for those game types. You obviously spent lots of time on this system, but it would be a big waste if people cannot even use it.

Sincerely,

Topdog-160
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
This truly is a ground breaking system that you are offering to the warcraft III community. RPG makers can only dream of fully utilizing a system such as this one. However, the problem is that they can only dream. As amazing as this system is, no current save and load system is compatible with saving the items in the breathtaking system that you have created. Thus, no RPG can utilize this system if they choose to have save and load features. Moreover, as amazing as this system is, currently, it is completely useless for RPGs. The only game type that I see this system fit for the moment is Angel Arena or Dota.
The system itself is a 5/5, however, it lacks the ability to be usefully applied to a variety of game types. Since you claim that this is for RPGs, I would have to rate its usefulness towards that purpose as a 1/5. However, I will NOT vote until you have completed this system. So please, for your final version, create a compatible save and load feature with heros and items, otherwise, I will have to vote low on this system.
Yes, my expectations may be high, but if you present a system for the purpose of RPGs you have to complete it and ensure that it works for those game types. You obviously spent lots of time on this system, but it would be a big waste if people cannot even use it.

Sincerely,

Topdog-160

1/5 becouse of no save/load? ugh.
This system was created for a RPG without the save/load ability. (diablo 3 warcraft).
Also, only becouse there is no save/load systems released for this, does not mean that no one is able to do it? It would be like any other save load system but insted of making use of the standard inventory, they create it to work with the custom inventory.
But ofc, if you do not have the skills yourself to create any save/load system, then it will be hard to do one for this, but if you can make a normal one, you will probably be able to do one for this aswell.

Just so you know that it is possible to use a save/load function for this, but anachron did not create one to come with this system becouse most people want to have their own save/load codes in their maps anyway.

So:
You should not vote depending on if there is a save/load function or not, becouse it must not be used in a rpg, and anyone with the experience can create a save/load system for this. Anachron is creating the inventory, not a fully complete and ready to go system for any rpg.

Maybe he will create one, but i doubt it... Maybe as an addon i guess.
 
As amazing as this system is, no current save and load system is compatible with saving the items in the breathtaking system that you have created.
It is?
You just need to use
JASS:
inventoryObj.getItem(i)
and iterate through all items. Then you get the handle of the item with
JASS:
inventoryObj.getItem(i).getHandle()
And because you want to save the itemtype you use
JASS:
GetItemTypeId(inventoryObj.getItem(i).getHandle())
And voila, you have the itemtype of item i.

by the way, to get the inventory of an unit, use
JASS:
local CustomInventory ci = CustomInventory.load(GetHandleId(unit))
(unit = the unit you want its inventory to be saved)
This can be used with ANY regular save/load system that is out.

If you want to load the items, simple create the items with the type you just saved and give them to your hero. That's it.

Basically I wanted to write my own save&load system, but the others also work well.
 
Level 12
Joined
Feb 11, 2008
Messages
809
CWInventoryWindow ->

JASS:
            local real centX = dist2destdist(0.)
            local real centY = dist2destdist(2816.)
These are the X and Y coordinates of the UI centered location.

#Update - 0.2.0.5

  • Important indexing fix of items. Now the 'Already have item' bug can again appear, but shouldn't matter on next pickup. This is due wc3, I will check if I can get an workaround.

Dude..... ITS BACK! -you already have item in inventory......
 

Attachments

  • Error.JPG
    Error.JPG
    64.8 KB · Views: 59
  • Error1.JPG
    Error1.JPG
    65.6 KB · Views: 60
Level 14
Joined
Mar 30, 2009
Messages
971
@Topdog-160: i have an rpg project in progress and i will use this inventory system without a save/load system. there are plenty of other rpg-makers who decide not to include a save/load system, so this is for rpgs. and if you had read the posts in this thread, then you would have known that Anachron has said that he will write a save/load system when other, more important, things are done.
 
Top