IncrementInt and int + int is not working

So I got this thing right here:

i just added the int + int but it doesnt work as well but i was initially using incrementint. now the problem is it is only increasing my current stack amount by 1 the first time. by default the current stack amount is 1. and the max stack is 5. now it only increasing my amount by 1 the first time it gets called so it sets it to 2. but after afterwards even though the False is getting called (i confirmed using print string) the amount isnt getting incremented by one. pretty sure it isnt clamped and i am pretty sure u cant set min-max in a struct. not sure what the problem is here but the whole item stack isnt working because of this because it depends upon the stack amount.

pls help.

Where does the “Break S_Inventory” that you increment come from? Did you pull it from the array and then increment and then set? Can’t tell from here but if it isn’t being pulled from the array and it is just a struct variable you split then you are always using the default value of 1…adding 1…equals 2. To go from 2 to 3 however, you would need to “get” array element from that struct array, and “set array element” of the struct which actually has its own special “set” node. I don’t think you ever “set” the struct after you change its value. Check out the screen shot below.

the break S_Inventory is being taken from a Array. i am modifying the value of the struct and then using Set Array Element because i want to modify a already existing index. i am pretty sure i dont need any of the two nodes since i am only modifying the index that already exists. or do i need to use one of the methods u gave even after using Set Array Element?

Got ya. Well in that case I would use “set members in ‘X’ struct” node. I’ve had issues with setting structs the way you’re trying and I forget exactly but I do know it has something to do with how the data is passed… by copy or reference and i think with the structs they are passed by copy so you don’t actually change the data of the specified struct using the nodes you’re currently using. The set members node will actually modify the input struct values though.

At least in the images you’ve shown, you’re not increasing the int anywhere.

You’re just displaying int+1, bout you’re not setting it +1.

You need to wire your int to a ++ node, or a to a set node for it to actually increase.

You can only change stuff on things that use white execution flow.

Check the set Array Elem Node. i am making a struct using all of the old data and just changing the current stack amount. and after making that i am setting that item using Set array Elem

So Basically i took the default amount which was 1 and +1 to it and made a Inventory Struct and then used the item i just made using this to Change a already existing array

you’ve not check “size to fit”, are you sure the array has enough space for this entry?

hmm ok but how would i change the already existing index. here is what i have. i get the info using a interface → this is a structure variable and not the array itself. this stores data like name etc. now if this item exists in my inv ill just stack and to do that i will get the index of the already existing item. and just change its stack amount. this is the problem.

Maybe ill just play around with it a bit cause in the end im just changing the item itself and not setting that item in my inventory.

yep. im sure it has enough space. else this bit of code wont even execute

alright so i just used the Set members together with set array elem however it still doesnt work

Ok :stuck_out_tongue: i figured it out. turns out i am a idiot :P. i was trying to modify the info array array each time instead of the item already in my inv. sorry