System Basic 12 Slots Inventory System

Leazy

You can change this now in User CP.
Reaction score
50
Hello!

Here is my 12 slots inventory system. It's very basic (even though, I added a lot of comments to help you if your completely new to the editor), use a skill, then all items you wear is stored into a variable, new items (if you carry any at this item page) is created and given to you. This system is MPI.

Triggers:
Code:
Inventory System
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Ability being cast) Equal to Inventory Page: 1 
                (Ability being cast) Equal to Inventory Page: 2 
    Actions
        Trigger - Turn off Item Stacking System <gen>
        -------- Above: Only add this line to your trigger if your using a item stacking system. --------
        -------- -------------------- Use Bag One Skill -------------------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Ability being cast) Equal to Inventory Page: 1 
            Then - Actions
                Unit - Remove Inventory Page: 1  from (Triggering unit)
                Unit - Add Inventory Page: 2  to (Triggering unit)
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Set InventorySystem_Integer = ((Integer A) + ((Player number of (Owner of (Triggering unit))) x 20))
                        -------- In the line above we set the number of the inventory slot which we will be working with. --------
                        Set InventorySystem_BagTwoItems[InventorySystem_Integer] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the item carried in slot integer A, so we can create it later when using bag page two. I set the variable to integer A + Player number x 20 so it won't get bugged when playing with more than one player. --------
                        Set InventorySystem_BagOneCharges[InventorySystem_Integer] = (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the charges remaining of the item, so it won't be everlasting if you keep changing back and forward between the inventories. --------
                        Set InventorySystem_BagOneCustomVa[InventorySystem_Integer] = (Custom value of (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the custom value of the item, since some maps set custom values of items to work with their triggers. --------
                        Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
                        -------- In the line above we remove the item in slot integer A. --------
                        Hero - Create InventorySystem_BagOneItems[InventorySystem_Integer] and give it to (Triggering unit)
                        -------- In the line above we create the items that we stored when switching from page one to page two. --------
                        Item - Set charges remaining in (Last created item) to InventorySystem_BagTwoCharges[InventorySystem_Integer]
                        -------- In the line above we set the charges remaining of the new item to the amount we stored before switching inventory. --------
                        Item - Set the custom value of (Last created item) to InventorySystem_BagTwoCustomVa[InventorySystem_Integer]
                        -------- In the line above we set the custom value of the item to the value we stored before switching inventory. --------
            Else - Actions
        -------- -------------------- Use Bag Two Skill -------------------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Ability being cast) Equal to Inventory Page: 2 
            Then - Actions
                Unit - Remove Inventory Page: 2  from (Triggering unit)
                Unit - Add Inventory Page: 1  to (Triggering unit)
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Set InventorySystem_Integer = ((Integer A) + ((Player number of (Owner of (Triggering unit))) x 20))
                        -------- In the line above we set the number of the inventory slot which we will be working with. --------
                        Set InventorySystem_BagOneItems[InventorySystem_Integer] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the item carried in slot integer A, so we can create it later when using bag page one. I set the variable to integer A + Player number x 20 so it won't get bugged when playing with more than one player. --------
                        Set InventorySystem_BagTwoCharges[InventorySystem_Integer] = (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the charges remaining of the item, so it won't be everlasting if you keep changing back and forward between the inventories. --------
                        Set InventorySystem_BagTwoCustomVa[InventorySystem_Integer] = (Custom value of (Item carried by (Triggering unit) in slot (Integer A)))
                        -------- In the line above we store the custom value of the item, since some maps set custom values of items to work with their triggers. --------
                        Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
                        -------- In the line above we remove the item in slot integer A. --------
                        Hero - Create InventorySystem_BagTwoItems[InventorySystem_Integer] and give it to (Triggering unit)
                        -------- In the line above we create the items that we stored when switching from page two to page one. --------
                        Item - Set charges remaining in (Last created item) to InventorySystem_BagOneCharges[InventorySystem_Integer]
                        -------- In the line above we set the charges remaining of the new item to the amount we stored before switching inventory. --------
                        Item - Set the custom value of (Last created item) to InventorySystem_BagOneCustomVa[InventorySystem_Integer]
                        -------- In the line above we set the custom value of the item to the value we stored before switching inventory. --------
            Else - Actions
        Trigger - Turn on Item Stacking System <gen>
        -------- Above: Only add this line to your trigger if your using a item stacking system. --------

I hope this system has not been made like a million times :p Enjoy!



Changelog
#Made this system work proper with charged items.
#This system now stores custom values.
#Made the system more user-friendly
 

Attachments

  • 12 Slots Inventory System.w3x
    24.4 KB · Views: 325

gameman

It's been a long, long time.
Reaction score
96
What about aura items? are you going to allow the aura's to work when there in "bag 2"?
 

CysticCraze

New Member
Reaction score
12
Auras as in "+damage" Or auras as in "Increases attack speed of all units"? I mean i assume your reffering to the second. But in my opinion being able to carry a bag around and then in a sense equip your items is pretty kewl in itself, kinda liek you have 8 items pick which 5 to use, the other 3 are stored for future use. Ill try this later man seems kewl and simple.
 

gameman

It's been a long, long time.
Reaction score
96
It removes the items and stores them into a variable, and it removes the items effects.
 

Leazy

You can change this now in User CP.
Reaction score
50
Yeah, no items will work if you don't have them in the current bag. This is for example, if your making an RPG and your a tank. Then, you can have your tank equipment in bag one and damage dealing equipment in bag two. Even if the map is not an RPG, you could still use it for example keeping potions in one bag.
 

Romek

Super Moderator
Reaction score
963
I think this should be a snippet, not a system.
There have also been much better systems, similar to this made before. :p
 

Leazy

You can change this now in User CP.
Reaction score
50
I think this should be a snippet, not a system.
There have also been much better systems, similar to this made before. :p

Well, yeah maybe it should be a snippet, I was not certain so I made it a system. Well, of course there is better systems, but I doubt any of those are as simple as this is, even if you started with the editor yesterday you should be able to copy this one.
 

Romek

Super Moderator
Reaction score
963
Well, yeah maybe it should be a snippet, I was not certain so I made it a system. Well, of course there is better systems, but I doubt any of those are as simple as this is, even if you started with the editor yesterday you should be able to copy this one.
It's actually easier to copy JASS triggers into maps, than GUI triggers.
Just Copy and paste. (No need to open the map).
With GUI, you either spend ages trying to make it, or you have to open the map and CnP the triggers.
 

Leazy

You can change this now in User CP.
Reaction score
50
It's actually easier to copy JASS triggers into maps, than GUI triggers.
Just Copy and paste. (No need to open the map).
With GUI, you either spend ages trying to make it, or you have to open the map and CnP the triggers.

Of course it's easier, but what about if you want to change something? Then you have to ask in the JASS forums each time you want to change something. For example, maybe someone just want potions to be stored in one bag, then this system allows you to change that easy. Other systems might be better, but I don't understand what could be better in a system that is like this (allows you to change between two inventories). Could you link me some of those so I could look and learn?
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
What if there are charges on the items?
Like, say, Wand of Illusions?

If you do it this way, you'll have infinite amount of them :eek:
 

Leazy

You can change this now in User CP.
Reaction score
50
What if there are charges on the items?
Like, say, Wand of Illusions?

If you do it this way, you'll have infinite amount of them :eek:

Great point!

I'll fix that right away, +rep for noticing this :)

Edit: I'll fix it later, gotta do some things now :)
 

Romek

Super Moderator
Reaction score
963
Of course it's easier, but what about if you want to change something? Then you have to ask in the JASS forums each time you want to change something. For example, maybe someone just want potions to be stored in one bag, then this system allows you to change that easy. Other systems might be better, but I don't understand what could be better in a system that is like this (allows you to change between two inventories). Could you link me some of those so I could look and learn?

Hardly.
There is no easy way of changing that in this snippet either. The user would probably have to write more lines than this entire code himself to do that.
And in Jass, there are configurables at the top of scripts. Unlike GUI.
 

Leazy

You can change this now in User CP.
Reaction score
50
Hardly.
There is no easy way of changing that in this snippet either. The user would probably have to write more lines than this entire code himself to do that.
And in Jass, there are configurables at the top of scripts. Unlike GUI.

Hardly what? Is it hardly possible to keep charges when switching inventory or hardly possible to change items between inventories in a good way?

#Updated!
Should now work with charges as well!
 

Samael88

Evil always finds a way
Reaction score
181
Why don't you just store the items in an array and at the same time you place them in a small unused region and then just switch them around like you do now?
That is much easier and you don't need to check for charges and stuff beacuse you will really be moving the "original" items:p
 

Leazy

You can change this now in User CP.
Reaction score
50
Why don't you just store the items in an array and at the same time you place them in a small unused region and then just switch them around like you do now?
That is much easier and you don't need to check for charges and stuff beacuse you will really be moving the "original" items:p

Hmm, may be but then people in for example maps with blink could get to them I think, that would need a lot more customizing by importing people. However, thanks for your tips and +rep! =)
 

WilliamPa

Active Member
Reaction score
51
Too bored to test the map atm, but should you try making it to a targetable unit or something like that rather than skill. If you are wearing damage gear in bag 1, and pots in bag2, boss or player enemy might stun you and deal huge amount of dps, and most likely you are dead when you are switching bags?

E2: Also silence affects the ability using.
E: Also make variable to store custom values? Some maps use item custom values as real important integers.
 

Leazy

You can change this now in User CP.
Reaction score
50
Too bored to test the map atm, but should you try making it to a targetable unit or something like that rather than skill. If you are wearing damage gear in bag 1, and pots in bag2, boss or player enemy might stun you and deal huge amount of dps, and most likely you are dead when you are switching bags?

E2: Also silence affects the ability using.
E: Also make variable to store custom values? Some maps use item custom values as real important integers.

I fixed so it stores custom values. Also made it work if your using an item stacking system. I will keep it as an ability, because else you could for example have one inventory with all +hp items and then just switch to it when your stunned or something. If it's really important you could customize it by yourself, it's very easy.

To come: 10 seconds cooldown so you can't for example just have one bag with all +int gear and then cast spells and then switch back.

P.S: +rep for comment :)
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
You can optimise the system by setting all the "Integer A's" and "Triggering Unit's" etc. into variables.

The sumbission is graveyarded, though, because it's not very user friendly (like all GUI systems, spells etc) and there are better ones out there.
 

Leazy

You can change this now in User CP.
Reaction score
50
You can optimise the system by setting all the "Integer A's" and "Triggering Unit's" etc. into variables.

The sumbission is graveyarded, though, because it's not very user friendly (like all GUI systems, spells etc) and there are better ones out there.

What could I do to make it more user friendly then?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top