Greetings,
In making my warcraft mod, I'm stuck with
"how do I call a player's race_attack skill, with abstraction as key?". The easiest way would be to have the player's
race_attack skill have a specific format (#RACENUM#_skill_attack_#NUM#), and then call that function via a formatted string.
The only way I know to call a function via a formatted string is by set_task. However I need to execute that function
immediately, not 0.1 seconds after (0.1 seconds is fine for spawn-related functions, but I need immediate results when it comes to player_hurt).
So, how do I do something like the following:
PHP Code:
new fncCall[20];
...
format(fncCall, charsmax(fncCall), "%s", "myFunc");
callFunc(fncCall, args[]);
...
public myFunc(args[]) {}
My other option is to loop through every race, comparing the user's race id and then executing the correct one, but I'd rather not do that on every player attack.