Inventory System

Some1Sneakin

New Member
Reaction score
5
Hi, im looking for a nice inventory system which makes the hero able to use more than just 6 items. I want it to be like: You can scroll between X amount backpacks. And the items that arent in the active bag should give stats. It have to be MUI. I searched around but i didnt found anyone good for me. Most were to complicated. :)
If you know a simple Inventory system, please tell me. :D
 

Some1Sneakin

New Member
Reaction score
5
I have searched but i havent found any good one yet, because of 2 reasons:
1. The system isnt as i want it to be. (Usualy it wont make items that are in a "closed bag" give stats)
2. Its so complicated... Either the demo map are loaded with different functions and its hard to understand what is what. And sometimes you need another trigger to make it work, and that trigger need another trigger, which need another trigger... Or maybe its because i suck at JASS. If its bad described i dont know what to change to make it fit my map.
 

Squishy

You can change this now in User CP.
Reaction score
127
So you want items that give passive abilities, like +3 strength, to give their bonuses even when not in the bag you are currently viewing? The only way to do that would be to put the passive ability into a disabled spellbook, and then adding the spellbook when they get the item, and remove it when they lose the item. Once you've done that, multiple bags are easy to do, you just have to decide how you want players to access their other bags, be it abilities, typing commands, or other things.
 

Nerfpl

New Member
Reaction score
53
try makeing mule flying dummy unit with max speed and no model and 0 collision, and make trigger to follow you every 1 sec. also it must be hero. just example
 

Some1Sneakin

New Member
Reaction score
5
Lets say i want it this way:

You have 2 bags, and you switch between them by an item thats in your inventory.

Bag 1

Item 1 | Item 2
---------------
Item 2 | Item 3
---------------
Item 4 | Switch Bag
---------------

Bag 2

Item 5 | Item 6
---------------
Item 7 | Item 8
---------------
Item 9 | Switch Bag
---------------

How would the trigger look like?
Also whats the best way to trigger the spellbook with the stat bonuses?
The hardest thing with that is if you have 2 of the same items or 2 items that give same stats.
 

Some1Sneakin

New Member
Reaction score
5
PureOwnage i already tested that one. But just look at all the extra features, Socketable items and that. Look at the code, its more than 1000 lines. And for someone that not good on JASS, then thats a pain in the ass to import and remove the extra features.

Edit: oh my editor says its more than 5000 lines O_O
 

Twilight33

New Member
Reaction score
4
ok here is my 2 cents.

use the spell book method. you should be able to add item abilities to spell books. make it so all of the actual items do nothing. when a item is dropped or picked up you can add or remove the ability from the book. For resolving multiple items, make all item abilities multi-leveled. so when some picks up 2 of the same item instead of adding the ability you increase its level by 1. then just make each level be the basic stats of the item stacked on top of itself as approiate. that will generate the effect you are looking for. you should be able to do all this without jass. its almost 4 am here right now. when i get up in the morning i will see if i can implement a quick example trigger 4 u.
 

Twilight33

New Member
Reaction score
4
ok i couldnt sleep so i have been tinkering. here is what i have come up with.

first of all their are some limitations to this code
  1. Items cant me moved around in inventory or it will screw up the stored info.
  2. I cant give you a dynamic storage size. your going to have to set a limited amount.

ok now the triggers

Explinations
Code:
Items[] - This is an array that will contain all the item you have. You will need to store all of these manually using the map initialization trigger.
Abilities[] - This is an array that will contain all the item abilities you will be adding to the spell book. You will need to store all of these manually using the map initialization trigger.
Inventory[] - This will store what items are currently being stored. you will need 1 for each player. you will need to set its size in the editor.
InventoryPage - this keeps track of what page your on of inventory. you will need 1 for each player. initially set to 0.
InventorySize - Store the size you set for Inventory[] here. this is so some triggers no how big the array is.
SlotNum - this is just a temporary store for the slot number of the item dropped/picked up
No Item - This is just an item to store in the array so that we no their isnt an item their.

i put all variables in blue.

Code:
Initialization
    [COLOR="SeaGreen"]Events[/COLOR]
        Map initialization
    [COLOR="SeaGreen"]Conditions[/COLOR]
    [COLOR="SeaGreen"]Actions[/COLOR]
        Set [COLOR="Blue"]Items[0][/COLOR] = Claws of Attack
        Set [COLOR="Blue"]Abilities[0][/COLOR] = Claws of Attack Ability
        Set [COLOR="Blue"]InventoryPage[/COLOR] = 0
        Set [COLOR="Blue"]InventorySize[/COLOR] = 10

this code simply sets up everything for the system. here you will fill the arrays with all the Items and Item Abilities your map will be using. along with setting the inventory size.

Code:
Pick Up Item
    [COLOR="SeaGreen"]Events[/COLOR]
        Unit - A unit Acquires an item
    [COLOR="SeaGreen"]Conditions[/COLOR]
    [COLOR="SeaGreen"]Actions[/COLOR]
[COLOR="Red"]--- This Checks to see which slot the picked up item is in and then stores it ---[/COLOR]
        [COLOR="SeaGreen"]For each (Integer A) from 2 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions[/COLOR]
                        (Item being manipulated) Equal to (Item carried by (Hero manipulating item) in slot (Integer A))
                    [COLOR="SeaGreen"]Then - Actions[/COLOR]
                        Set [COLOR="Blue"]SlotNum[/COLOR] = (Integer A)
                    [COLOR="SeaGreen"]Else - Actions[/COLOR]
