Download

Help! Stopping a delay with a triggerbox?

Hey guys, I’ve just recently got into using Blueprints and had some success with small instructions however I’ve hit a wall with this one.

What I’ve got is an area on the map, which in this case is the pink chair, when the player is near the pink chair i want the red map and blue map to alternate between each-other - but only after the player leaves and re-enters the trigger-box. Which is what I want.

The problem I have is that I want the player to remain by the chair for the delay and if they hit the OnComponentEndOverlap then I want the delay to stop the switch.

I’m pretty certain I need a gate to close but I can’t figure out a way to stop the delay without breaking the alternating pattern. Any help would be majorly appreciated!

bfbda3f773d686a5f41695333f63b0c8b3b2c262.jpeg

So you want it to continue while the player is in the collision box?
You have to do that in the event tick.
Begin / End Overlap only triggers once.

Make a bool “is triggered”
on begin Overlap -> is triggered = true, on end -> is triggered = false

in the event tick
is triggered = true -> delay -> flip flop

delay means it’s triggered once in that time, you cant stop or recall it while the delay is in action.

Hi KrautPotato, Thanks for your fast response, this solves the problem of stopping the delay and then stopping the level switch, however it continuously loops the levels because of the event tick.

After it swaps the level I want to make the player walk out of the triggerbox and re-enter to ‘re-initiate’ the BP again, is this possible? I’ve attached an image as the graph is now for visibility.

f233b3ccea7bf2b2edbeea0f7700410f7600cd8e.jpeg

Sorry misunderstood you there.

I don’t understand exactly what you want, and why the delay?

On Begin Overlap -> (delay, if you want a time delay) -> FlipFlop -> Load Level
On End Overlap -> Unload Levels

should do the trick, no?

I kind of want to make the player character sit down, and if the player character remains seated for the duration of the delay, then the level will switch. Kind of like a rest delay (hearthstone as an example in wow).

If the player leaves the chair before the delay ends then the switch needs to cancel.

Also i want the player to start in the chair to make them move out of the trigger box and walk around the original level before switching. Thanks.

Just thinking about it maybe describing it as like the wardrobe in narnia would work, where player goes in - enters home zone, walks around, gets back in wardrobe - goes back to home zone.

Ouh, this makes sense. The delay function is not correct for this.

You could use functions like this:
On begin overlay:
Set Triggered true
Make a new float variable called SitTime
Call a function like “Get Game Time” (in s), add 5, store it in the SitTime Variable.

on end overlay:
Set Triggered false

on tick:
If Triggered = true and Get Game Time > SitTime
Call Change Level
Set Triggered = false

if you want an ongoing level change while sitting:

on tick:
If Triggered = true and Get Game Time > SitTime
Call Change Level
delay (5)

e/ Or well, i think you could make it work with the delay too.
On Overlap: set triggered -> delay -> Is still triggered -> Change map

Thank you again for the lighting responses! I’ve got a couple of quick questions?
How can I store the variable in the function? (Is it how I’ve done it in the image below)?
Also Do I need anything inside of the function graph?
65eb49dc14ddf01b7e70775e2584157e95d5f223.jpeg

More like this :slight_smile:

The function is already provided.

gNpYU5m.png

Thanks man, you’ve been so helpful with this! Really appreciate it! :d

No problem.
You could read up timer functions, they’re doing the same i think.

Hi again, I thought I’d show the working graph so far for anyone who might come across this thread in future. I do have some questions in order to extend on this though. I didn’t end up using the timer function in the end as I found it simpler to use the second method you recommended

77e948269bb17a0aec5c4126a09c012429e628c9.jpeg

  1. Is it possible to stop the constant alternation of levels, maybe until the point of exit of the trigger box and then re entry. I would guess further branches using ‘is triggered’ followed by a loop?
  2. Similar to the question above, when event begin play happens how can I make it so the player needs to leave and re enter the trigger-box before the graph begins?