Power punch & minor scipt help ( video animation example)

PS_VITA

Active member
let me get this out the way first - my "script" is not a real script - is more of an idea of what I'm trying to do
using some actual openbor terms.

@script
      void self = getlocalvar("self");
      if(frame > 3)&& openborconstant("playerkeys,1,0,attack")){
      performattack(self,openborconstant("ani_freespecial68"));
      }
@end_script



and here's the "power punch" move I'm trying to come up with.

https://i.imgur.com/sy9zJpC.mp4

And here's the "script"

Code:
anim attack1
@script
       void self = getlocalvar("self");
      if(frame > 3)&& openborconstant("playerkeys,1,0,attack")){
       performattack(self,openborconstant("ani_freespecial68"));
       }
@end_script
	loop	0
	delay	8
	offset	77 170
      bbox	60 55 40 100
      @cmd ani0020 openborconstant("ANI_FOLLOW11") openborconstant("ANI_PAIN2")
      @cmd ani0020 openborconstant("ANI_FOLLOW3") openborconstant("ANI_PAIN2")
      @cmd	finisher "ANI_PAIN" "ANI_ATTACK2" 0 180 50 0 0
      @cmd  riseattack3 120 40 "ANI_FOLLOW40"
      frame	data/chars/billy/a1.png
      delay   14
      attack  90 68 60 34 4000 0
      dropv 1.5 1.5
      frame	data/chars/billy/a2.png
      delay   8
      attack  0 0 0 0 0
      frame	data/chars/billy/a3.png

So the animation is split into 3 parts -

the first one happens when attack1 is over and if the player continues to hold down the attack1
it goes into freespecial68 .

the second animation is a basic loop animation that prepares for the final blow

the third animation is the power punch,


full plan of the code including the pretend script

Code:
#Mega Punch

anim freespecial68 # mega punch 
@script
       void self = getlocalvar("self");
      if(frame > 4)&& openborconstant("playerkeys,1,0,attack")){
       performattack(self,openborconstant("ani_FOLLOW81"));
       }
@end_script
	loop	0
	loop	0
	delay	8
	offset	77 170
      bbox	60 55 40 100
      frame	data/chars/billy/hp1.png
      frame	data/chars/billy/hp2.png
      frame	data/chars/billy/hp3.png
      sound  data/sounds/slide.wav
      frame	data/chars/billy/hp4.png



anim follow81 # mega punch part 2
@script
       void self = getlocalvar("self");
      if(frame > 0)&& openborconstant("playerkeys,1,0,attack")){
       performattack(self,openborconstant("ani_FOLLOW82"));
       }
@end_script
      loop 1
      delay 6
      offset 77 170
     bbox	60 55 40 100
     frame	data/chars/billy/hp5.png
     frame	data/chars/billy/hp6.png
     frame	data/chars/billy/hp4.png

     

anim follow82 # mega punch part 3
      loop 0
      delay 6
      offset 77 170
     bbox	60 55 40 100
     attackone 1
     hitfx   data/sounds/maxhit.wav
     frame	data/chars/billy/hp7.png
     frame	data/chars/billy/hp8.png
     frame	data/chars/billy/hp9.png
     attack  90 68 60 34 40 1
     dropv 7.5 1.5
     frame	data/chars/billy/hp10.png
     attack  0 0 0 0 0 0
     frame	data/chars/billy/hp11.png
     frame	data/chars/billy/hp12.png
     frame	data/chars/billy/hp13.png


(If anyone suggests a script please also let me know if I need to load the script in the player header or create a new script and where to put it and what to name it.)

Thank you in advance
 
Hmmm.... although it's crude, I can see the idea of this charging punch.
One thing I notice is that if player holds attack key too long, he might enter charging state. That's good if player wants to do charge punch but not if player wants to perform combo or just one punch.

Is that what you want?
 
Bloodbane said:
Hmmm.... although it's crude, I can see the idea of this charging punch.
One thing I notice is that if player holds attack key too long, he might enter charging state. That's good if player wants to do charge punch but not if player wants to perform combo or just one punch.

Is that what you want?

Maybe this will help

press punch (attack)
index.php
and continue to hold down the attack button.
and this happens next

https://www.fightersgeneration.com/np7/char/gifs/kyo/ex/attacks/kyo-ex-super4.gif

if you let go of punch (attack) this happens...

https://www.fightersgeneration.com/characters2/kyo-dm-kof2000.gif






 
I understand :).

I've coded a simple charging punch system or I should say charging attack system. You can download this:
https://www.mediafire.com/file/ucefadilhloqalw/ramon.rar/file

It's Ramon as player with scripted charge attack.
When playing as him, press attack to start charging then keep holding attack key for around 5 seconds until he changes animation. It's temporary animation to show that he's charging his attack. You can release attack button to let him perform strong kick.

If that's what you want then tell me :)

I can expand the system further to add stronger charge attack if attack key is held longer.
 
Bloodbane
What part of this code makes the game know that Billy released the key?

Billykey.C
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 attack4 = playerkeys(plIndex, 1, "attack4");
    int attack4H = playerkeys(plIndex, 0, "attack4");
    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");


Here's your RAMON CODE for ramon.C

Code:
void main()
{
    int iPlIndex = getlocalvar("player"); //                 Get calling player
    void vSelf = getplayerproperty(iPlIndex , "entity"); //  Get calling entity
    void vAniID = getentityproperty(vSelf,"animationID"); // Get current animation ID
    void vAniPos = getentityproperty(vSelf, "animpos"); //   Get current animation frame

    void iAttack = playerkeys(iPlIndex, 1, "attack"); //New key status of "Attack"

    void iAttackR = playerkeys(iPlIndex, 2, "attack");// Release status of "Attack"

//Alternate action while grabbing
    if(vAniID != openborconstant("ANI_PAIN") && vAniID != openborconstant("ANI_FALL") && vAniID != openborconstant("ANI_RISE")){ // Not being beaten?
      if(iAttack){ //Attack pressed?
        setentityvar(vSelf, 1, openborvariant("elapsed_time"));
      }
    }

    if(iAttackR){ //Attack is released?
      setentityvar(vSelf, 1, NULL());
    }
}

 
This part captures key release event:
Code:
    void iAttackR = playerkeys(iPlIndex, 2, "attack");// Release status of "Attack"

    if(iAttackR){ //Attack is released?
      setentityvar(vSelf, 1, NULL());
    }

  Copy those lines to Billykey.C.

However, the one unleashing charge attack is this script:
Code:
anim	follow1
@script
  if(frame > 0){
    void self = getlocalvar("self");
    int iPIndex = getentityproperty(self,"playerindex");
    void iRKey = playerkeys(iPIndex, 0, "attack");

    if(!iRKey){
      performattack(self, openborconstant("ANI_FOLLOW2"));
    }
  }
@end_script
...

The script checks if attack1 key isn't held instead of release event.

Actually, I could use keyint function from function libraries I have but to simplify the rar, I used animation script version instead. If you have that function, I could show you alternate version with that function.
 
Bloodbane said:
This part captures key release event:
Code:
    void iAttackR = playerkeys(iPlIndex, 2, "attack");// Release status of "Attack"

    if(iAttackR){ //Attack is released?
      setentityvar(vSelf, 1, NULL());
    }

  Copy those lines to Billykey.C.

I got this error

Script compile error in 'entitykeyscript': iPlIndex line 7, column 31

********** An Error Occurred **********
*            Shutting Down            *

Can't compile script 'entitykeyscript' data/chars/billy/billy.txt


Here's the full code

