|
|
Re: short animation
[Re: jane]
#342576
09/29/10 12:07
09/29/10 12:07
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
Now the game starts, but when I hit the enemy it shows up a script crash!
|
|
|
Re: short animation
[Re: Random]
#342581
09/29/10 13:59
09/29/10 13:59
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
write the code so similar: ...... while(1) { if(my.hit_by_player != 1) { my.skill1 += 3*time_step; my.skill1 %= 100; ent_animate(me,"stand",my.skill1,ANM_CYCLE); } if(my.hit_by_player == 1) { if(you.animblend == attack_a) { my.skill1 += 3*time_step; ent_animate(me,"hit_a",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_b) { my.skill1 += 3*time_step; ent_animate(me,"hit_b",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_c) { my.skill1 += 3*time_step; ent_animate(me,"hit_c",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_d) { my.skill1 += 3*time_step; ent_animate(me,"hit_d",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_e) { my.skill1 += 3*time_step; ent_animate(me,"hit_e",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_f) { my.skill1 += 3*time_step; ent_animate(me,"hit_f",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } } if((player.animblend == blend) || (player.animblend < attack_a) || (my.animblend > attack_f)) { my.hit_by_player = 0; } wait(1); } ......
write in the posts the text of errorreports
|
|
|
Re: short animation
[Re: jane]
#342764
09/30/10 19:02
09/30/10 19:02
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
So when I hit the enemy;
"script crash in enemy_dummy: SYS"
"enemy_dummy" (thats the name of my enemy action)
|
|
|
Re: short animation
[Re: Random]
#342767
09/30/10 19:52
09/30/10 19:52
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
have you testet the fixed version writen in my post? maybe the error in your version comes from
if(my.hit_by_player == 1) { if(you.animblend == attack_a) { ..... if(you.animblend == attack_b) { ..... if(you.animblend == attack_c) { ....
so non closed if-loops.
is you.animblend doesnt attack_a but attack_b cant attack_b evaluate.
Last edited by jane; 09/30/10 19:53.
|
|
|
Re: short animation
[Re: jane]
#342825
10/01/10 12:32
10/01/10 12:32
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
But I don`t know an other way...
|
|
|
Re: short animation
[Re: Random]
#342826
10/01/10 12:59
10/01/10 12:59
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
The correct way is
if(my.hit_by_player == 1) { if(you.animblend == attack_a) { ..... } if(you.animblend == attack_b) { ..... } if(you.animblend == attack_c) { .... }
Post or PM the complete enemy-script then we can try to help you.
Last edited by jane; 10/01/10 13:10.
|
|
|
Re: short animation
[Re: jane]
#342829
10/01/10 13:40
10/01/10 13:40
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
Nope... here I schow you the hole script;
action enemy_dummy() { set(my,SHADOW); my.entity_type = 2; my.emask |= ENABLE_SCAN; while(1) { if(my.hit_by_player != 1) { my.skill1 += 3*time_step; my.skill1 %= 100; ent_animate(me,"stand",my.skill1,ANM_CYCLE); }
if(my.hit_by_player == 1) { if(you.animblend == attack_a) { my.skill1 += 3*time_step; ent_animate(me,"hit_a",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_b) { my.skill1 += 3*time_step; ent_animate(me,"hit_b",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_c) { my.skill1 += 3*time_step; ent_animate(me,"hit_c",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_d) { my.skill1 += 3*time_step; ent_animate(me,"hit_d",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_e) { my.skill1 += 3*time_step; ent_animate(me,"hit_e",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_f) { my.skill1 += 3*time_step; ent_animate(me,"hit_f",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x; my.move_y = player.move_y; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } } if((player.animblend == blend) || (player.animblend < attack_a) || (my.animblend > attack_f)) { my.hit_by_player = 0; } wait(1); if((player.animblend >= stand && target_enemy == me && player_lock_on == 0) && (player.animblend < attack_a || player.animblend > attack_f)) target_enemy = NULL; if(target_enemy == my && vec_dist(my.x, player.x) > 500) target_enemy = NULL; wait(1); } }
thanks
|
|
|
Re: short animation
[Re: Random]
#342840
10/01/10 14:34
10/01/10 14:34
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
should the enemy goes backward while the player attack?
test the following and report what happens:
action enemy_dummy() { set(my,SHADOW); my.entity_type = 2; my.emask |= ENABLE_SCAN; while(1) { if(my.hit_by_player != 1) { my.skill1 += 3*time_step; my.skill1 %= 100; ent_animate(me,"stand",my.skill1,ANM_CYCLE); }
if(my.hit_by_player == 1) { if(you.animblend == attack_a) { my.skill1 += 3*time_step; ent_animate(me,"hit_a",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_b) { my.skill1 += 3*time_step; ent_animate(me,"hit_b",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_c) { my.skill1 += 3*time_step; ent_animate(me,"hit_c",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_d) { my.skill1 += 3*time_step; ent_animate(me,"hit_d",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_e) { my.skill1 += 3*time_step; ent_animate(me,"hit_e",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } if(you.animblend == attack_f) { my.skill1 += 3*time_step; ent_animate(me,"hit_f",my.skill1,ANM_CYCLE); my.skill1 %= 100; my.move_x = player.move_x * -1; my.move_y = player.move_y * -1; c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE); } } if((player.animblend == blend) || (player.animblend < attack_a) || (my.animblend > attack_f)) { my.hit_by_player = 0; } wait(1); if(((player.animblend >= stand) && (target_enemy == me) && (player_lock_on == 0)) && ((player.animblend < attack_a) || (player.animblend > attack_f))) { target_enemy = NULL; } if((target_enemy == my) && (vec_dist(my.x, player.x) > 500)) { target_enemy = NULL; } wait(1); } }
Last edited by jane; 10/01/10 14:39.
|
|
|
Re: short animation
[Re: jane]
#342842
10/01/10 14:45
10/01/10 14:45
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
The same warning like before... Is there a better way to do this? Becose I only whan`t that the enemy makes the right reaction.
|
|
|
Re: short animation
[Re: jane]
#342855
10/01/10 16:18
10/01/10 16:18
|
Joined: Nov 2008
Posts: 216
jane
Member
|
Member
Joined: Nov 2008
Posts: 216
|
a better way is in the function handle_sword_collision()
by attack_a set you.hit_by_player = 1; by attack_b set you.hit_by_player = 2; by attack_c set you.hit_by_player = 3; and so on
then use
if(my.hit_by_player == 1) if(my.hit_by_player == 2) if(my.hit_by_player == 3) and so on
in the enemy script
EDIT:
ok the problem is the you pointer the fixed script is in the next post
Last edited by jane; 10/01/10 16:56.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|