Trying to create base effects for weapons that run custom scripts when I strike a target.
The problem is... I need to know the target I'm striking, and the only way I see to do that is with the player.GetCombatTarget function.
However, this doesn't seem to work very well.
If I strike the target with a melee weapon, which on touch runs a script that calls this function, I can get several hits off on the target before the function returns the right ActorID for the target. Why it sometimes works on like the third or fourth strike, I don't know.
Is there a better way to do this? I need the target's ID so I can do things like check if they're a creature, modify their attributes, etc.