I have made a flashlight Blueprint. I have a custom event in it called batterypickup.
I have a blueprint of my battery. In it I have event actor begin overlap - cast to flashlight - batterypickup (target is flashlight)
I also have an amount (float value) that I want to send to my flashlight.
Thanks for all the help I can get
The Event Actor Begin Overlap is passing Other Actor when that event is triggered. Other Actor is likely your Character blueprint that is walking over the pickup/triggering the Event. Casting your Character to the Flashlight probably should fail in this case because the Character isn’t a Flashlight–is your Flashlight a blueprint you are spawning and attaching to a socket on your Character?
Let us know and we’ll be able to provide more guidance.
Hi. Thanks for the reply.
The flashlight is beeing snapped to character as he walks over it.
Any good solutions for how I could set up seperate blueprint for battery, and flashlight ?
You should already have a reference to the flashlight in your character, right? Create a function in your character that will return the flashlight object (GetFlashlight would be a good name), and call it on the character to get the flashlight.
Also, it would be better if you had the character handle pickups and then redirect them to their respective users. In this case, you’d have a HandlePickup function in your character which tests to see what type of pickup was acquired and if it’s a battery, tells the flashlight to increase its remaining power.