Inventory System Help

Squishy

You can change this now in User CP.
Reaction score
127
I am currently working on an Inventory system that would add items picked up into bags. So far, I've only tried with one bag, and I can't get the triggers to work. Here are the triggers:
Code:
Initialize Inventory
    Events
        Map initialization
    Conditions
    Actions
        Hero - Create Backpack and give it to Mountain King 0001 <gen>
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Set Inventory_Spot[(Integer A)] = No Item
Code:
Acquires Item
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-type of (Item being manipulated)) Not equal to Close
        (Item-type of (Item being manipulated)) Not equal to Backpack
    Actions
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Inventory_Spot[(Integer A)] Equal to No Item
                    Then - Actions
                        Set Inventory_Spot[(Integer A)] = (Item-type of (Item being manipulated))
                        Item - Remove (Item being manipulated)
                        Skip remaining actions
                    Else - Actions
Code:
Open Backpack
    Events
        Unit - A unit Uses an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to Backpack
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
        Hero - Create Close and give it to (Triggering unit)
        Unit - Order (Triggering unit) to move (Last created item) to inventory slot 6
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Inventory_Spot[(Integer A)] Not equal to No Item
                    Then - Actions
                        Hero - Create Inventory_Spot[(Integer A)] and give it to (Triggering unit)
                    Else - Actions
Code:
Close
    Events
        Unit - A unit Uses an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to Close
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
        Hero - Create Backpack and give it to (Triggering unit)
Whenever I pick up an item, then open the backpack, there are no item inside. Can anyone see why this wouldn't be working?
 

Squishy

You can change this now in User CP.
Reaction score
127
I tried disabling it, didn't change anything. Gah, I can't figure out why this isn't working.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Want me to give you a working backpack system?
 
Reaction score
86
change this
Code:
(Item-type of (Item being manipulated)) Not equal to Close
(Item-type of (Item being manipulated)) Not equal to Backpack

put an "and" in... I doubt this is the problem, but I'm pretty sure for all the conditions it is ors.
 

Squishy

You can change this now in User CP.
Reaction score
127
@Renendaru
If it's in GUI, ok. If it's in JASS... i guess I'll take a look anyway.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
It's in JASS, but the cool thing is it uses some items for the spaces to look like an inventory.
 

Squishy

You can change this now in User CP.
Reaction score
127
Ok, can you upload it?

@Infinitegde
Tried it, didn't work.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Here.

It's in that. There's some other stuff in it, feel free to look around.
 

XxShadyxX

I abused the rep system.
Reaction score
81
Code:
Then - Actions
                        Set Inventory_Spot[(Integer A)] = (Item-type of (Item being manipulated))
                        [COLOR="Red"]Item - Remove (Item being manipulated)[/COLOR]
                        Skip remaining actions
                    Else - Actions

um all this trigger is doing is removing the item. where is the part that moves it into the backpack?

also renedaru um the link don't work?
 
Reaction score
86
XxShadyxX is right. I just realized. Try disabling the trigger a unit acquires an item when you run the trigger Open backpack
 

XxShadyxX

I abused the rep system.
Reaction score
81
well then the item will just go into the inventory... You need to move the item into the backpack somehow
 

Squishy

You can change this now in User CP.
Reaction score
127
Without the trigger A Unit Acquires an Item, I cannot recieve any items at all, as items are created in the backpack via the item array.
 

XxShadyxX

I abused the rep system.
Reaction score
81
Yo here is another way for a backpack
Make it when you pick up backpack it creates a dummy unit that has a inventory. And make it when you push open it selects the dummy unit but that is the only way to get to dummy... And make it so when you pick up a item it moves the item to the dummy unit.
 

Squishy

You can change this now in User CP.
Reaction score
127
I'd rather get this way working, as it'll be much easier than using dummy units for each bag I want to give the unit.
 

XxShadyxX

I abused the rep system.
Reaction score
81
Well then all you need to do is add the item to the backpack... In that trigger that has the remove item put it in there
 

Squishy

You can change this now in User CP.
Reaction score
127
Look at the triggers. When a unit acquires an item, the item is set to a variable array. When the backpack is opened, it refers to the array and creates items for the Hero. It should already add the items.
 

XxShadyxX

I abused the rep system.
Reaction score
81
yea I know just try it? Try making it when you get a item it moves it to backpack
 

XxShadyxX

I abused the rep system.
Reaction score
81
WAIT SORRY FOR DOUBLE OST BUT I FOUND PROBLEM

Code:
Open Backpack
    Events
        Unit - A unit Uses an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to Backpack
    Actions
       [COLOR="Red"] For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Item - Remove (Item carried by (Triggering unit) in slot (Integer A))[/COLOR]
        Hero - Create Close and give it to (Triggering unit)
        Unit - Order (Triggering unit) to move (Last created item) to inventory slot 6
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Inventory_Spot[(Integer A)] Not equal to No Item
                    Then - Actions
                        Hero - Create Inventory_Spot[(Integer A)] and give it to (Triggering unit)
                    Else - Actions
RIGHT THERE THE RED DELETE IT AND TRY IT!
 

Squishy

You can change this now in User CP.
Reaction score
127
The 'Backpack' doesn't exist when a unit aquires an item, because all it is is an item ability, that when clicked, should create the items in the variables.

EDIT: XxShady, no offence, but your missing the point of the triggers. I am removing the items because I am just simulating a backpack effect, there isn't actually a packpack.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top