Single button inputs

Ken

New member
Hey guys, I want to make a simple button layout
punch, kick, jump and variations from these buttons like crouching punch and kick, jumping punch and kick, special moves, down forward punch, down up kick, all single moves.

How is this possible? can't find anything in the forum.

[attachment deleted by admin]
 
For alternate attacks, we usually use FREESPECIAL like this:

com A2 FREESPECIAL # Kick

With this command, pressing attack2 will make character performs FREESPECIAL (which should be a kick animation)
For jump kick and crouching kick, you can use cancel like this;

cancel 0 10 0 A2 Freespecial2

Declare that in JUMP or DUCK animation to allow performing FREESPECIAL2 by pressing attack2 in respective animation
 
Thanks Bloodbane, I ran into a problem, crouching punch works fine, even when I press it fast, when I press crouching kick more than twice the standing kick (freespecial) animation plays  :-\

EDIT#

I put cancel 0 10 0 A2 Freespecial2  inside the Freespecial2 animation data also and it stopped the standing kick freespecial, thanks again Bloodbane



[attachment deleted by admin]
 
Read this.

cancel {start frame} {end frame} {hits} {sequence of inputs} {freespecial#}

    ~This command allows animation change by inputting sequence of inputs to certain freespecial. In other word, cancel. Obviously it's only for players.
    ~This command can be declared in any attack animations, jump animations and grab animations. Also it can be declared more than once in same animation for various cancels.
    ~{start frame} and {end frame} defines frames where sequence of inputs is accepted. Inputs entered before {start frame} and after {end frame} will be ignored.
    ~{hits} defines how many hits attackboxes in this animation must hit before cancelling is allowed. It doesn't matter whether the attacks are blocked or not. If you don't want to have this limit, just set it to 0.
    ~{sequence of inputs} defines input sequence required to activate the freespecial. The accepted values here is exactly same with 'com' command in Entity Files: Header Date above.
    ~{freespecial#} defines the freespecial to be played after input sequence is valid. Don't forget to set 'maxfreespecials' (see models.txt above) if you need more freespecials to access.

If your freespecial2 animation is a standing kick, are you using that in anim duck? If so, you should use another freespecial instead of just freespecial2 for a crouching kick. Like what Bloodbane said about using a2 as an alternate attack especially for kicking, I use that as well.

Code:
name             SimonB
type             player
health           100
mp		 100
mprate		 5
gfxshadow        0
speed            10
atchain          1
nodrop           2
icon      data/sprites/icon.gif
animationscript data/scripts/player.c
death 2
com a2 freespecial2


keyscript data/chars/simonb/simonkey.c

Alternate standing attack:

Code:
anim	freespecial2
	delay	4
	offset	101 86
	bbox	88 43 23 43
	frame	data/chars/simonb/113.gif
	@cmd	limiterSub
	@cmd	limiter 10
	frame	data/chars/simonb/71.gif
	frame	data/chars/simonb/72.gif
	@cmd	mpcost 10
	@cmd	SubWeapon 23 35
	frame	data/chars/simonb/73.gif
	frame	data/chars/simonb/74.gif

For crouching/ducking, you also need a loop with start and end frames. I always like to use start frame without end frame in loop, but I use end frame only if I add last frame of duck anim.

anim duck

bbox 87 49 25 38
offset 100 86
delay 6
idle 1
loop 1 2 3
cancel 2 3 0 a freespecial #<-- For attack button to change animation while crouching
cancel 2 3 0 a2 freespecial3 #<-- For alternate attack button to change animation while crouching
frame data/chars/simonb/2.gif
offset 101 86
frame data/chars/simonb/3.gif
offset 102 86
frame data/chars/simonb/4.gif #< == This is where the crouch loops if loop is used
offset 102 86
frame data/chars/simonb/4.gif

I put labels on how many frames the animation has if script is used and comments for you so you wouldn't get confused on my input. Without using little bit of script, it will always revert back to the first frame of anim duck instead of staying down. Here's an example for freespecial anim as a cancel from anim duck:

Code:
anim	freespecial
@script
void self = getlocalvar("self");//Call entity
int frame = getlocalvar("frame"); //Frame as specifier for commanding animation if it is a local variant I think. Said maxman.

changeentityproperty(self, "velocity", 0, 0, 0); //No moving; changeentityproperty(entity, "velocity", x, z, y); With all zeros, entity won't move at all.


if(frame == 13){ //Fourteenth frame; below, it will revert/change to frame 2 in anim duck after this current animation
   changeentityproperty(self, "animpos", 2);//Change entity's frame
   changeentityproperty(self, "animation", openborconstant("ANI_DUCK"),2); //This number 2 here next to "ANI_DUCK" in this line, is a reset flag, not attack 2 or frame 2.

}
	@end_script	
	offset	105 86
	delay	4
	sound	data/Sounds/chain.wav
	bbox	86 54 27 33
	frame	data/chars/simonb/27.gif # Frame 0; First frame
	frame	data/chars/simonb/28.gif # Frame 1; Second frame
	frame	data/chars/simonb/29.gif # Frame 2; Third frame
	attack10	70 40 101 25 10 0 1 0 0 0
	frame	data/chars/simonb/30.gif # Frame 3
	attack10	93 56 71 12 10 0 1 0 0 0
	frame	data/chars/simonb/31.gif # Frame 4
	attack10	90 60 95 12 10 0 1 0 0 0
	frame	data/chars/simonb/32.gif # Frame 5
	attack10	99 61 88 10 10 0 1 0 0 0
	frame	data/chars/simonb/33.gif # Frame 6
	attack10	98 62 89 9 10 0 1 0 0 0
	frame	data/chars/simonb/34.gif # Frame 7
	delay	2
	frame	data/chars/simonb/35.gif # Frame 8
	frame	data/chars/simonb/36.gif # Frame 9
	frame	data/chars/simonb/37.gif # Frame 10
	frame	data/chars/simonb/38.gif # Frame 11
	frame	data/chars/simonb/39.gif # Frame 12
	frame	data/chars/simonb/40.gif # Frame 13

I hate to say this, but can I see the code on how many frames you have for your crouch kick animation in case you run into problems?
 
I see why I'm having problems with flying kick turning into crouch kick in the air, each individual animations needs its own freespecial. Thank you maxman

Also is there a way I can to another standing kick after the first one for example ATT1 ATT2 are both punches Freespecial is standing kick but i'd like to follow with another standing kick after the first.
 
The kicking combo is simple. Use a different freespecial in cancel under anim freespecial2 which is a standing kick for a kicking follow-up.

Example:

This is my first initial kick and you need another cancel with different freespecial:

Code:
anim	freespecial3
	bbox	130 98 36 107
	offset	162 202
	delay	6
#	movez	-2
	cancel 3 5 0 a2 freespecial4
	frame	data/chars/billy/109.png
	bbox	113 98 44 107
	frame	data/chars/billy/110.png
	bbox	122 98 50 107
	frame	data/chars/billy/111.png
	attack	162 118 60 27 11 0 1 0 0 0
	bbox	119 98 45 107
	frame	data/chars/billy/112.png
	frame	data/chars/billy/113.png
	attack	0 0 0 0 0 0 0 0 0 0
	bbox	128 100 45 105
#	movez	0
	frame	data/chars/billy/114.png

Second kick.

Code:
anim	freespecial4
	bbox	161 100 34 105
	offset	162 202
	delay	6
	cancel 4 5 0 a2 freespecial6
	frame	data/chars/billy/115.png
	bbox	172 100 20 105
	frame	data/chars/billy/116.png
	loop	0
	attack	192 116 74 28 9 0 1 0 0 0
	bbox	171 105 28 100
	frame	data/chars/billy/117.png
	frame	data/chars/billy/118.png
	frame	data/chars/billy/119.png
	attack	0 0 0 0 0 0 0 0 0 0
	bbox	162 105 24 100
	frame	data/chars/billy/120.png

Code:
anim	freespecial6
	bbox	156 101 49 104
	offset	162 202
	delay	6
	frame	data/chars/billy/181.png
	attack	187 114 21 70 5 0 0 1 0 0
	bbox	150 106 40 99
	frame	data/chars/billy/182.png
	attack	187 78 39 110 5 0 1 0 0 0
	bbox	151 104 41 101
	frame	data/chars/billy/183.png
	bbox	148 104 43 101
	frame	data/chars/billy/184.png
	bbox	147 104 43 101
	frame	data/chars/billy/185.png
	bbox	148 104 43 101
	frame	data/chars/billy/186.png
	attack	187 81 44 68 5 0 1 0 0 0
	bbox	153 104 41 101
	frame	data/chars/billy/187.png
	bbox	161 112 41 93
	frame	data/chars/billy/188.png
	frame	data/chars/billy/189.png
	frame	data/chars/billy/190.png
	bbox	149 103 44 102
	frame	data/chars/billy/191.png

With cancel, it's a follow-up of freespecial.

You can use cancel in anim jump if you want alternate attack buttons too.
 
Thanks for the clear explanations maxman, everything works perfectly now, If I wanted to turn the character while ducking do I use a freespecial also? 

[attachment deleted by admin]
 
No, there's no need to. I use a script from White Dragon's TMNT mod to make a player turn around. I think you need some little script if you want him to turn around while crouching.

Code:
anim	duck
	@script
		void self = getlocalvar("self"); //Entity
		int frame = getlocalvar("frame"); //Frame
		//int prev_animid = getentityvar(self,14);
		int dir = getentityproperty(self,"direction"); //Entity's facing
		int p = getentityproperty(self,"playerindex"); //Player index for entity

                if ( playerkeys(p,0,"moveleft") ) {//Move left?
                    if ( dir ) changeentityproperty(self,"direction",0);// Facing left?
                } else if ( playerkeys(p,0,"moveright") ) {//Move right?
                    if ( !dir ) changeentityproperty(self,"direction",1); //Facing right?
                }

		if ( !playerkeys(p,0,"movedown") ) setidle(self,openborconstant("ANI_IDLE"),1); //When down button is not held, anim idle will play
	@end_script	
	bbox	87 49 25 38
	offset	100 86
	delay	6
	idle	1
	loop	1 2 3
	cancel	2 3 0 a freespecial
	cancel	2 3 0 a2 freespecial3
	frame	data/chars/simonb/2.gif
	offset	101 86
	frame	data/chars/simonb/3.gif
	offset	102 86
	frame	data/chars/simonb/4.gif
	offset	102 86
	frame	data/chars/simonb/4.gif

Since you want your player to turn while crouching, here's my modification (in theory) but I haven't tested it yet. But it's based on the script I have for anim duck.

Modified:
Code:
	@script
		void self = getlocalvar("self"); //Call entity.
		int frame = getlocalvar("frame"); //Call frame.
		int dir = getentityproperty(self,"direction"); //Call entity's direction
		int p = getentityproperty(self,"playerindex"); //Player index for entity

                if ( playerkeys(p,0,"moveleft") ) {//Move left?
                    if ( dir ) performattack(self, openborconstant("ANI_FOLLOW1");// Facing left?
                } else if ( playerkeys(p,0,"moveright") ) {//Move right?
                    if ( !dir ) performattack(self, openborconstant("ANI_FOLLOW1"); //Facing right?
                }

		if ( !playerkeys(p,0,"movedown") ) setidle(self,openborconstant("ANI_IDLE"),1);
	@end_script

Here's my original and the other one is modified for anim follow1.
Code:
anim	follow7 #Crouch turn
@script
void self = getlocalvar("self");//Call entity

if(frame == 5){//If frame 5 is called a.k.a. 6th frame
   changeentityproperty(self, "animation", openborconstant("ANI_DUCK"),2);//Change entity's animation and its resettable flag; resettable flag should be 2 for newer modules (mods)
   changeentityproperty(self, "animpos", 2);//Change entity's frame
}
	@end_script	
	offset	22 66
	delay	4
	flipframe	4 #flipframe is for turning the entity's frame to the opposite direction/facing
	@cmd	stop
	frame	data/chars/ryu/25.gif
	offset	26 68
	frame	data/chars/ryu/24.gif
	offset	31 67
	frame	data/chars/ryu/23.gif
	delay	2
	frame	data/chars/ryu/23.gif
	offset	23 66
	delay	2
	frame	data/chars/ryu/0001000002.gif
	@cmd	keyint2 "ANI_FOLLOW6" 0 "D" 1
	frame	data/chars/ryu/0001000002.gif #Last frame needed right after one frame is flipped for crouching
@end_script

Modified :

Code:
anim follow1
@script
void self = getlocalvar("self");//Call entity
int frame = getlocalvar("frame"); //Specifying frame
changeentityproperty(self, "velocity", 0, 0, 0);

if(frame == 4){//If frame 4 is called a.k.a. 6th frame
   changeentityproperty(self, "animation", openborconstant("ANI_DUCK"),2);//Change entity's current animation to anim duck
   changeentityproperty(self, "animpos", 2);//Change entity's specific frame
}
	@end_script	
frame data/chars/player1/cturn1.png #frame 0
frame data/chars/player1/cturn2.png #frame 1
frame data/chars/player1/cturn3.png #frame 2
frame data/chars/player1/duck3.png #frame 3
frame data/chars/player1/duck3.png #frame 4

Not sure it'll work for you.
 
Thanks maxman White Dragon's script worked but I couldn't get your script to work but its ok,  One final issue I'm having is the kick combo, I wanted it to be more like Att1 Att2 Att3  the following punch animations only play if the punch connects to the enemy so if I keep pressing punch only Att1 plays, atcain 1 2 3, if I press kick 3 times all 3 kick animations play regardless if they connect to the enemy or not.
 
Oops. That was my mistake, Ken. I forgot that you can use 1 for connecting hits on the opponent. The one in red is a number of hits if attackbox is available for combo.

anim freespecial3
bbox 130 98 36 107
offset 162 202
delay 6
# movez -2
cancel 3 5 1 a2 freespecial4
frame data/chars/billy/109.png
bbox 113 98 44 107
frame data/chars/billy/110.png
bbox 122 98 50 107
frame data/chars/billy/111.png
attack 162 118 60 27 11 0 1 0 0 0
bbox 119 98 45 107
frame data/chars/billy/112.png
frame data/chars/billy/113.png
attack 0 0 0 0 0 0 0 0 0 0
bbox 128 100 45 105
# movez 0
frame data/chars/billy/114.png

Now you can change hit from 0 to 1 in cancel in another freespecial after the first if you want to make an attack combo.

I know it's already done, but I also forgot that it's possible that you can use freespecial which you asked before. At first, I thought it would be ridiculous in thinking of pressing another attack button or jump/special button to turn around while crouching. That's when I said there's no need to. Later, I realized it's possible to use freespecial for turning and one thing I forgot about was b for back button.

Code:
anim	duck

	bbox	87 49 25 38
	offset	100 86
	delay	6
	idle	1
	loop	1 2 3
        cancel 2 3 0 b freespecial5 #press left when player faces right or right when player faces left
	cancel	2 3 0 a freespecial
	cancel	2 3 0 a2 freespecial3
	frame	data/chars/simonb/2.gif
	offset	101 86
	frame	data/chars/simonb/3.gif
	offset	102 86
	frame	data/chars/simonb/4.gif
	offset	102 86
	frame	data/chars/simonb/4.gif

You can use another freespecial animation as a crouch turning (non-attack) animation just like the crouch attack freespecial I posted. I haven't tried using b in cancel in anim duck for turning. I know you already got White Dragon's script to work for turning crouch. I'm just saying you have a choice to use whether it's freespecial of b or WD's script.

Better say late than never.
 
Thank you for your help maxman, When I have the basic mechanics and drawn the sprites in my own art style I'll make a playable demo and start a work in progress thread to show everyone what I'm working on.
 
Back
Top Bottom