Download

Breaking my delay

Ok guys I have run into a slight issue and I need a bit of help.
Basically, I would like to be able to use another skill and not have to wait for my delay to complete;which is why I attached a destroy component module to the corresponding keys. Sadly the way I have this set up forces me to wait for the delay to finish before I can destroy the particle. This issue also translates over into changing my mesh too early when using another skill mid way through the delay. How can I break my delay?

Have you tried using a “Retriggerable Delay” instead of Delay, it should allow you to break the delay early when another attack is performed, which would then reset the delay.

I could be wrong as I have never tried it, but that is what I would try first to see if it works how you want it to. Hope that helps! :slight_smile:

You can circumvent your delay with another execution wire tied to whatever event or function you want to destroy the component early with. Probably put a Do N node there too so when the delay fires it won’t get through.

I think a retriggerable delay will just reset the countdown and not actually break it.

Zues is 100% correct, thanks anyway Dot. You would think you could just hit it with a boolean and that would be the end of it but Nothing but a blank here. bah.

Also, I just remembered a little thing called a gate. Ill post my solution in a few minutes… you know assuming more bugs do not arise.

Okay, I still have the issue of the particle not being destroyed when I activate another skill, I got to say this is frustrating as all hell. By the way the gate does work but for some reason I just cant get rid of this particle effect it just seems to want to stay the full five seconds no matter what I do. Any thoughts?

244c3e570640af121e3c362e712e321975b56b3e.jpeg

Put some print screens at various points and make sure the destroy component is being called when it is supposed to be called.

What you can do is, you don’t need to set up a delayed destroy like that, since a particle system has a built in destroy function. In your particle system check the box “Kill on Completed”. You can time your system to be 5 seconds and have it kill itself.

So, then for the “forced” destroy before those 5 seconds run out, you can set an object variable for the spawned system and when you wanna destroy it within another event, get that variable and destroy it directly.

Have you tried using the Timer and call a CustomEvent when it completes instead? the completing event could always check a bool that you set to see if if should execute.

This should work. When you spawn a particle in you store a reference to it in a variable. You would however destroy the reference in the variable before spawning in the new one. If you enable auto destroy it will automatically destroy the particle system when its played out. The destroy node is there in case your spawning in a new particle so you can destroy the old one. No need for a delay. Hope this helps.

8724aa9c483300a02372515d90ef8a2e324dbb32.png

Hi. I have a similar question. My character is followed by a monster, so, in order to kill him, she needs to place magic traps by casting a spell. Now, when I press F, the character starts casting the spell. After a time, a rune(actor with a decal) appears on the ground, which explodes when monster goes in it. Now, I want that if the player presses W,A,S,D while the character is casting the spell, she starts walking, and the rune never appears on the ground. (because the spell is interrupted). How to break the delay in order that spell could be interrupted ?

Branch after the delay based on whether the spell was interrupted or not. Then you can set your bool based on whatever conditions could interrupt a cast.

You could create a custom event or event dispatcher in your spell blueprint that could receive notice of spell interruption and then you could call that from anywhere that it would make sense.

@Derzo made a really handy node i have yet to try. Check it out here.

Not sure if its exactly what you need but im sure with slight tweaks you can make good use of it.

Cheers

The problem is that if I add a branch after the delay, altough the spell won’t be casted, my character will play the animation completely, it won’t skip to Animation Mode node. Delay is about 6.5 seconds, same as the montage/animation.

I have tried to do another thing. The whole animation(montage) is 4.5 seconds. I added a for loop with break. The first index is 1, last 45. Inside the loop body, there is a branch and a delay, of about 0.1 seconds. If no key is pressed, the delay happens, after that the loop starts again, and again, until it reaches index 45. After that, the trap is spawned. If a key is pressed, the loop is broken, and animation blueprint continues to work. However, now the spellcast animation is not played anymore, or plays for an extremely short time. What to do ?

I even tried to use a timeline, but still not working. The character plays the animation till the end, no matter what key I press, and the trap isn’t spawned…44d0070541df989ef6b2d292bf5757d2bb51de6b.jpeg

I haven’t dealt with animations, but surely there should be a way to turn off the animation which you would do whenever your custom event setting the interrupt bool would be called.

If an animation can’t be called to stop midway then maybe you need to set up your animations to have breakpoints and run along a timeline or something? Not sure all the options available, but logically you just need to call for animation end at the same time you set the bool for the branch.

I have found a solution. After Play Animation node, I used a sequence node. Firstly, it opens a gate. Secondly, it starts a delay, that at the end it fires into the gate input. While casting the spell, if you move, a sequence closes the gate, and Sets animation mode to animation blueprint. It works fine now.
c3ea62884db53b82653e9e20042cbdc00927d4b5.jpeg