• 🏆 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 14
Joined
Apr 20, 2009
Messages
1,543
You need the latest JNGP and JassHelper version. You aved with the wrong version, so it did break your map.

I now have it, but why does it still happen then :S I open the editor, I can test the game ones.. and after that I can't test the map anymore untill I reopen JNGP :S And this time.. for any map I open :p (I have JNGP 5d and JassHelper 0.A.2.B)

also.. when I pasted your code into my map and saved it the map didnt create the bonus ability's for some reason >< Does this mean I have to create them manually?

private constant boolean PRELOAD_ABILITIES = true
so that can't be the problem can it :S?

now I get this message everytime I test the map because the bonus abillity's don't exist (I think)
And no I haven't got any abillity's with the same raw code as the map should create for the bonus ability's:
AbilityPreload error: Attempted to preload a non-existent ability


sry if I'm a bit of a noob :S I haven't done jass in over 1 and a half year and don't know vJass that well :p
 
I now have it, but why does it still happen then :S I open the editor, I can test the game ones.. and after that I can't test the map anymore untill I reopen JNGP :S And this time.. for any map I open :p (I have JNGP 5d and JassHelper 0.A.2.B)
Check if the settings are the same like the tutorial in my signature.
It seems for me that you disabled vJass.

also.. when I pasted your code into my map and saved it the map didnt create the bonus ability's for some reason >< Does this mean I have to create them manually?
Check out CISetup and then there is a constant like HAVING_NEW_MAP and set it to true so it will generate the data you will need. Also check BonusMod and uncomment the textmacro thing.

private constant boolean PRELOAD_ABILITIES = true
so that can't be the problem can it :S?
now I get this message everytime I test the map because the bonus abillity's don't exist (I think)
And no I haven't got any abillity's with the same raw code as the map should create for the bonus ability's:
AbilityPreload error: Attempted to preload a non-existent ability
That has nothing to do with it.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Check if the settings are the same like the tutorial in my signature.
It seems for me that you disabled vJass.

yes the settings are the same :S It's quite strange ><
EDIT: it seems that the problem has solved itself :S All of a sudden it started to work normal 0.o

Check out CISetup and then there is a constant like HAVING_NEW_MAP and set it to true so it will generate the data you will need. Also check BonusMod and uncomment the textmacro thing.

ok thanks I will do that and check if it works :)
EDIT: hmm it seems that the destructibles aren't created even though this has been set to true :S Ow well I imported all the destructibles from your map so this isn't much of a big deal :)

That has nothing to do with it.
thanks I realized that after a while.. I was looking at the comment beneath that peace of code but that was supposed to be for the textmacro, so I changed that and it worked thnx :)
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
I'm verry happy with the way it works :)

I still have a few questions though...
This is MUI right? There's 1 thing that has been bothering me...
Whenever 2 players are playing a game online. If they both press escape won't that make another inventory above the original inventory of someone else? Will that cause trouble? Or is everything client sided including the character model in the middle of your inventory screen? Or do I have to create different parts on my map where people can see their inventory's?

Also: is it possible to recreate the inventory every time you press escape? Or press the cancle button so it gets destroyed?
A reason why I want to do this is because you can still see the destructibles lying around if you go to that part of the map...

Example:
 

Attachments

  • inventory system problem.JPG
    inventory system problem.JPG
    74.1 KB · Views: 73
Whenever 2 players are playing a game online. If they both press escape won't that make another inventory above the original inventory of someone else? Will that cause trouble? Or is everything client sided including the character model in the middle of your inventory screen? Or do I have to create different parts on my map where people can see their inventory's?
It's MPI = Multi player instanceable. And no, this will not overlap. All players use the same area without interfering.

Also: is it possible to recreate the inventory every time you press escape? Or press the cancle button so it gets destroyed?
A reason why I want to do this is because you can still see the destructibles lying around if you go to that part of the map...
Would be possible, but it would be awkward. I would just create a fog that is black and where you can't see anything. That would make the inventory unnoticeable in the map :p
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
It's MPI = Multi player instanceable. And no, this will not overlap. All players use the same area without interfering.

MPI that's the word I was looking for xD Haven't done any map editing in a long time. Thought it was Multi User Instanceable xD For the answer: That sounds incredibly nice :)

