Now there is no official best practice or anything but in general I like to split up my coding between controller, character and some other actors like this:
Controller: Here comes all the input events and everything like that. It takes care of the rotation (via control rotation) of the character and does all kinds of checks if your input is valid and what should happen.
Character: This once then receives the input (the “What should happen” from the controller) and actually does something. Here are all variables like HP, Stamina, an inventory… this kinds of stuff. If you work with spells I would also implement those here. If you use a weapon that should be a separate actor.
Weapon: The weapon receives a fire event from the character and handles things like how fast it shoots, ammunition and stuff like this.
Now for a teleport you should do the linetrace as you thought. You will need your controller (either inside of it’s script or the controller as reference) to get the “Hit Result under Cursor” which will provide you with a Hit Result. Break that to get the location of where it hit. This is the location in 3D space where your mouse points at. You can then simply use the function “Teleport” from your character which will take care of pretty much everything. Now you still have to do some checks so you can’t be teleported into nowhere, on top of weird locations, impassable terrain and so on which is a completely different chapter and requires quite a bit…
Quite honestly. If you’re this new to Unreal and I assume coding in general you should stick to some tutorials. Maybe do the temple run clone type of thing which is a rather detailed tutorial on the unreal youtube channel. Once you’re done with that you should be able to add a few functions onto that and build on top of it and then you can come back to your completely own project. Do keep in mind that whatever you do your first few projects will not be finished. You will not even get close and when you come back in a few months you’ll just shake your head about it because it’s so horribly implemented. That’s completely normal since you learn all the time. Just keep your projects small and simple for the beginning. Like really super small… which an RTS or moba is not. Really no offense but I run in exactly the same trap and just deleted those several dozens of hours of work because it was just horrible