Perhaps, if the player is added first in WED, before the enemies, the error is not produced.
Regardless, there should be a check against NULL for the player pointer.
trade out the entire function:
Code:
/*******************************
	enemy_fight
		ai_a1
		enemy / ai action
*******************************/
action enemy_fight { // attached to the enemy
	ai_e1 = me; // I'm the enemy
	my._hp = ai_nHpD; // and I have 100 _hp
	zotf_new();
	while (ME != NULL)  { // as long as I'm alive
		if (my._hp <= 0) { break; }
		if (player == NULL) { goto(fNullPlayer); }
		if ((vec_dist (my.x, player.x) < ((my.max_x - my.min_x) * ai_nAlertDist))
		 && player._hp > 0)  {// the player approaches the enemy
			vec_diff(temp, player.x, my.x);
			vec_to_angle(my.pan, temp);
			my.tilt = 0; // I'm a maniac
			
			ai_vDist.x = 5 * time_step;
			ai_vDist.y = 0;
			ai_vDist.z = 0;
			zotf_st(_WALK);
			ent_move(ai_vDist, nullvector);
			zotf_ani(ani_nSpWalk, 1);
			if (vec_dist (my.x, player.x) < (my.max_x * ai_nAtkDist)) { // if the player comes closer than 50 quants attack him 
				zotf_st(_ATK1);
				while (my._anip < 100){
					//if (my._atkTm <= 0) {
						wpf_trace();
						//my._atkTm = 16 * 6;
					//}
					zotf_ani(ani_nSpAtk, 0);
					wait (1);
				}
			}

		} else { // the player is farther than 200 quants away
			zotf_st(_STAND);
			zotf_ani(ani_nSpStand, 1);
		}
		fNullPlayer:
		wait (1);
	}
	zotf_die();
}

If the player pointer is NULL, or becomes NULL, execution should skip to label fNullPlayer, over the rest of the code, then to wait(1), and back to the while evaluation.
This should remove the error.
Perhaps, that 'solution' is superior to a one time check (while(player == NULL) { wait(1); }).
Quote:
i had to add the font, so that error was fixed

The font had to be added to the images folder here also.
The source of the original snippet in this thread, probably wasn't found here.
It was assumed, that resource file and others were already added there.
If error solved, well done, all the same.