0
\$\begingroup\$

I have a project where by pressing the B key, the character after a time interval is teleported to a point on the map.

I can do this. It turns out that I imposed conditions so that at the end of the time interval the teleportation would be executed successfully.

For example:

  • Pressing the D key prevents the teleportation from happening.

  • Character moves around

It is as if the character must be meditating/channeling/motionless.

To do this correctly I use 2 variables:

  • varCanalizando => becomes true if the B key is pressed / becomes false if the D key is pressed or the character walks.

  • varInterrompeu => becomes true if varCanalizando is true and D key is pressed or the character walks.

enter image description here

Pressing the D key will cancel the meditating/channeling/motionless and the character will not teleport at the end of the time interval.

I can not identify the part of the blueprint that makes the character walk.

But I say almost certainly, that it's not in the TopDownCharacter default code.

The closest I got to something related to the mouse in the blueprint:

enter image description here

I suspect it may be in some of the TopDownCharacter components and I've tried something related based on this post:

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1455206-on-mouse-click-event-won-t-work

My attempt:

enter image description here

I consider it pertinent to inform that I have modified the standard click button from left to right, but I do not know if that is the cause of the problem.

I looked for the event in the component of the character that I found most suspicious, but none of them seems to me correct:

enter image description here


EDIT 1 (attempt)

I tried using the Right Button Mouse, but neither the print worked:

enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

On your character blueprint, there's a movement component which is where all movement is handled. You have two options:

  1. There is a blueprint node called "Get Velocity" which returns a vector. Use this then call Vector length from it like so.

Get Velocity VectorLength image

You can now use a branch to check whether the value is greater than 0 and set varInterrompeu to true.

2: Create a new Vector variable in your character blueprint.

OnTick, check your actor location. If it is not equal (false) to the value of the vector variable, set the new location to this variable and set the varInterrompeu boolean to true.

If it's true, do nothing.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .