Sorry for the basic question but im struggling on a basic concept after searching for a while, which is checking variables/data from one actor to another in blueprints.
Basically I have one actor with a box trigger and once the player steps into the box trigger I want it to check how many coins (intreger variable) the player has collected and if they have enough open the door.
I’ve seen posts about casting to check data amounts on other actors but it’s not clicking for me. Below is the point where I am looking to check the “PlayerCollected” Variable but where others have said to just cast to the Player controller and get the variable it isn’t their.
Here is an example that can get you started. I’ve created an empty actor and added a Box Collision. Then, by right clicking the Box Collision, you can add event:
And something like this will do what you’re wanting to:
Note that player CONTROLLER and player ACTOR (pawn) are different classes.
The controller typically doesn’t interact with collisions directly.
If your variable is on the player ACTOR then you should take the collision actor, and try to cast it to your player actor class. If that works, read the value.
If your variable is on the player CONTROLLER then you could still get there from the collision actor, by casting it to Pawn and then calling GetController on it, and then casting THAT to your controller class.