|
A6 enemy attack issue, help please...
#288246
09/04/09 23:25
09/04/09 23:25
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
ok, so i have an enemy that attacks. it comes in close to attack, but after it attacks, it "hops" backward a bit. any idea why? it does it everytime it attacks. thanks in advance,Blink.
action abigail
{
enemy_events();
g3_handle_radar();
var move_dist[3];
var distance;
my.enable_entity = on;
my.enable_impact = on;
my.albedo=0;
my.ambient=100;
my.unlit=on;
my.bright=on;
my.enable_scan = on;
my.polygon = on;
my.enable_block=on;
my.transparent = on;
my.enable_shoot = on;
my.health = 10;
my.event = enemy_events;
vec_set (temp, my.x);
temp.z -= 1;
my.skill11 = c_trace(my.x,temp,IGNORE_ME|IGNORE_PASSABLE);
my.z = my.skill11+0;
c_setminmax(my);
wait(1);
while(plBiped01_entity == null) { wait(1); }
while(my.health > 0)
{
distance = vec_dist(my.x, plBiped01_entity.x);
if(distance < 1000) // the player approaches the enemy
{
vec_set(temp, plBiped01_entity.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;
move_dist.x = 5 * time_step;
move_dist.y = 0;
move_dist.z = 0;
c_move(my,move_dist,nullvector,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MAPS);
ent_animate(my, "walk", my.skill19, ANM_CYCLE); // play run frames animation
my.skill19 = cycle(my.skill19+48*time_step,0,101); // "run" animation speed + loop animation
ent_playsound (my, ghostwalk, 100);
if(distance < 150) // if the player comes closer than 50 quants attack him
{
my.skill23 = 0; // reset "attack" frames
while(my.skill23 < 100)
{
c_trace (my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);
create_explosions();
ent_animate(my,"attack",my.skill23,ANM_CYCLE); // play attack frames animation
my.skill23 += 20 * time_step; // "attack" animation speed
you = plBiped01_entity;
you._armor__003 -= 1 * time_step;
wave_handle = snd_play(wave, 100, 0);
snd_stop(wave);
wait(1);
if(you._armor__003 < 0)
{
you._health__003 += you._armor__003;
you._armor__003 = 0;
PlBiped_Damage_Reaction(); // display damage panel
}
}
wait(6);
}
}
else // the player is farther than 200 quants away
{
ent_animate(my,"stand",my.skill21,ANM_CYCLE); // play stand frames animation
my.skill21 = cycle(my.skill21+2*time_step,0,101); // "stand" animation speed + loop animation
}
wait(1);
}
// enemy was killed:
while(my.skill22 < 90)
{
ent_animate(me,"death", my.skill22, ANM_CYCLE); // play death frames animation
my.skill22 += 16 * time_step; // "death" animation speed
wait(1);
}
my.passable = on; // the corpse can't be hit by the sword from now on
while (my.alpha > 0)
{
my.alpha -= 0.3 * time_step;
wait (1);
}
ent_playsound (my, die, 100);
ent_remove (me);
}
}
Last edited by Blink; 09/04/09 23:26.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: A6 enemy attack issue, help please...
[Re: Dillinger]
#288398
09/05/09 18:48
09/05/09 18:48
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
sorry, i dont quite get what you suggest.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: A6 enemy attack issue, help please...
[Re: alibaba]
#288421
09/06/09 03:57
09/06/09 03:57
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
well, i moved the create_explosions(); out of the while and the enemy doesnt jump anymore, but now when the enemy attacks, it gets stuck on the player while attacking and i cant move. any suggestions?
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: A6 enemy attack issue, help please...
[Re: alibaba]
#288484
09/06/09 19:28
09/06/09 19:28
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
i tried, my polygon=off and no change, but when i increase the distance when to attack, the enemy stops short and injures the player with an attack. i guess i will have to live with it, because i dont want the player to get stuck.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: A6 enemy attack issue, help please...
[Re: Dillinger]
#288638
09/07/09 19:01
09/07/09 19:01
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
i am not sure what the solution can be. i have tried several different ways to get this to work, but no results. my problem is, i have a good enemy code that works, using swords, and fists, and other hand held weapons, but when i change the code to use a projectile type weapon, i get issues. this weapon in particular is not a normal projectile either. i anticipate problems, trying to merge two codes.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
|