There is a mistake in the code.
I'm not sure why the compiler does not report an error:
Code:
action enemy_fight // attached to the enemy
{
while(plBiped01_entity==null){wait(1);}
distance = vec_dist (my.x, plBiped01_entity.x);
enemy = me; // I'm the enemy
enemy.healthpoints = 100; // and I have 100 healthpoints
while(!plBiped01_entity) { wait(1); } // wait until the player exists
{
Can you see it?
Do you see it now:
Code:
while(!plBiped01_entity) { wait(1); } // wait until the player exists
{
It should be:
Code:
while(!plBiped01_entity) { wait(1); } // wait until the player exists
while(my.healthpoints > 0)
{
Furthermore you may replace these lines:
Code:
enemy = me; // I'm the enemy
enemy.healthpoints = 100; // and I have 100 healthpoints
With this:
Code:
my.healthpoints = 100;
The enemy = my; stuff makes only sense if you have on enemy at a time.
But its useless if you use many enemies.