Code:
void main()
{
    int  plIndex = getlocalvar("player");
    void vEnt = getplayerproperty(plIndex, "entity");
    void vAniID = getentityproperty(vEnt,"animationID"); //Get current animation ID
    void iAttackR = playerkeys(iPlIndex, 2, "attack");// Release status of "Attack"
    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 attack4 = playerkeys(plIndex, 1, "attack4");
    int attack4H = playerkeys(plIndex, 0, "attack4");
    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(iAttackR){ //Attack is released?
      setentityvar(vSelf, 1, NULL());
    }
 
Bloodbane said:
Sorry  :-[, forgot this line for keyscript:
Code:
    int iPlIndex = getlocalvar("player");

Bloodbane

I'm still getting an error

Script compile error in 'entitykeyscript': iPlIndex line 7, column 31

********** An Error Occurred **********
*            Shutting Down            *

Can't compile script 'entitykeyscript' data/chars/billy/billy.txt


Here's the new code for billy.c

Code:
void main()
{
    int  plIndex = getlocalvar("player");
    void vEnt = getplayerproperty(plIndex, "entity");
    void vAniID = getentityproperty(vEnt,"animationID"); //Get current animation ID
    void iAttackR = playerkeys(iPlIndex, 2, "attack");// Release status of "Attack" 
    int iPlIndex = getlocalvar("player"); //
    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 attack4 = playerkeys(plIndex, 1, "attack4");
    int attack4H = playerkeys(plIndex, 0, "attack4");
    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(iAttackR){ //Attack is released? 
      setentityvar(vSelf, 1, NULL());
   }

 
  :-[

Ah, I should've been more careful next time...  :-\ . Anyways

sorry for another missing line. You are supposed to include this also
Code:
    void vSelf = getplayerproperty(iPlIndex , "entity"); //  Get calling entity

buuut you already have similar line there:
Code:
void vEnt = getplayerproperty(plIndex, "entity");
    int  plIndex = getlocalvar("player");

To avoid redundancy, you should use this code instead:
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 attackR = playerkeys(plIndex, 2, "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 attack4 = playerkeys(plIndex, 1, "attack4");
    int attack4H = playerkeys(plIndex, 0, "attack4");

    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(attackR){ //Attack is released?
      setentityvar(vEnt, 1, NULL());
   }
}

 
Bloodbane said:
  :-[

Ah, I should've been more careful next time...  :-\ . Anyways

sorry for another missing line. You are supposed to include this also
Code:
    void vSelf = getplayerproperty(iPlIndex , "entity"); //  Get calling entity

buuut you already have similar line there:
Code:
void vEnt = getplayerproperty(plIndex, "entity");
    int  plIndex = getlocalvar("player");

To avoid redundancy, you should use this code instead:
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 attackR = playerkeys(plIndex, 2, "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 attack4 = playerkeys(plIndex, 1, "attack4");
    int attack4H = playerkeys(plIndex, 0, "attack4");

    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(attackR){ //Attack is released?
      setentityvar(vEnt, 1, NULL());
   }
}

Bloodbane

So now that we got that working  and I'm looking into RAMONS Idle animation
I tried to put the code  as the example below but nothing happens when I release the attack button after holding it for a few seconds.

See example below:

Code:
anim idle
@script
  if(frame > 0){
    void self = getlocalvar("self");
    int Chas = getentityvar(self, 1);

    if(Chas <= openborvariant("elapsed_time") - 1000){
      setentityvar(self, 1, NULL());
      performattack(self, openborconstant("ANI_FREESPECIAL57"));
    }
  }
@end_script
     loop 0
     delay 5
     offset 77 170
     bbox 60 55 40 100
     @cmd  clearL
     @cmd  degravity -1
     @cmd  nograb 1
     @cmd  camera
     frame data/chars/billy/idle.png
     @cmd keyclimb "U" "ANI_FOLLOW20"
     @cmd keyclimb "D" "ANI_FOLLOW21"
     @cmd  nograb 1
     frame data/chars/billy/idle.png


This part being your script: Excluding FREESPECIAL57 ( which is my punch charge animation start up)

@script
  if(frame > 0){
    void self = getlocalvar("self");
    int Chas = getentityvar(self, 1);

    if(Chas <= openborvariant("elapsed_time") - 1000){
      setentityvar(self, 1, NULL());
      performattack(self, openborconstant("ANI_FREESPECIAL57"));
    }
  }
@end_script


 
clearL function clears all local variables.
It might cause a mess but for now, just try disabling it to see if charging works.

If disabling that allows charging to work, that means you'll need to clear all used local variables manually.
 
Bloodbane said:
Try disabling @cmd clearL for now and try it again.

It's still not working :(

Why is your piece of code

Code:
@script
  if(frame > 0){
    void self = getlocalvar("self");
    int Chas = getentityvar(self, 1);

    if(Chas <= openborvariant("elapsed_time") - 1000){
      setentityvar(self, 1, NULL());
      performattack(self, openborconstant("ANI_FREESPECIAL57"));
    }
  }
@end_script
attached to the idle animation of Ramon anyways?


should it not be in the attack animation?





Actually the only thing that happens is that Billy does his uppercut animation which happens to be his 3rd animation in the punch combo.

 
That script has to be in IDLE cause that's when Ramon can change into charging animation. Putting in ATTACK1 animation is pointless cause the attack would have ended before charging is sufficient.

Actually the only thing that happens is that Billy does his uppercut animation which happens to be his 3rd animation in the punch combo.

That's the default charge attack. The charging system I've shared above doesn't work like that. It puts player into charging animation first.

BTW when you are charging, are you waiting for charging animation to perform when Billy is in IDLE? or when he's moving?
 
Bloodbane said:
That script has to be in IDLE cause that's when Ramon can change into charging animation. Putting in ATTACK1 animation is pointless cause the attack would have ended before charging is sufficient.

Actually the only thing that happens is that Billy does his uppercut animation which happens to be his 3rd animation in the punch combo.

That's the default charge attack. The charging system I've shared above doesn't work like that. It puts player into charging animation first.

BTW when you are charging, are you waiting for charging animation to perform when Billy is in IDLE? or when he's moving?
  it was Idle Bloodbane

EDIT:
Okay I got the whole thing workings - just the way I wanted
thanks to this post that I spent a few hours reading trough multiple threads :D

http://www.chronocrash.com/forum/index.php?topic=2981.msg40208#msg40208
Thanks to O Ilusionista  asking the question
and Piccolo for all the scripts.
 
Back
Top Bottom