Number of slots in the inventory

(Alex Mordor) #1


How can I change the number of slots in the player’s inventory in real time? I tried to change height and width in the item bag,but it does not work.

I also tried to check in every inventory slot (Image 3)

but somehow it is not working correctly, using the debug I tracked that in some slots the verification breaks down ,for example shows that 10<2

(sorry for my English,used Google translation)

(Alex Mordor) #2

maybe this is a bug in plygame?

(Leslie Young) #3

The number of slots shown in the UI comes from the value slotsWidth * slotsHeight. The width and height you enter in the inspector will have no affect on how it is presented in the game UI, only how many slot objects/elements will be shown. The layout of the slots in the UI is dependant n the size of the panel. if you want more slots in a row you need to make the panel wider.

If you try to increase the slots at runtime you must remember to also make a call to GUI > Refresh Bag UI so that more slot objects can be added to the panel, if needed.

I am not sure what you are demonstrating with the screenshots and “10<2” thing.

(Mordor) #4

Thank you very much, it helped. But now a new problem appeared, how to make items not added if all available slots are filled (except for those slots that are not in the panel)

I tried to do a check with variables,but I failed.

(Leslie Young) #5

The Item Bag should not allow anything to be added if it is full. If a player try to pick up something it will simply fail.

Are you trying to add something via Blox?

(Mordor) #6

oops, I forgot to change height when resizing panel =) Thanks for the help,my issue is closed

(Mordor) #7

Only here there is still another question, I would be grateful for an answer: When I remove an item from the bag, it drops and immediately added to the bag back.

(Leslie Young) #8

Do you have auto-pickup enabled on that object?

(Mordor) #9

Of course not it is off and this bug happens with all items.

(Leslie Young) #10

Tested …

(Mordor) #11

I created a test scene,recorded the bug on video

(Marshall Heffernan) #12

Not a bug, this has (to my knowledge) never happened to anyone, ever.

Why does the camera follow your mouse at all times?
Are you constantly holding right click? If so, try without doing this.

Did you change the keybinds? Try this again with the default keybinds.

(Mordor) #13

I use invector controller (integration - Invector Third Person Controller 1.1d Integration)

If it’s not, then what is it?

(Idcrisis Arito) #14

Sounds like the issue is with the other asset and not plygame.

(Mordor) #15

Maybe Yes,although plygame is responsible for removing the item.

(Idcrisis Arito) #16

But it doesn’t happen when I try it. So it has to be something in your setup. the only thing I did different was not use some other asset.

(Alien) #17

Invector has its own inventory script, i assume you’ve removed that?

(Leslie Young) #18

Maybe Yes,although plygame is responsible for removing the item.

I specially recorded a video to show plyGame works as intended. If you are using other assets in combination then it is not fair to say plyGame is the culprit here. As far as I am concerned it works until you can show that it does not work (without any other assets present which might be causing the problem). I can not provide support on integrating other asset with pyGame since I do not own them most of the time and do not have the time to research how they work if I did happen to get a copy.

plyGame will not auto-pickup an Item if it is not marked as such. But you already confirmed they are not set for auto-pickup. Did you create any Blox that deals with Items and the Bag? How are you picking them up initially? I do not see any mouse cursor so I can not tell whether you click on them or press a keyboard button or just move close to auto-pickup. Does Invector not do something to items and bags (I see mention above that there are inventory related scripts in Invector)?

Create a clean project with just plyGame in it and do a test. Only if it works can you move on to adding whatever else you want present, like Invector. This will help you narrow down when the problem occurs and why.

(Mordor) #19

I do not use invector inventory.

(Mordor) #20

Thank you. The problem was solved. Just disable the option “select item to interact” in the script “invectoryply game controller integration” (I’m talking about script integration from Invector Third Person Controller 1.1d Integration ) Now everything is working correctly,items are selected and removed =)