Download

Need Help With Health Pickup

I’m currently in the process of making a game, and I’m working on getting the core gameplay mechanics and elements done for play-testing. I’ve come back to working on the health pickup. The problem here is that my game has multiple characters and no two characters have the same amount of health. (EX. Male 1 Health is 100. Male 2 Health is 200.) Once that player walks over the health pickup it should get their health value and increase it by a certain amount. However, I’m having trouble with this. Here’s the setup.

86c7c13595ce8307f4677c560aeeb414b3093c01.png

Once I got it to work, I ran a split-screen test and it worked for player one but not for player two. (I know that has to deal with the get player character function I added.

That is the setup. Any help would be graciously accepted. Thanks.

Take the Actor that is overlapping and Call GetController() and pass the result to your cast. (I would store health and such on the Player Character and not the PlayerController, but you might have a specific reason for that).

Would you mind showing me? I’ve replaced the GetPlayerCharacter node with the GetPlayerController and plugged it into the cast and it didn’t work. If you would like to show me then I’ve provided a picture below. I edited the first picture in paint.

82e4f7dc591cf8d169b2bd671bb0412a4af57216.png

This should have all the info you need. You probably don’t need to call “get overlapping actors” unless you want to handle your own solution to the race condition that would happen if multiple players were standing on the pickup when it ‘respawned’. (Also the PlayerController won’t collide by default, and usually stays at world origin from what I remember seeing).

d6b6bb1ac3e0f208115c13bf36e39c841e40a3c6.png

Add Health is a custom function I made on the PlayerCharacter.

Thanks. I would’ve posted that I’ve figured out a way earlier but I was busy. I do appreciate your help and you taking the time to reply. I will be sure to make use of your method so that your hard work doesn’t go unnoticed. :slight_smile: