RTS style, select unit and move

Hello everyone,

Real-Time-Strategy game style.

I would like a character to be selected with left click and reach a destination simply by pressing right click anywhere. (Not with “follow cursor” method, just click to go to a location). I have already a box selection by dragging but not a selection by a simple click on one character.

Thank you in advance, have a nice day !

On the most fundamental level:

  • click on the character → reference
  • click on the ground → send referenced pawn there

More will be needed to make it an actual gameplay script, ofc.

The above assumes the ground is of WorldStatic object type and characters move on the navmesh.

Do you want a video ? so, you can take into account of my game conditions. Thank you too.

Here is the video of the context of the game, so you can look all the functions.
https://drive.google.com/file/d/1vG7-eIWmyLTvgopmpvsM-QThzkXrqOMA/view?usp=sharing

Not sure what you expect here - it’s a video of a char sliding about.

  • did you implement the script?
  • do you have a navmesh?
  • is the char possessed by an ai controller?
  • what is the movement script

This was to show you what style of this game is it. To also say that the character moves with the selection rectangle but not with a selection by simple click. And for the sliding character, it’s because I haven’t linked the walking animation yet.

There is a Navmesh on the landscape.
The actor is controlled by ai controller.

Post the script that is not working, no one can possibly imagine what you’re doing and how you’re doing it.

These images are blueprints.

The first image is the controlled character.
The second and the third are the controller.
The fourth last ones are the hud-canvas for the rectangle selection.

These blueprints are working. But I don’t understand why the character doesn’t move when I click on the landscape.

If you just click, the start / end point of the rectangle are identical - the resulting array is probably empty (is it? - double check that). Also, I do not not see an implementation of what I suggested above anywhere here.

You may need 2 methods, for selecting groups and for selecting singular units.


Also, consider switching to the Enhanced Input early. Especially if you’re planing on achieving any level of complexity.

And I didn’t tell you. I would like to select several characters by holding down the “Control” key and clicking on the characters.

It’s more easy with the Enhanced input technology ?

What do you advise me to do in order please ?

Incorporate what I originally posted; ideally a better version of it that is using Enhanced Input.

It’s more easy with the Enhanced input

It’s more difficult but, once learnt, it will allow you to accomplish what seems almost impossible with the old input method; which is now also considered legacy and may be phased out in the future.


Alternatively, you could get cheeky → if the rect points end up being identical, shift the end point by 1,1 thus making it a valid selection rectangle. You never confirmed what happens to the unique array when a singular click occurs. I am merely assuming that’s what happens - the array remains empty if the HUD’s rect is a singular point.

Allright, thank you, I understand.
Allright.

I think too, yes.

It’s true yes, why not. I will think about that.

Does that mean I have to delete everything, regarding character selection and character movement ?

After that, I should figure out how to make the blueprints, but that’s another story. I’d have to figure it out and think with the input nodes.