Posted By: carla_mariz
enemy's AI..NOT WORKING!!! - 01/10/11 11:55
pls help me with this problem....
i modified an AI from another source so that i could use it for my project, but when run it there is an error like ERR E1513 "Script crash in ghost" and Malfunction W1501 "Empty pointer in pacman". I dont know where to find that error and now i'm confused.
here is the code:
pls pls pls..help me....
i modified an AI from another source so that i could use it for my project, but when run it there is an error like ERR E1513 "Script crash in ghost" and Malfunction W1501 "Empty pointer in pacman". I dont know where to find that error and now i'm confused.
here is the code:
Code:
action pacman() { player = my; set(my, POLYGON); VECTOR temp; VECTOR player_speed; var anim_percentage; my.health = 100; while(my.health>0) { handle_movement(); c_move(my, player_speed, IGNORE_PASSABLE, GLIDE); ent_animate(my, "frame", anim_percentage, ANM_CYCLE); anim_percentage += 5 * time_step; camera_follow(); wait(1); } } function ghost1(); action ghost1() { VECTOR enemy_speed; VECTOR temp; VECTOR left_arm, right_arm; set(my, POLYGON); my.health = 50; var anim_percentage = 0; var attack_type = 0; var attack_percentage = 0; while(my.health >=0) { c_trace(my.x, player.x, IGNORE_ME | IGNORE_PASSABLE); if(you == player) { vec_set(temp, player.x); vec_sub(temp, my.x); vec_to_angle(my.pan, temp); my.tilt = 0; if(vec_dist(player.x, my.x) >17) { enemy_speed.x = 5 * time_step; enemy_speed.y = 0; enemy_speed.z = 0; c_move(my, enemy_speed, nullvector, IGNORE_PASSABLE | GLIDE); anim_percentage += 8 * time_step; } else { attack_type = 1; if(player.health<=0) { attack_type = 0; } if(attack_type == 1) { attack_percentage = 0; while(attack_percentage < 100) { vec_for_vertex(left_arm, my, 20); vec_for_vertex(right_arm, my, 30); if(c_trace (left_arm, right_arm, IGNORE_ME | IGNORE_PASSABLE)>0) { if(you==player) { player.health -=5 * time_step; } } ent_animate(my, "frame", attack_percentage, NULL); attack_percentage += 8 * time_step; wait(1); } } anim_percentage = 0; while(anim_percentage < 100) { ent_animate(my, "frame", anim_percentage, ANM_CYCLE); attack_percentage += 3 * time_step; wait(1); } } } else { ent_animate(my, "frame", anim_percentage, ANM_CYCLE); anim_percentage += 1* time_step; } wait(1); set(my, PASSABLE); my.alpha = 100; set(my, TRANSLUCENT); while(my.alpha > 0) { my.alpha -= 3 * time_step; wait(1); } ent_remove(my); } }
pls pls pls..help me....