try to use this much better
bonus4 bAutoSpellWhenHit,x,y,n,i; n/10% chance to cast skill x of level y when being hit by a direct attack. (supports skill names)
Target must be within spell's range to go off.
i:
0=cast on self
1=cast on enemy, not on self
2=use random skill lv in [1..y]
3=1+2 (random lv on enemy)