the player is not initialised yet

make a wait at the beginning:

action enemy_fight // attached to the enemy
{
wait(1);



or:

action enemy_fight // attached to the enemy
{
while(player==null){wait(1);}