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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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