Need help with Running attack code

PS_VITA

Active member
Hi - For whatever reason the player character wont stop running after he performs a run cancel attack.

Here's the code  for the running animation

Code:
anim run
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "Subject_to_Platform", 1);
    }
    if(frame==1){
      changeentityproperty(self, "Subject_to_Platform", 1);
    }
    if(frame==2){
      changeentityproperty(self, "Subject_to_Platform", 1);
      changelevelproperty("scrollspeed", 1);
    }
    if(frame==3){
      changeentityproperty(self, "Subject_to_Platform", 1);
    }
    if(frame==4){
      changeentityproperty(self, "Subject_to_Platform", 1);
    }
    if(frame==5){
      changeentityproperty(self, "Subject_to_Platform", 1);
    }
@end_script
	loop	1
	delay	9
	offset	77 170
	bbox	60 55 40 100
	cancel 0 5 0 A2 freespecial38
	cancel 0 5 0 A3 freespecial53
	cancel 0 5 0 A4 freespecial53
        cancel 0 5 0 S  freespecial42 ###########################why wont the running animation stop?
	frame	data/chars/billy/r1.gif
	frame	data/chars/billy/r2.gif
	sound data/sounds/step1.wav
	frame	data/chars/billy/r3.gif
	frame	data/chars/billy/r4.gif
	frame	data/chars/billy/r5.gif
	sound data/sounds/step1.wav
	frame	data/chars/billy/r6.gif

All "cancel "attacks will stop the running animation after they are done animating even if I'm holding left or right.
except for one which is named (cancel 0 5 0 S freespecial42) - this one continues to run even after the animation of that attack is over if I continue to hold left or right, and I don't want that.

This is the code for Freespecial42

Code:
anim freespecial42 # special jumpattack
	loop	0
	delay	7
	offset	77 140
	jumpframe 0 5 3
	dropframe 2
	landframe 10
	hitfx  data/sounds/beatt2.wav
	@cmd    degravity -1
	frame	data/chars/billy/j1.gif
	frame	data/chars/billy/jk1.gif
	sound data/chars/billy/dragon2.wav
	frame	data/chars/billy/special3.gif
	delay	6
	attack  80 85 63 55 20 1
	dropv 3 3
	forcedirection -1
	@cmd    degravity -1.5
	frame	data/chars/billy/special4.gif
     	bbox	60 90 40 50
	frame	data/chars/billy/special4.gif
	delay	7
	offset	77 155
	attack  0 0 0 0 0 0
	frame	data/chars/billy/sp5.gif
	frame	data/chars/billy/sp5.gif
	frame	data/chars/billy/sp5.gif
	frame	data/chars/billy/sp5.gif
	delay	500
	frame	data/chars/billy/sp5.gif
	offset	77 170
	delay	4
	@cmd    degravity -1
	@cmd	dasher 1.5 0 0
	frame	data/chars/billy/rise2.gif
	frame	data/chars/billy/rise2.gif
	@cmd	dasher 1 0 0
	frame	data/chars/billy/rise2.gif
	frame	data/chars/billy/rise2.gif
	@cmd	dasher 0.5 0 0
	frame	data/chars/billy/rise2.gif
	frame	data/chars/billy/rise2.gif
	@cmd	dasher 0 0 0
	frame	data/chars/billy/j0.gif
        frame	data/chars/billy/idle.gif


EDIT:

Here's an example of one of the running attack that works correctly by not letting the player continue the run animation
by holding left or right after the freespecial38 attack is over.

Code:
anim freespecial38 # runattack 2
	loop	0
	delay	3
	offset	77 170
	bbox	60 55 40 100
	hitfx  data/sounds/beatt2.wav
	@cmd changeentityproperty getlocalvar("self") "aiflag" "running" 0
	@cmd	dasher 2 0 0
	frame	data/chars/billy/aa1.gif
	frame	data/chars/billy/aa1.gif
	frame	data/chars/billy/aa1.gif
	frame	data/chars/billy/aa1.gif
	attack  90 95 72 34 20 1
	dropv 3.5 3
	@cmd	dasher 2.5 0 0
	frame	data/chars/billy/ra3.gif
	frame	data/chars/billy/ra3.gif
	@cmd	dasher 2 0 0
	frame	data/chars/billy/ra3.gif
	frame	data/chars/billy/ra3.gif
	@cmd	dasher 1.5 0 0
	frame	data/chars/billy/ra3.gif
	frame	data/chars/billy/ra3.gif
	attack  0 0 0 0 0
	@cmd	dasher 1 0 0
	frame	data/chars/billy/ra3.gif
	frame	data/chars/billy/ra3.gif
	@cmd	dasher 0.5 0 0
	frame	data/chars/billy/ra2.gif
	frame	data/chars/billy/ra2.gif
	frame	data/chars/billy/ra2.gif
	delay   6
	@cmd	dasher 0 0 0
	frame	data/chars/billy/idle.gif

Any help would be appreciated.
 
Your first attack has a jumpframe on frame 0 and the others don't. There is a switch in running parameters that allows you to continue running after a jump, and that's most likely what's happening here. Either disable post jump running for the model, or add a single frame of delay 1 at start of your culprit animation and move the jumpframe from 0 to 1.

DC
 
Damon Caskey said:
There is a switch in running parameters that allows you to continue running after a jump, and that's most likely what's happening here.

This is what the running parameters are  - the zero value at the end should stop the running after the attack was performed according to the manual, correct?

