Trigger Looping

I have a trigger volume and once my character walks into it, rocks fall from the sky from a target point.

When my character is in the trigger volume it plays once, as I enter it. Also again when I walk out and back in again it repeats the rocks falling.

I would like it so that when my character is in the trigger volume the rocks fall on a loop.

Could anyone help me out please

Regards

Hello Reece120,

You could do this with the use of Timers and a boolean. Firstly, you’ll need to set up a timer to spawn the rocks for you at a certain interval. You can then set this interval up to a branch that spawns the rocks every time the timer triggers if the boolean connected to it is true, and doesn’t spawn the rocks if it is false.

After that, you can set up the OnBeginOverlap to set that boolean to true and OnEndOverlap to set it to false. This way, when you enter the trigger, it’ll keep spawning rocks based off the timer due to the boolean being set to true. When you exit the trigger, they’ll stop spawning as the boolean will be set to false. If you would rather the timer not be constantly firing when you’re outside of the trigger volume though, you could also have the timer be set OnBeginOverlap and have it be cleared OnEndOverlap.

You can find out more about timers here: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseTimers/Blueprints/index.html

You can always connect your final event to a delay node, and then drag a wire from the delay node to the beginning of the same event :slight_smile:

I have this so far, I’m a bit of a newbie with blueprint. Would it be possible if you could upload an image of how the blueprint should look? please.

I followed the link you gave me, but was having no luck and I can’t get my head around it.

No worries if you can’t help me. I really appreciate all the help

Regards

Without a break of some sort, unless I’m thinking about this incorrectly, that would cause an infinite loop of falling rocks.

Of course, heres a picture of what I set up for it in the TriggerVolume’s blueprint:

First we have the begin overlap, which uses Other Actor to cast to the ThirdPersonCharacter class to ensure that we’re only reacting to the player overlapping and not something else. It then sets a timer that calls the SpawnRock function, a custom function that I created, every 0.5 seconds and loops. I then promoted the Timer Handle from the return value to a variable so that we could clear that timer later.

Then I added the end overlap event, also casting to the ThirdPersonCharacter, and used that to clear the timer using the handle from before.

The SpawnRock function can have your SpawnActor node, along w/ the TriggerPoint and GetActorTransform. Mine just has a simple print string in it at the moment for testing so no reason to show that.

Hope this helps!

Got it all working now!

Thank you so much - and Nawaf for your help really appreciate it

All the best

Got it all working now!

Thank you so much - and Nawaf for your help really appreciate it

All the best