Is it possible to walk an enemie during attack

jonsilva

New member
hello

ive made an enemie that uses a machine gun
is it possible to make him move while is in an attack animation ?

like in a walk or idle animation where he walks around or chases the player ?

 
You can just make the walk animation shot bullets instead.

Or you can try walk#, don't forget to set maxwalks in models.txt.

#walk shoot animation
walk2
range blahblah
....



Another solution is making a turret entity(usually upper body), bind it to your main entity(legs, for example). But this is a bit complicated, say, if you are making a tank, it is worthy a try.
 
Take a look at Bloodbane's Contra module; it has walk/shoot. I haven't cracked it open myself, but it probably contains an example of one or more of the solutions Utunnels mentioned.

DC
 
ive tried using the walks animations but he changes to idle very quickly
also tried idle2 idle3 but its the same thing
with @cmd attack1 -340 -80 60 "ANI_walk3" the animation plays fine but he doesnt move...

using @cmd spawnGun to bind the gun then use @cmd killgun
seems the best way...
i just cant seem to get the @cmd killgun working in the death anim
it only works in the same animation

but in the gijoe mod it seems to be working fine in death anim ?!?!
i must ve missed something

the attack movement in contra seems to be working only for the player when a key is pressed he moves, i dont think it will work for enemies this way...
 
I think you should be focusing on enemy AI instead. Does enemy always move after putting weapon on his/her arm? or he/she simply shoots while randomly moving?

I was thinking of changing enemy's weapon model in which he/she holds and shoots weapon in his/her WALK animation. Haven't tried this myself though
 
the enemy always have the gun in is animations, i removed the walk animation so he could move on idle.
i ended using spawngun so that when he dies the gun disapears...

iam using this for a few veichles
the walk2 animation dindnt work because he switches to idle before the animation finishes...

but if you use @cmd attack1 in walk animation he attacks moving in the direction he was walking but doesnt follow the player
i ended up using this type of attack for a bike enemy with a range of -100 100 60 and speed of 14


the problem i had with the moving while shooting was i made the veichle gif sprites with the gun on it then i saw it would look better if he moved while shooting... so all the sprites i made wore wastefull, i ended up using only 4 sprites for idle and spawngun the machinegun 
 
I have problem when i want to make my character to maintain his walk velocity while attacking, hes on skateboard and i want to be able to move when shooting apple, i could make it with velocity and keypress detection in attack1 but it only lets me do left/.right, what about diagonals? Is there some specific aiflag that lets me turn attack into walking animation ?
Tried with walk2 anim, pefrormattack to walk2 and nothing, change anim from walk to walk2 when attack is pressed, still character wont move.
Do i have to manually recreate all walking directions myself to do this?
 
@bWWd -- MatMan gave me a script for this, you will have to adjust the 'tossself' values to suit your needs.  Declare as keyscript.
It will let you keep moving while attacking, I use it for DOOM mod.

Code:
// Script for moving while attacking.

void main(){
  // get variables ready
  int player = getlocalvar("player");
  
  void self = getplayerproperty(player, "ent");
  int anim = getentityproperty(self, "animationid");
  //I'm sure there is a better way of doing this but....
  if ( anim == openborconstant("ANI_Attack1" )
      || anim == openborconstant("ANI_Attack2")
      || anim == openborconstant("ANI_Attack3") ) {

    if ( checkkeycombo(self, "UF", 0) ) {
      tossself(0, -1, 0, -0.5);
    } else
    if ( checkkeycombo(self, "UB", 0) ) {
      tossself(0, 1, 0, -0.5);
    } else
    if ( checkkeycombo(self, "DF", 0) ) {
      tossself(0, -1, 0, 0.5);
    } else
    if ( checkkeycombo(self, "DB", 0) ) {
      tossself(0, 1, 0, 0.5);
    } else
    if ( checkkeycombo(self, "F", 0) ) {
      tossself(0, -1, 0, 0);
    } else
    if ( checkkeycombo(self, "B", 0) ) {
      tossself(0, 1, 0, 0);
    } else
    if ( checkkeycombo(self, "U", 0) ) {
      tossself(0, 0, 0, -0.5);
    } else
    if ( checkkeycombo(self, "D", 0) ) {
      tossself(0, 0, 0, 0.5);
    }
  }

}

I'm not sure about the walk2 thing, extra walks only play when enemies are on screen, could be part of the problem.
 
what is checkkeycombo ? engine crashes on it
So looks like there is no way to just give the attack walking aiflag to continue walk, i tried running aiflag but also doesnt change anything.
From what i see this is entire walk replicated with all possible combinations and there is no other way ?
If i wont give my character walking animation then hes using idle as walking, how i can use this to make my attack as walking ? Id like to know what aiflags idle has when it happens
 
Ah sorry forgot you need to include aniscp.c (attached the file)

Code:
// Script for moving while attacking.
#include "data/scripts/aniScp.c"

this script is probably not compatible with latest builds either thou sorry.

When the script works thou, you can keep moving while attacking, it keeps playing whatever animation you were in while you move. So if you shoot and keep pressing forward char will keep playing shooting animation and keep moving forward.


[attachment deleted by admin]
 
thanks, well... i knew it could be done like this but i was hoping for something less hacky, recreating and checking all possible inputs and combinations to have one moving attack is IMO counterproductive , maybe if i would like to have completely different movement scheme for entire character then recreating it again with script like that would be understandable, i hope one day something will change, also i would like to have separate velocity for up/down/left/right, now we have only one velocity for movement, of course this could be changed by adding some velocity in animations but what about diagonals again which creates new and new problems, all that could be solved by letting us turn whatever animation into walk animation, theres no such aiflag to do this yet.
 
Yeah I know what you mean, my mod is just a shooter so there's only a few attacks, and the type of movement actually suits doom.

Maybe take a look at this, I haven't been able to test it properly myself yet thou. My first attempt diddn't work.

http://www.chronocrash.com/forum/index.php?topic=557.0

maybe something along these lines is more what you want.
 
There're more things to do if you use that solution.
At least, you need to create two versions of attack animation, one for walking, another for standing. So you need to switch between them.

 
Back
Top Bottom