I was thinking more from the players perspective, could even be player vs player.
I need to set up targeting.
And then I need a system for handling attacks. checking range and line of sight.
Then it needs to perform that attack, calculate damage.
If your doing both ranged and melee good luck, took me a couple weeks to setup the system [for the first , rebuilding it now takes less than a day] to my liking for just the player side (and that’s not auto aiming when button is pressed), not including the AI. Biggest pain is setting animation/attack sequence. Right now there is a memory leak in 4.10 so you can’t get too much work testing small edits before having to save then shutdown then reopen. The leak is fixed in 4.11 preview but that version has other issues… If possible I would focus on other things. Like building/designing the map the characters play on.
Add an actor on clicked event that assigns the clicked pawn as the currentTarget variable. This gives you access to its stat block, position, etc.
Set up bool checks for melee or ranged attacks. If melee, apply a move command to the currentTargets position minus an offset. If ranged, do a raytrace from your player to the currTarget and see if its the first target hit (the lenght of the trace already covers attack/cast range). If valid, run the attack function.
For setting up atracks, it depends on how you store the stat block, health, etc of the pawns in your game. But each pawn should ALWAYS have a reference pointing to its specific and unique stats.
Once the overhead is setup, its a simple matter of:
Making an “attack” function that:
a. Checks if the attack is valid (is on cooldown?, oom?, invulnerable target? Flying target? Ally? In range? Etc.)
b. Subtracts the necessary costs (wep durability, ammo, mana etc.)
c. Applies whatever effects the attack has (damage, debuff) by accessing currTarget’s stat block using the relevant routines ( get functions, cast to, etc).
d. Optional: the server validating if everything is in order and replicating the relevant changes