function onAttack(cid, target)
if #getCreatureSummons(target) >= 1 then
doMonsterSetTarget(cid, getCreatureSummons(target)[1])
else
doMonsterSetTarget(cid, target)
end
<script>
<event name="attackchange"></event>
</script>
it must be called "attackchange"
LUA:function onAttack(cid, target) if #getCreatureSummons(target) >= 1 then doMonsterSetTarget(cid, getCreatureSummons(target)[1]) else doMonsterSetTarget(cid, target) end
now to call the script when the monster attack you will need do this.. for ALL monsters =(
Now in all monsters:
Code:<script> <event name="attackchange"></event> </script>
...didn`t test it...