Blueprint Function, math bug?

Hello, I’m using version 5.5.4.

This is my AddItem Function.

There is a array, each slot has 1 quantity, now i’m adding 100 quantity, to slot 0, MIN-Function ist correct before SetArrayElem, but after that, the MIN-Function has value of 0??

Why is min at 0 after setarrayelem and before its 98 (correct)??

Greedings.

1 Like

Did you mean to connect this?

1 Like

yes it connected but same result

1 Like

hard to follow that code so maybe its intended but keep in mind after the SetArrayElement you re-call the pure code which can/will return different values.

you should probably save the result from the MIN to a local variable

2 Likes

saveing as local before setarrayelement works fine, can someone explain this a bit?

pure nodes (nodes without execution pins) are called every time you access them.

so everything beginning at your Get Node.

this means you call the Get before setting the array element and get the initial quantity, and then you call it again after setting the updated quantity.

I used many nodes, in similiar cases, the only node that does such weird things is MIN