I’m having a simple problem with Unreal Engine 4, in my character Blueprint i have a flashlight and i can toggle the visibility and everything but i’m now making a actor blueprint that’s just a trigger box that have to read if the characters flashlight is on or off.i know how to cast to the character have a few functions that work like that but im unable to call the variable it have to go thru a function that determinate if the flashlight is active or not, how do i return a value thru a function, any advice would be appreciated.
and lastly, can i make a function loop with a delay. for example i have health and then i have save point when i stand on it, it restores my health but it stores it fully automatically because the function that is called is set it back to 100 but i want it to recharge slowly so it looks better so in a function i want to +5 Hp every second but im unable to add a delay inside a function, so i thought i make the function only restor 5 hp and then loop the function a few times until the result is hp = 100, but no luck so far, that’s not as important as the top suggestion but any advice in any matter would help or link to a page where i can read more about it, my searches haven’t gotten me far yet…
I’m not sure why you’re unable to call that variable, can you post a picture of your blueprint?
For health regen, you can increase the players health (should be a float, not an integer) by Delta World Seconds * [Number of HP regenerated per second] every tick (or you can have it on a 0.1s tor 0.05s timer)
Iam not sure if you meant it that way but, this is how you can use different return values for 1 function
(its not about the bp itself… use a local variable wich you can set in many code branches and then in the end just return that value - “return bool” of type boolean in this case)
Hi thank you all for the posts It’s helping a lot I have found a few glitches in my B-P coding, just one question about the event tick is there a way to turn it on and off , because i just want the Regen at a certain spot,
and thank you my flashlight problem have been resolved
No, event tick will always fire. You can of course use a condition node (i.e. branch, switch, etc…) after the tick to enable/disable the connection yourself. If I understand you correctly, you’d only like to increase health when your character is standing in a specific location?? If so, you could set a boolean using the ‘on actor begin/end overlap’ triggers from a trigger volume.