Walking Block

O Ilusionista

Captain 100K
I want to make a enemy, which carries a shield, to be able to walk while blocking, taking no damage. You just can hit it when its not blocking (walking or not), ie its attacking me.

There is a way to do that?
 
Maybe you can try:

  @cmd changeentityproperty getlocalvar("self") "aiflag" "blocking" 1

And this is the code to turn it off

  @cmd changeentityproperty getlocalvar("self") "aiflag" "blocking" 0

But it depends on how you want the shield to act. If you only want the walk animation to block, you need to turn on blocking in walk animation and turn off in other animations (usually idle, but you can try another if there's any loophole).

 
So is there any way to keep that flag only in this particular animation so when it goes to jump or some other anim it will switch itself back to default state? something like if current anim plays then flag is 1 and if doesnt play then flag is 0, so you dont have to include script in all other possible anims to turn that off.
 
Yes, I just want him to block on walk or idle. All other animations won't block

So I turn on the block on those animations by using
@cmd changeentityproperty getlocalvar("self") "aiflag" "blocking" 1

And turn off on all others, right?
 
yes but i dont think its necessary in fall and pain anims, i used this to disable grabbing  enemies when running like in cadillacs and dinos
 
Or you can have it in entity header using @script tag. The code is executed before any @cmd.

@script
void e = getlocalvar("self");
int aid = getentityproperty(e, "animationid");
if(aid==openborconstant("ANI_IDLE") || aid==openborconstant("ANI_WALK"))
  changeentityproperty(e, "aiflag", "blocking", 1);
else
  changeentityproperty(e, "aiflag", "blocking", 0);
@end_script
 
utunnels said:
Or you can have it in entity header using @script tag. The code is executed before any @cmd.

@script
void e = getlocalvar("self");
int aid = getentityproperty(e, "animationid");
if(aid==openborconstant("ANI_IDLE") || aid==openborconstant("ANI_WALK"))
  changeentityproperty(e, "aiflag", "blocking", 1);
else
  changeentityproperty(e, "aiflag", "blocking", 0);
@end_script

Could you replace blocking with nopain, to make it so that some animations have super armor?
 
Back
Top Bottom