Fix es, several of them, among which 1005 and 548

Fixes 1005 and 548, see NPC in action here :
https://www.youtube.com/watch?v=bixGi_MZYiM
Doesn't fixes baby creatures for the above issues but it can easly be
copied if
one has the time - because in core there are 2 different spawn methods
one for babies and one for normal.
Should fix bug of entering DeathState multiple times.
Enables hooks into core AI code in order to allow for AI customization
from scripts. Includes sample (80% documented) and functional AI script
and the corresponding mobileTemplate changes.