Errors with blueprints. trying to use functions from a widget to a blueprint actor

Hello. I am having a problem with targeting a function from a widget. This function is in a actor blueprint. When the function is called it should change the value in some variables. These variables are exposed on spawn and instance editable. I am try to make it so this function only changes some of the actors varaibles. That is why they are exposed on spawn and instance editable. E.G: Only some chests are unlocked when the function is called. I have googled this but not found any results. I have put a picture of the error message and the widget event graph. Thank you for your time.

The error is telling you that the variable is pointing at any chest. You have to tell the system which chest you want to talk to.

GetAllActorsOfClass will do the trick, but it really depends on your game how you get the right one…

Ok, Thanks for your reply. I was trying to make it that the widget that unlocked the chest could talk to multiply diffrent chests. My chest are unlocked with keys that have diffent values.
image
Hear are the two variables. They need to mach if the chest is to unlock.
The key when picked up will change the key value. I tried the GetAllActorsOfClass but it got confused as the key value is diffrent for all chests. I also Used GetAllActorsOfClass with tag but that could only target the chests with the tag. Is there a way to change a tag when the actor is selected. Thanks again for the answer.

If you use ‘get all’, you can just loop through them and look for the one with the matching key?

Hi there, That shouds great. What nodes should I use for this. There are many ways i think I could do this but what is the best way of doing this? Should I get all and use the tags that im using to filter the chest to find the one that maches the key. Thanks for all your help.

Presumably, the player has a key and you know the integer id of that key?

Then you can just

1 Like

Hello there. One last thing. I need to cast to a widget to make the chests work. I have trired this but i keep getting errors. How should I cast to a widget? Thanks for all the help.

Same method. If the widget has been created, you can use GetActorOfClass, and just put the widget class in there. No need to cast…

1 Like