hi, i clear the bracket and modified the code in some cases, is equal but more nicely...and i have other error lol, (sorry for the much questions but i am begginer), look the update code:

(the fields in red colour are the updates)

Code:
  
var player_distance; // moves the player
var enemy_distance; // moves the enemy
var distance;

define sword_base = skill12; // using skill12, 13, 14 to store the sword_base coords
define sword_tip = skill15; // using skill15, 16, 17 to store the sword_tip coords
define healthpoints = skill18; // just another name for skill18

entity* enemy;

action enemy_fight // attached to the enemy
{
distance = vec_dist (my.x, player.x);
enemy = me; // I'm the enemy

enemy.healthpoints = 100; // and I have 100 healthpoints
while(!player) { wait(1); } // wait until the player exists
{
if (distance < 200) // the player approaches the enemy
{
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0; // I'm a maniac :)
enemy_distance.x = 5 * time;
enemy_distance.y = 0;
enemy_distance.z = 0;
ent_move(enemy_distance, nullvector);
ent_cycle("walk", my.skill19); // play walk frames animation
my.skill19 += 5 * time; // "walk" animation speed
if (my.skill19 > 100) {my.skill19 = 0;} // loop animation
if (vec_dist (my.x, player.x) < 50) // if the player comes closer than 50 quants attack him
{
my.skill20 = 0; // reset "attack" frames
while (my.skill20 < 100)
{
ent_vertex(my.sword_tip, 291); // sword tip vertex coords - get the value in Med
ent_vertex(my.sword_base, 306); // sword base vertex coords - get the value in Med
trace_mode = ignore_me + ignore_passable;
trace (my.sword_base, my.sword_tip); // trace between these sword positions
if (result != 0) // hit something, could be the player or another enemy
{

if (you != null) {you.healthpoints -= 4 * time;}

}
ent_cycle("attack", my.skill20); // play attack frames animation
my.skill20 += 5 * time; // "attack" animation speed
wait (1);
}
waitt (6); // slows down the enemy and reduces the number of traces per second
}
}
else // the player is farther than 200 quants away
{
ent_cycle("stand", my.skill21); // play stand frames animation
my.skill21 += 2 * time; // "stand" animation speed
if (my.skill21 > 100) {my.skill21 = 0;} // loop animation
}
wait (1);

while (my.skill22 < 80) // the enemy is dead
{
ent_cycle("death", my.skill22); // play death frames animation
my.skill22 += 1 * time; // "death" animation speed
wait (1);
}

my.passable = on; // the corpse can't be hit by the sword from now on
}





Good, put me error in ejecution: "Empty pointer in enemy_fight: distance=vec_dist(my.x,player.x)"

Help me please. bye

Last edited by Morph; 02/01/08 18:48.

Begginer in 3D Game Studio