Download

I'm trying to make it so that when this object is clicked, when the integer variable value (casted from the playable character) is greater than 0, it casts a widget. But it doesn't work?

This is what it currently looks like:

It compiles just fine. But whenever I click the object, it doesn’t do anything. Am I doing something incorrectly?

(the refer variable is an object reference to the playable character, which is where the variable “wastes” was originally from)

Take a closer look at that first node :wink:

It’s not just the first node, either. He’s
also missing a few references with the widget nodes.

True, I didn’t even look that far. OP, here’s a non-cryptic response:

  • The first node is a ‘SET’, meaning you’re setting your cast reference to null each time this event runs. You want to GET your reference
  • There’s no need to SET the int on the actor you just got it from, you’re just setting the same value again
  • You need different ‘add to viewport’ nodes for each of those execution flows, otherwise it doesn’t know which of the widget references to use. It will try and use both, but one won’t be valid

Also, add a print statement off the event just to check it’s even being fired to begin with.

True, I didn’t even look that far. OP, here’s a non-cryptic response:

  • The first node is a ‘SET’, meaning you’re setting your cast reference to null each time this event runs. You want to GET your reference
  • There’s no need to SET the int on the actor you just got it from, you’re just setting the same value again
  • You need different ‘add to viewport’ nodes for each of those execution flows, otherwise it doesn’t know which of the widget references to use. It will try and use both, but one won’t be valid

Thanks. It shows it properly now.

Although, it seems that it couldn’t know the integer value. It’s supposed to check if the integer value is greater than 0, but every time the value goes up, it still shows the widget through the false branch.

Here’s what it looks like now:

I have a print string set up for the values to check and it should work but for some reason it doesn’t.

First try removing that set node (it really is unnecessary) and add a print between the Event and the Branch, and check you are reading the int as above 0.

If you are, then check your widgets. Are you clearing them after each click? If not then they’ll be trying to fight for the same z order.

Are you expecting the widget to update after the click? If so, this event will not do that.

First try removing that set node (it really is unnecessary) and add a print between the Event and the Branch, and check you are reading the int as above 0.

Just tried it. It isn’t reading if it’s above 0. It always go false no matter if it’s 0 or above.

Can you post a screenshot of the print you’re using?

Sure. Here it is;

That’s testing the wrong thing, you want to check what value you’re getting from your actor. This is all you need to test:

Ohhh. I just did it and it doesn’t print the value it’s supposed to (aka. it just says 0 no matter what I do). How odd. There must be something wrong in that area then.