Would be possible, but it would be awkward. I would just create a fog that is black and where you can't see anything. That would make the inventory unnoticeable in the map :p
and whenever I create this black fog it wouldn't overlap the inventory system when it is activated by pressing escape? or where you talking about creating a fog after someone has been to the inventory and remove that fog when that player presses esc again?

eather way this solution sounds perfect for me :)
thanks ones again :D
 
and whenever I create this black fog it wouldn't overlap the inventory system when it is activated by pressing escape? or where you talking about creating a fog after someone has been to the inventory and remove that fog when that player presses esc again?

eather way this solution sounds perfect for me :)
thanks ones again :D
I didn't notice, I could do it as well for the system.

I will check if I can make it work so you'll not have to make it yourself.
I am already working on the new version.
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
It's Vuen's D&D, which has 3 DMs and 7 hero players. The DMs can spawn just about anything for anyone. Basically it's like a make-it-while-in-the-game RPG, emphasis on roleplay (Like SotDRP).

Anyways, the DMs control red and yellow mainly. If they can't see the screen when they change red and yellow's inventories for the bajillion heroes they make for them, there's no point.
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
Let's do it!
(Me too.)
i_ /-\ S ^I^ ^I^ () R R 3 |\| ^I^ S [dot] C () |V|

you illegal bastard. You will loose the entire online gaming experience, and that is going to make the game boring... I cant understand that you do not even want to buy starcraft II.. if you dont want to buy it, why would you want it at all? It is not like starcraft II is the most expensive thing in the world.
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
Galaxy Editor? >.>

I am a single player fanatic and why am I an illegal bastard?
Wait, the law says I am not a bastard so that counts.

Don't tell me every byte in your hard drive is legally written, because that's a lie.

I hope I get this country fucked up, but even the government uses illegal software, so what's the population going to do?

PLUS
When and where do you think I can buy that game in this craphole? :eekani:
Probably in 2012, but I want it earlier.

Edit:
http://www.realinromania-blog.com/a...estate-market-will-continue-dropping-as-well/
That's why noone buys anything.
 
Level 17
Joined
Jun 9, 2007
Messages
2,493
Galaxy Editor? >.>

I am a single player fanatic and why am I an illegal bastard?
Wait, the law says I am not a bastard so that counts.

Don't tell me every byte in your hard drive is legally written, because that's a lie.

I hope I get this country fucked up, but even the government uses illegal software, so what's the population going to do?

PLUS
When and where do you think I can buy that game in this craphole? :eekani:
Probably in 2012, but I want it earlier.

Edit:
http://www.realinromania-blog.com/a...estate-market-will-continue-dropping-as-well/
That's why noone buys anything.

I really do not have anything illegal on my computer as of now. I got a new one about 2 months ago, so i do not really lie.
And why do you have to mention the government and all that shit..
All i am saying is that you are illegal. And you dont seem to care even a tiny bit about anything. You have spended alot of time with warcraft III, and it is a great game, and starcraft II will probably be alot better, and you do not give a damn... And it even seems like you want people to be illegal as you mention torrents and all that..
If you are doing illegal stuff, you do not have to make others do so aswell...

And Blizzard is known for selling their games on THE INTERNET, so it wont make any difference where you live if you buy on internet, like i do.

And do not talk about money like that.. In sweden the cost of 1 game equals about 1 and a half game in for example USA. So in the long run i loose a hell of alot of money by buying games in my country. And still i have about 200 games in my living room for sure, where more then 50 of them is for ps1, and back then they were quite expensive.

You make it sound like you cant buy anything in your country, but there is many countries that have other problems.
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
You have (/had) money, I (we) don't (and won't for the next years).
That's the rule.

And hey, if it will be better doesn't mean I have to pay for it.

Wow is awesome, and it's free. (to download and play on private servers)

But my favorite game is Universe at War and I paid for it. (Still playing it)

About blizz... They make good games, I can't deny that. Their programmers and artists are paid very well... A lot of money. I know people that work 10 times harder (and do a good job) that are paid 10 times less. Is that fair?

We should move this discussion somewhere else or stop it.
 
Top