[COLOR="Red"]--- This search the Item[] array you made earlier to figure out what item was picked up ---[/COLOR]
        [COLOR="SeaGreen"]For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions[/COLOR]
                        (Item-type of (Item being manipulated)) Equal to [COLOR="Blue"]Items[/COLOR][(Integer A)]
                    [COLOR="SeaGreen"]Then - Actions[/COLOR]
[COLOR="Red"]--- After finding the index of the item picked up it then pulls the matching ability out of the ability array and adds it to the hero if he doesnt have it or increases the ability level if he already has it (IE has item twice) ---[/COLOR]
                       [COLOR="SeaGreen"] If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions[/COLOR]
                                (Level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit)) Equal to 0
                           [COLOR="SeaGreen"] Then - Actions[/COLOR]
                                Set [COLOR="Blue"]Inventory[/COLOR][(([COLOR="Blue"]InventoryPage[/COLOR] x 5) + [COLOR="Blue"]SlotNum[/COLOR])] = (Item-type of (Item being manipulated))
                                Unit - Add [COLOR="Blue"]Abilities[/COLOR][(Integer A)] to (Triggering unit)
                            [COLOR="SeaGreen"]Else - Actions[/COLOR]
                                Set [COLOR="Blue"]Inventory[/COLOR][(([COLOR="Blue"]InventoryPage[/COLOR] x 5) + [COLOR="Blue"]SlotNum[/COLOR])] = (Item-type of (Item being manipulated))
                                Unit - Set level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit) to ((Level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit)) + 1)
                   [COLOR="SeaGreen"] Else - Actions[/COLOR]

Code:
Drop Item
  [COLOR="SeaGreen"]  Events[/COLOR]
        Unit - A unit Loses an item
   [COLOR="SeaGreen"] Conditions
    Actions[/COLOR]
[COLOR="Red"]--- This Checks to see which slot the dropped item was in and then stores it ---[/COLOR]
        [COLOR="SeaGreen"]For each (Integer A) from 2 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions[/COLOR]
                        (Item being manipulated) Equal to (Item carried by (Hero manipulating item) in slot (Integer A))
                   [COLOR="SeaGreen"] Then - Actions[/COLOR]
                        Set SlotNum = (Integer A)
                    [COLOR="SeaGreen"]Else - Actions[/COLOR]
[COLOR="Red"]--- After finding the index of the dropped item it then pulls the matching ability out of the ability array and removes it from the hero if he only has level 1 (IE only has item 1 time) or decreases the ability level if he has greater then level 1 (IE has item twice). it then sets the spot in the inventory[] array that was the dropped item to No Item so we no its empty ---[/COLOR]
        [COLOR="SeaGreen"]For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions[/COLOR]
                        (Item-type of (Item being manipulated)) Equal to [COLOR="Blue"]Items[/COLOR][(Integer A)]
                    [COLOR="SeaGreen"]Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions[/COLOR]
                                (Level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit)) Equal to 0
                            [COLOR="SeaGreen"]Then - Actions[/COLOR]
                                Set [COLOR="Blue"]Inventory[/COLOR][(([COLOR="Blue"]InventoryPage[/COLOR] x 5) + [COLOR="Blue"]SlotNum[/COLOR])] = No Item
                                Unit - Remove [COLOR="Blue"]Abilities[/COLOR][(Integer A)] from (Triggering unit)
                           [COLOR="SeaGreen"] Else - Actions[/COLOR]
                                Set [COLOR="Blue"]Inventory[/COLOR][(([COLOR="Blue"]InventoryPage[/COLOR] x 5) + [COLOR="Blue"]SlotNum[/COLOR])] = No Item
                                Unit - Set level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit) to ((Level of [COLOR="Blue"]Abilities[/COLOR][(Integer A)] for (Triggering unit)) - 1)
                 [COLOR="SeaGreen"]   Else - Actions[/COLOR]

Code:
Cycle Inventory
   [COLOR="SeaGreen"] Events[/COLOR]
        Unit - A unit Uses an item
   [COLOR="SeaGreen"] Conditions[/COLOR]
        (Item-type of (Item being manipulated)) Equal to Change Page Item
   [COLOR="SeaGreen"] Actions[/COLOR]
[COLOR="Red"]
--- This checks first to see if we are on the last inventory page. if yes its set to first page if no it increase page number by 1. it then removes all items from inventory and adds new ones to it ---[/COLOR]
        [COLOR="SeaGreen"]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions[/COLOR]
                [COLOR="Blue"]InventoryPage[/COLOR] Equal to (([COLOR="Blue"]InventorySize[/COLOR] / 5) - 1)
           [COLOR="SeaGreen"] Then - Actions[/COLOR]
                Set [COLOR="Blue"]InventoryPage[/COLOR] = 0
            [COLOR="SeaGreen"]Else - Actions[/COLOR]
                Set [COLOR="Blue"]InventoryPage[/COLOR] = ([COLOR="Blue"]InventoryPage[/COLOR] + 1)
        [COLOR="SeaGreen"]For each (Integer A) from 2 to 6, do (Actions)
            Loop - Actions
                Item - Remove (Item carried by (Hero manipulating item) in slot (Integer A))
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions[/COLOR]
                Hero - Create [COLOR="Blue"]Items[/COLOR][((([COLOR="Blue"]InventoryPage[/COLOR] x 5) - 1) + (Integer A))] and give it to (Hero manipulating item)

hope that explained things ok.

while i was typing all this i thought of a way to fix the inventory swapping problem. ill try and post a fixed version when i can.
 

Crusher

You can change this now in User CP.
Reaction score
121
Dude,this is better even THAN.....never mind, this is fuc*ing awesome!

+rep instantly...
 
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