Download

Trigger delay

How do you delay trigger functionality?

I’ve got a trigger that plays a force feedback event when the player goes the wrong way round a maze, the problem is is the trigger is still active and again fires the FF event when the player goes the right way in that section of the maze as they again activate the same trigger.

Is there anyway the trigger collision functionality can be delayed for a few seconds?

I’ve tried the following but it just doesn’t want to work:

This is the trigger setup in my level BP:
a92cbc9a3b58828879b3c5704aae7edb7cfd766c.jpeg

I’ve tried attaching this as an OnEndOverlap event but it permanently switches off collision to the trigger and completely disregards the delay node or its time setting:
ffoeTrig.jpg

Please help guys!

I probably know what you want…
There are probably more ways how to achieve this, but currently i have only 1 in mind:
Set bool “X” on overlap to true
If bool “X” is true, in tick start adding value to float (float value = float value + tick value)
If float value is “>” than some value, set float value to 0 and fire event which you want, if you persist in that “overlap field”, you will fire that event again after some time
On end overlap, set bool “X” to false and float value to 0.
in this way, event will not be fired if you end overlap…

something like that…

Being an amateur I’m not sure what you mean, can you elaborate on this slightly by a diagram?

It would be really helpful.

i not tested it but try this:

Thanks, I’ll give it a try, but how does the custom event get called that fires the forcefeedback event, shouldn’t that be driven via “OnBeginOverlap”?

Na, it gets called once because the timer reaches 5 at some point and then gets set to 0 again.

BUT, mate, use a “SetTimerByEvent” or “SetTimerByFunctionName”.

You don’t need the EventTick for a Timer.

######################

May I ask some questions to get a better understanding on your idea/problem:

You have a maze, like everyone would imaging a maze. With and entrance, exit and lots of ways that lead you into dead ends, right?

Going into the “wrong direction” means, the player is heading to a dead end, right?

You currently try to do this by putting a Trigger at a point where the player runs through, IF he heads to a dead end, right?

And if he ran through it (even though he felt the vibration), but then decides to turn around and go the correct direction,
it triggers again and that’s what you don’t want?

I meant he wanted to cancel that event so i coded this, but you are right Exi, after on end overlap he can clear timer :slight_smile: much simplier

Yes that’s correct eXi, I thought by using a doOnce with a reset trigger might be the the easiest way to realise this functionality?

Like the the DoOnce example from epic:

The maze is quite large with multiple branching routes.

Ok so, you will want to have ONE blueprint with TWO CollisionBoxes.
One is for playing the Forcefeedback, the other one for enabling it.

So this means, this solution takes in account that the trigger will only be called again,
if he passes as certain point (the reset trigger) on his way back.

Here is how:

  • Create new BP called “BP_FFTrigger”
  • Create two Box Collisions
  • Name them “FFTrigger” and “ResetTrigger”

  • Make sure to move them a bit apart from each other
    – You can do that later after placing it in the level too

  • Create the BeginOverlap Event for both
  • Create a boolean called “bCanFF” (b stands for boolean here, you don’t need that but it’s a thing for C++ programmers)
  • Add this logic to the Events (comments explain it)

  • Place into Level (I moved my boxes apart in the BP already)
  • Adjust the position and size, so the player 100% runs through them.
    – Place them so that for the wrong way he first runs through the RESETTRIGGER and the through the FFTRIGGER
    – Correct way would be FFTRIGGER (which is not yet reset then) and then RESETTRIGGER (so it gets reset again for the case he turns around again)

So as said aboth, he walks through the FFTrigger, it vibrates, he walks on a bit, decides to walk back to correct way, then turns around to wrong way (nothing happens).
Then he AGAIN turns around to walk correct, this time far enough to reach the RESETTRIGGER and now (if he turns to wrong way again) it would vibrate.

If you want to permanently vibrate every x seconds as long as he runs into the wrong direction (not depending on a fixed reset point),
you would need to do that a bit different and that would involve vector math.

Don’t really have the time right now to create the solution so I have the one above is correct.

Cheers

Thanks again eXi massively appreciated!