charged

I'm very rusty...could you make an attack like a sword slash and then with the same button hold it down for a short period then release and hit with a charged attack in order to do more damage?
 
Well, default charging could do that. Holding attack key for couple seconds then release it will unleash CHARGEATTACK animation. If player doesn't ahve that animation, he/she will perform ATTACK3 instead.
 
Wombat2112
O_Ilusionista said:
Yeah, but sadly the native CHARGEATTACK isn't reliable at all. it fails more than it works.
Kratus has a scripted version of this.
Yeah, Ilu is right, I'm using a scripted version in the SOR2X.

Are you using some kind of "charging animation" while the button is held, or do you want a system like the Streets of Rage series, that will not show a "charging animation" but will cancel the idle/walk/run animations to perform the charged attack as soon the button is released?
 
Kratus said:
Wombat2112
O_Ilusionista said:
Yeah, but sadly the native CHARGEATTACK isn't reliable at all. it fails more than it works.
Kratus has a scripted version of this.
Yeah, Ilu is right, I'm using a scripted version in the SOR2X.

Are you using some kind of "charging animation" while the button is held, or do you want a system like the Streets of Rage series, that will not show a "charging animation" but will cancel the idle/walk/run animations to perform the charged attack as soon the button is released?
 

Well I guess the later although I thought about two different methods actually. The player kinda wields back then strikes forward, he would just hold the swing back longer...then release and do more damage than a standard slash or strike attack....or maybe like a shooter or shu'mp where you have a standard fire (projectile) button holding it down until release for a more aggressive shot.....If done with a shooter it would be cool so see some kind of preshot ray form that becomes brighter or flashes while the button is held...kind of signifying that the shot is being super charged for to make more of an impact. I didn't realize it might require scripting.
 
Wombat2112

Do you want something like this?

https://www.youtube.com/watch?v=rqDJP8iHnxA

There are different ways to do that with scripts, but if you want a simple solution I suggest using both keyAni / keyLoop scripts.
You can use the animation's delay to adjust the correct time that the button needs to be pressed or held. In the example below, the "keyAni " function will change the animation to the "follow35" if the correct button is held in the proper frame.

Once the animation is changed, the "keyLoop" function will loop the desired frame until the correct button is released, and the "follow35" animation will do a bigger damage than the "special2" animation.
But if you want to increase the damage according to the button held "time", we will need a more complex solution. I suggest trying these scripts first before we go to another.

First, I will show the scripts:
Code:
void keyLoop(void key, int frame)
{//Loops defined frame if defined key is held
	void self 	= getlocalvar("self");
	int iPIndex = getentityproperty(self,"playerindex");

	if(playerkeys(iPIndex, 0, key)){updateframe(self, frame);}
}

void keyAni(void key, void ani)
{//Execute animation if defined key is held
	void self 	= getlocalvar("self");
	int iPIndex = getentityproperty(self,"playerindex");

	if(playerkeys(iPIndex, 0, key)){performattack(self, openborconstant(ani), 1);}
}

And now I will show an example of how to use them:
Code:
anim special2 #UPPER
	fastattack 1
	jugglecost 15
	forcedirection 0
	otg 1
	energycost 40 2 5
	@cmd healStart
	loop	0
	delay	12
	offset	152 199
	hitfx	data/sounds/MediumPunch.wav
	sound	data/sounds/HighAttack.wav
	frame	data/chars/bosses/abadede/upper00.gif
	hitfx	data/sounds/HighPunch.wav
	frame	data/chars/bosses/abadede/upper00.gif
	@cmd keyAni "special" "ANI_FOLLOW35"
		delay	12
	attack 190 130 36 32 8 1 0 0 20 12
	dropv 4 1.2 0
	frame	data/chars/bosses/abadede/upper01.gif
		delay	24
	attack 162 73 40 62 8 1 0 0 20 12
	dropv 4 1.2 0
	bbox 	150 113 30 88
	frame	data/chars/bosses/abadede/upper02.gif

anim follow35 #UPPER
	fastattack 1
	jugglecost 15
	forcedirection 0
	otg 1
	energycost 40 2 5
	@cmd healStart
	loop	0
	delay	4
	offset	153 199
	hitfx	data/sounds/MediumPunch.wav
	#sound	data/sounds/HighAttack.wav
	frame	data/chars/bosses/abadede/upper00.gif
		offset	152 199
	hitfx	data/sounds/HighPunch.wav
	frame	data/chars/bosses/abadede/upper00.gif
	@cmd keyLoop "special" 0
		delay	12
	attack 190 130 36 32 32 1 0 0 20 12
	dropv 4 1.2 0
	frame	data/chars/bosses/abadede/upper01.gif
		delay	24
	attack 162 73 40 62 32 1 0 0 20 12
	dropv 4 1.2 0
	bbox 	150 113 30 88
	frame	data/chars/bosses/abadede/upper02.gif

Note that you will need to add these scripts to your default "animation scripts" file. You can call them at your character header, like this:

animationscript data/scripts/animation/default.c
 
Back
Top Bottom