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.
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.
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
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.