• 🏆 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...
Level 21
Joined
Dec 9, 2007
Messages
3,096
Done... I cannot test it now, so we'll need someone with the bug!
Take the .mdx file and import it in your map.
Take the .tga file and import it with the following path:
" Textures/ARGB-1x255x255x255.tga "
(without spaces)

I hope it works! Else I will get emo...
 

Attachments

  • ARGB-1x255x255x255.tga
    23 bytes · Views: 70
  • IconBase.mdx
    2.4 KB · Views: 67
Level 21
Joined
Dec 9, 2007
Messages
3,096
I will use images for my system.
:smile:
They might use much more memory but you will never use a thousand images...
Textsplats... They don't lag, even when you move them! (This means re-creating them every period of time!)
255 characters in one textsplat... low velocity, set the interval to 0.01
No lag with 1.80 GHz and 1023 MB RAM.
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
Systems.
Basic interfaces made of images.
They require something...
Spellbook, talent tree, npc interaction, inventory&equipment, social status and more.

The_Witcher is taking care of the interface system. I am taking care of the virtual-level calculations, structs... Things that are not directly shown in the game.
 
Level 7
Joined
Dec 3, 2006
Messages
339
Just a random thought. Maybe it has something to do with changing Fixed Rotation (set in the object editor) by setting the rotation via triggers? That would maybe mean more refresh time.

As far as the bug with the fog from clock time, just add on Fog Visibility-True and some value for the radius and I think there might be no more weird fog at the bottom during daytime/nighttime shift.

I still can't get the white icon bug to appear. The problem with picking up items too fast and forming a weird forged item still occurs though. And not only does it still occur it also has the weird thing where whatever item is in the first slot disappears till you re-open the inventory when you try to move the bugged forged item.
 
I still can't get the white icon bug to appear. The problem with picking up items too fast and forming a weird forged item still occurs though. And not only does it still occur it also has the weird thing where whatever item is in the first slot disappears till you re-open the inventory when you try to move the bugged forged item.
*
That's not weird. Its basically because the inventory is protecting the items and never freeing them. (Because they are used again before freeing)
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
I took a very close look at the system.
My opinion is that your functions and methods are too complicated.
You need to generalize a lot of stuff and completly separate the inventory module from the actual interface module.
The interface should get and send feeds from and to the inventory.
Now they are bound to each other.
That is a weakness.

That's just my advice.
 
I took a very close look at the system.
My opinion is that your functions and methods are too complicated.
You need to generalize a lot of stuff and completly separate the inventory module from the actual interface module.
The interface should get and send feeds from and to the inventory.
Now they are bound to each other.
That is a weakness.

That's just my advice.
Excuse me, it already is?!

Check out:
All stuff bound to the interface is called CW, while the inventory is called CI.
CW = The interface, meaning the interface action, buttons and such.

The CI librarys are the core, which has the functionality, but is called by CW.
 
Believe me, I spend a lot of time grouping library and actions into the correct container.
If you get handy with CustomInventory, you'll see why and how I managed it.
And I think you'll like it.

Btw, I only insect once, in CustomInventory library there is a method to the CWWindow, else there are only links between the UI and the CustomInventory, not the other way around.
 
What karland said, I already had it like that, but TriggerHappy and I weren't that glad of the fact that you have to CnP all that stuff.

Also its NOT possible to load ANY inventory data BEFORE map initialisation, because on map initialisation I initialize my system. After that its possible to save / load anything from my inventory system.

(I also mentioned somewhere that I was going to do a save/load system for my inventory)
 
Level 12
Joined
May 21, 2009
Messages
994
What karland said, I already had it like that, but TriggerHappy and I weren't that glad of the fact that you have to CnP all that stuff.

Have you updated the system so the borders generate itself instead of that it is already made in the editor?

Also its NOT possible to load ANY inventory data BEFORE map initialisation, because on map initialisation I initialize my system. After that its possible to save / load anything from my inventory system.

Ofc not. =)

(I also mentioned somewhere that I was going to do a save/load system for my inventory)

Yes you did, just can't remember where though. I don't want to look though 300 posts.
 
Have you updated the system so the borders generate itself instead of that it is already made in the editor?
Yes, the object editor objects automatically generate themself on save aswell as the borders on map start.

Yes you did, just can't remember where though. I don't want to look though 300 posts.
I think it was somewhere in the Diablo III Warcraft thread, lol.

I mean, would it get the data from the destructable just if i place it manually?
Creating the destructables manually would not get the data. How should it?
 
Maybe you could implement a small module that checks which destructable (which i had)

I just say that would make it abit easier to test stuff and so on, oh well,

Hero give item (item)

would work well enough
Excuse me? How the hell should the system know which destructables belongs to what?
I will never support anything like that, since its automatically generated on map initialisation, no need for user placement.
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
Maybe im outdated now, i just looked like the posts fast becouse i do not have much time, but you guys said that the problem was that the models didnt load the textures, making them appear white.
That is wrong. I have the white slot problem myself, and if i scroll, the buttons will start to flash and you will see what is in the slot, so that means that it is loaded.
 
Level 3
Joined
Dec 23, 2009
Messages
32
When I test my map after CnP everything into my map it starts and an error comes up telling me ''Warcraft 3 has stoped working''
What should I do? I really want a FSI :S
Edit: It also happens when I do it on test map!
 
Top