Code:
name	billy
health	100
speed	25
type	player
shadow	1
grabdistance 40
jumpheight 6.5
antigravity -100
height 120
running 35 6.5 1.5 1 0
jumpspeed 20
nodieblink 1
falldie    2
noquake 1 1
makeinv 2 2
bounce 1
risetime 135 -50


Damon Caskey said:
... or add a single frame of delay 1 at start of your culprit animation and move the jumpframe from 0 to 1.

DC

I modified the code to the following and I'm still able to run after the attack is perfomed

Code:
anim freespecial42 # special jumpattack
	loop	0
	delay	7
	offset	77 140
	jumpframe 1 5 3
	dropframe 2
	landframe 10
	hitfx  data/sounds/beatt2.wav
	@cmd    degravity -1
	frame	data/chars/billy/j1.png
	frame	data/chars/billy/jk1.png
	sound data/chars/billy/dragon2.wav
	frame	data/chars/billy/special3.png
	delay	6
	attack  80 85 63 55 20 1
	dropv 3 3
	forcedirection -1
	@cmd    degravity -1.5
	frame	data/chars/billy/special4.png
     	bbox	60 90 40 50
	frame	data/chars/billy/special4.png
	delay	7
	offset	77 155
	attack  0 0 0 0 0 0
	frame	data/chars/billy/sp5.png
	frame	data/chars/billy/sp5.png
	frame	data/chars/billy/sp5.png
	frame	data/chars/billy/sp5.png
	delay	500
	frame	data/chars/billy/sp5.png
	offset	77 170
	delay	4
	@cmd    degravity -1
	@cmd	dasher 1.5 0 0
	frame	data/chars/billy/rise2.png
	frame	data/chars/billy/rise2.png
	@cmd	dasher 1 0 0
	frame	data/chars/billy/rise2.png
	frame	data/chars/billy/rise2.png
	@cmd	dasher 0.5 0 0
	frame	data/chars/billy/rise2.png
	frame	data/chars/billy/rise2.png
	@cmd	dasher 0 0 0
	delay	1
	frame	data/chars/billy/j0.png

I'm also posting the billkey.c  - code just in case it has anything to do with my issue.

Code:
void main()
{
    int  plIndex = getlocalvar("player");
    void vEnt = getplayerproperty(plIndex, "entity");
    void vAniID = getentityproperty(vEnt,"animationID"); //Get current animation ID
    int animpos = getentityproperty(vEnt,"animpos");

    int attack = playerkeys(plIndex, 1, "attack");
    int attackH = playerkeys(plIndex, 0, "attack");	
    int attack2 = playerkeys(plIndex, 1, "attack2");
    int attack2H = playerkeys(plIndex, 0, "attack2");
    int attack3 = playerkeys(plIndex, 1, "attack3");
    int attack3H = playerkeys(plIndex, 0, "attack3");
    int special = playerkeys(plIndex, 1, "special");
    int specialH = playerkeys(plIndex, 0, "special");
    int jump = playerkeys(plIndex, 0, "jump");
    int jumpH = playerkeys(plIndex, 1, "jump");
    int right = playerkeys(plIndex, 1, "moveright");
    int rightH = playerkeys(plIndex, 0, "moveright");
    int left = playerkeys(plIndex, 1, "moveleft");
    int leftH = playerkeys(plIndex, 0, "moveleft");
	
    if((jumpH && attack2) || (attack2H && jump)){
      if (vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_UP")){ //In valid animations?
	performattack(vEnt, openborconstant("ANI_freespecial21"));
      }
    }

    if((attack && attack2) || (attackH && attack2H)){
      if (vAniID == openborconstant("ANI_IDLE")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial35"));
      }
    }

    if(((attack && attack2) || (attackH && attack2H)) && ((left || leftH ))){
      if (vAniID == openborconstant("ANI_WALK")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial41"));
      }
    }

    if(((attack && attack2) || (attackH && attack2H)) && ((right || rightH ))){
      if (vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_UP")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial41"));
      }
    }



if(((special) || (specialH)) && ((left || leftH ))){
      if (vAniID == openborconstant("ANI_WALK")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial41"));
      }
    }


if(((special) || (specialH)) && ((right || rightH ))){
      if (vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_UP")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial41"));
      }
    }



    if(attack){
      if (vAniID == openborconstant("ANI_freespecial35") && vAniID != openborconstant("ANI_freespecial36") && vAniID != openborconstant("ANI_freespecial37") && animpos >= 2 && animpos <= 5){ //In valid animations?
	performattack(vEnt, openborconstant("ANI_freespecial36"));
      }
    }

    if(attack2){
      if (vAniID == openborconstant("ANI_freespecial35") && vAniID != openborconstant("ANI_freespecial36") && vAniID != openborconstant("ANI_freespecial37") && animpos >= 2 && animpos <= 5){ //In valid animations?
	performattack(vEnt, openborconstant("ANI_freespecial37"));
      }
    }

    if((attack && attack2) || (attackH && attack2H)){
      if (vAniID == openborconstant("ANI_RUN")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial42"));
      }
    }


    if((jumpH && attack3) || (attack3H && jump)){
      if (vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_UP")){ //In valid animations?
        changeentityproperty(vEnt, "velocity", 0, 0, 0);
	performattack(vEnt, openborconstant("ANI_freespecial17"));
      }
    }
}


EDIT: I figured it out ----        @cmd changeentityproperty getlocalvar("self") "aiflag" "running" 0
had to be added to work.

Thanks
 
Back
Top Bottom