Get objects under mouse position

Hi everybody,

I am trying to achieve the usual top-down game mechanics. i would have moving actors (enemies, monsters, npc’s), static objects (buildings, terrain, item drops).

so i want to find the object under the mouse, figure out what it is, get the player state (casting a spell ?, idle, etc. ) then call the function which does the actions required.

my approach was to add tags to actors then try to get them in the controller bp using get hit result under mouse for objects. but tag system seems really primitive as i have to type it manually, there is no defining a generic tag and select it from the menu. so i guess there is another way to distinguish actors. what would it be ?

i have working tag system in my ability system

tag is an enumerator
i have “tags to target” and “tags to affect” arrays in spell data table
i have a function in game state, which go over tags which ability has as requirement(from data table) and call custom fucntion for each tag

so to add new tag, i need to add new enumerator, create new function(define) the tag and connect new function to switch executable.

how do you get this variable then from actors ?

I found retarded way to handle simple stuff.

actor detect being clicked http://puu.sh/m6gBJ.jpg and set self as recently clicked actor in target system component
since click happens instantly everywhere, doesn’t have clear order and i use left mouse click as main input for everything http://puu.sh/m6gIR.jpg , i wait one frame in target system component and get recently clicked actor (it might be not there, so player clicked on ground, which might be used for abilities which require target is ground) http://puu.sh/m6gKb.png
then i get current targeting ability target tag requirements, clicked actor(which is the target) and source actor(which is caster) and send it to game instance (so it might be made on client and then confirmed on server, i can use same code twice)
game instance just confirms all required tags(for tag “self” as example, i have function which compare target and caster and if they are same, return true) and send the
response to target system, which is do stuff based on this response.

so technically i don’t get object under mouse cursor, i react to object being clicked.

hmm i see, but this doesnt help me.

right now i am using line trace by channel from convert mouse to world space. now i get every actor under mouse position. but still cant think anything else than using the built in tag system which is quite open to mistyping the tag and forces me to remember the tags i used.

key words:
enumerator
data table
for each loop
switch on enumerator

you are basically telling me to create a base bp which has an enum variable and then cast to the base bp and check the enum ? this is too much work and i think is costly.

how do other people do this ? any other suggestions ?

no
but i told you everything, it’s me missing something obvious to help you understand or you dont have core knowledge to understand basic concept.