Freeze Object in motion briefly

New to blueprints, I’m trying to make it so whenever I shoot a target the remaining targets briefly freeze. The code recognizes when “freeze” is set to true but does not set freeze to true whenever a target is shot.


Can it be because you set your variable back to false right after it gets set to true :slightly_smiling_face:

Though I wouldn’t recommend creating a variable for this task but rather a custom event.

Hope this helps! :innocent:

1 Like

Hey there @bageltoo! Welcome to the community! Judging by the way the movement code is setup if Freeze is true it shouldn’t move if freeze is true. However there are a number of issues here.

The first is doing anything after the Destroy Actor is somewhat a gamble, as once an actor is destroyed, it calls to be garbage collected. You don’t want anything executing when this happens as it may not fire anything after the fact depending on how fast it’s collected and what comes after the execution. So usually you’d want to destroy the actor at the end of the operation.

The delay can be causing some issues here. Architecturally you never want to have a delay node in line with event tick. For every frame Freeze is enabled, 1 second later a character is unfrozen. Now this delay is immutable, it will fire no matter what once it’s been triggered, even if the branch changes over. So if you hit a target, maybe even multiple targets, you will get multiple calls to unfreeze them in 1 second, continuously. For cases like this I would use a Set Timer by Event instead. Timers allow you to have more control, such as invalidating them if you need to, pausing them, and even checking their status.

Alternatively you could have a Do Once after the True branch, then reset it when the false branch fires once. Though this could have unforeseen consequences.