A valiant attempt but it’s not great, to be honest. I’m actually surprised it works in the first place for so long. The main issue is that you rely on the cast node retaining a valid reference while the Delay node loops back - this is generally a sign of bad design. It’s simply unsafe.
To do it right, you would start a timer that deducts health when the player enters the volume and stop the timer when they leave the volume (or die).
Well, could you send me a link to some tutorial on how to set it up? Or could you send me screenshot how it should look? Thanks. And why do you call it unsafe? Is that system I use bad for performance? Or it has a high chance of crashing? Thanks (again )
Hello, I found this strange “bug” while making a game. I am making a pirate game and for it I need to have sinking ship animation. In the video, you see everything (blueprint, level blueprint…) Problem is when there is only player on the ship everything works. There is countdown 10 sec. and the player dies. But when there is another actor - (cube in this case) on the ship it bugs. It starts to countdown and then just drop to 0. And I get errors. Any idea why? How can i fix it?
Because of the Delay node looping back. You cast once and then never check whether the return value is still valid - you saw the errors. It’s unreliable, prone to crashing.
I’ve placed this actor in my level, when the player enters the box we start a timer. Every 1s the timer sends 0.1 damage to the entity that entered - in this case, it’s the player. When the player leaves, the timer is turned off.
And in the player blueprint:
UE4 has a robust damage dealing system built-in, we’re taking advantage of it here. Also, you can now place many damage dealing actors anywhere without having to repeat any of the script. Maybe you’ll have a fire trap later on.