nice!
video looks like from The Settlers 2.
That is how I would do it too, with one difference:
Instead of doing
script.HitByWeapon
if (parried ...
I would put that into the gadget like
gadget:UnitPreDamaged()
if (meleeUnits[unitID].parried ...[/i]
You can start the animations from the gadget.
One problem might be that
gadget:UnitPreDamaged() does not get the direction of the attack. Maybe
GetUnitHeading could be used to see if attacker/defender are facing each other etc.
Advantage would be to only have animation stuff in the unitscript while the logic stuff would be in all in the gadget. (and not multiple times in several unit scripts, so if you change something there it just needs to be changed in one place)
just wondering is
MeleeAnimations=function()
the same as
function MeleeAnimations()
or what does this do?