3 registered members (Ayumi, Akow, monk12),
1,413
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Problem: Emty Pointer
#230306
10/04/08 17:18
10/04/08 17:18
|
Joined: Feb 2008
Posts: 85 Germany
Schloder87
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2008
Posts: 85
Germany
|
I GOT A PROBLEM with this action, i always get an EMTY POINTER when i start it.
action enemy_fight // attached to the enemy { enemy = me; // I'm the enemy enemy.healthpoints = 100; // and I have 100 healthpoints c_setminmax(me); vec_set(temp, enemy.x); temp.z -= 4000; Distanz_zum_Boden = c_trace (my.x, temp.x, ignore_me | use_box | ignore_passable); Gravitation.z =- Distanz_zum_Boden; // Fuesse der Spielerfigur auf Boden setzen Gravitation.z = max (-50 * time_step, Gravitation.z); // 25 = Fallgeschwindigkeit
while (my.healthpoints > 0) // as long as I'm alive {you = null; if (vec_dist (my.x, player.x) < 500 && player.healthpoints > 0) // 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 smile enemy_distance.x = 6 * time_step; enemy_distance.y = 3* time_step; enemy_distance.z = 0;
c_move (my, Gravitation, nullvector, ignore_passable); c_move (my, enemy_distance, nullvector, glide | ignore_passable);
ent_cycle("run", my.skill19); // play walk frames animation
my.skill19 += 7 * time; // "walk" animation speed if (my.skill19 > 100) {my.skill19 = 0;} // loop animation if (vec_dist (my.x, player.x) < 60) // 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, 1256); // sword tip vertex coords - get the value in Med ent_vertex(my.sword_base, 1114); // 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; effect (particle_blood, 1, target, normal);} } ent_cycle("punch", 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("idle", 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 { my.event = null; my.enable_shoot = on; my.enable_scan = on; ent_cycle("die", my.skill22); my.skill22 += 6 * time; wait(1);} my.passable = on; wait(90);
blutlache(); }
|
|
|
Re: Problem: Emty Pointer
[Re: Schloder87]
#230396
10/05/08 10:01
10/05/08 10:01
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
action enemy_fight // attached to the enemy {
enemy = me; // I'm the enemy enemy.healthpoints = 100; // and I have 100 healthpoints c_setminmax(me); vec_set(temp, enemy.x); temp.z -= 4000; Distanz_zum_Boden = c_trace (my.x, temp.x, ignore_me | use_box | ignore_passable); Gravitation.z =- Distanz_zum_Boden; // Fuesse der Spielerfigur auf Boden setzen Gravitation.z = max (-50 * time_step, Gravitation.z); // 25 = Fallgeschwindigkeit
while(!player) { wait(1); }
while (my.healthpoints > 0) // as long as I'm alive {you = null;
if (vec_dist (my.x, player.x) < 500 && player.healthpoints > 0) // 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 smile enemy_distance.x = 6 * time_step; enemy_distance.y = 3* time_step; enemy_distance.z = 0;
c_move (my, Gravitation, nullvector, ignore_passable); c_move (my, enemy_distance, nullvector, glide | ignore_passable);
ent_cycle("run", my.skill19); // play walk frames animation
my.skill19 += 7 * time; // "walk" animation speed if (my.skill19 > 100) {my.skill19 = 0;} // loop animation if (vec_dist (my.x, player.x) < 60) // 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, 1256); // sword tip vertex coords - get the value in Med ent_vertex(my.sword_base, 1114); // 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; effect (particle_blood, 1, target, normal);} } ent_cycle("punch", 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("idle", 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 {
my.event = null; my.enable_shoot = on; my.enable_scan = on; ent_cycle("die", my.skill22); my.skill22 += 6 * time; wait(1);} my.passable = on; wait(90);
blutlache();
}
|
|
|
|