Download

Transferring money to ATM from player

I wanted to test out a money mechanic, and i decided to make an ATM to hold the players money. I set up a quick test where it takes all of the players money instead of a certain amount, but it does not transfer. I made a money blueprint that adds a certain amount to the player. I made a simple interface and a button to transfer everyhting so i had to cast to the player and the ATM blueprint and I think maybe my ATM cast wildcard may be incorrect, I have watched some tutorials on that but im not sure if my wildcard is correct or my entire implementation is wrong.

This is in the ATM UI.

FirstPersonChar == none.
You need a direct reference of it.

To do so you could, for example

  • Add a SphereCollision to ATM
  • OnBeginOverlap(SphereCollision) >> OtherActor == FirstPersonChar ? (yes) Set FirstPersonCharRef" : (no) Do Nothing
  • If it’s FirstPersonChar, “CreateWidget”, And set FirstPersonCharRef in it.
  • Then you should be able to manipulate FirstPersonChar variables in the Widget.

Hey, thanks, I figured it out, I didnt need to cast to atm at all, I did this and now it works perfectly. Not sure if this is a good way to do it though.

If the way you have done it works, then that’s great. The only real issue you might run into is if you have multiple ATMs and you want to start doing things to a specific ATM when you interact with it etc. In this case, SIliks method would be best and would be easier to modify if wanting to change or add things etc. It all comes down to how you eventually want them to work in game.