16-bit Fighter
Active member
When cancelling in mid-air, the char falls like a stone. How to keep his velocity instead, please?
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 animpos = getentityproperty(vSelf, "animpos"); //Get current animation frame
int iDir = getentityproperty(vSelf, "direction"); //Get current facing direction
void vName = getentityproperty(vSelf,"name"); //Get name of calling entity
void iUp = playerkeys(iPlIndex, 1, "moveup"); // New key status of "Up"
void iDown = playerkeys(iPlIndex, 1, "movedown"); // New key status of "Down"
void iLeft = playerkeys(iPlIndex, 1, "moveleft"); // New key status of "Left"
void iRight = playerkeys(iPlIndex, 1, "moveright"); // New key status of "Right"
void iJump = playerkeys(iPlIndex, 1, "jump"); //New key status of "Jump"
void iSpecial = playerkeys(iPlIndex, 1, "Special"); //New key status of "Special"
void iAttack = playerkeys(iPlIndex, 1, "attack"); //New key status of "Attack"
void iAttack2 = playerkeys(iPlIndex, 1, "attack2"); // New key of "Attack 2"
if (vAniID == openborconstant("ANI_freespecial7") && animpos >= 1 && animpos <= 3){ //hop forward
if(iAttack){ //attack pressed
performattack(vSelf, openborconstant("ANI_freespecial13")); // hop forawrd attack 1
}
}
}
if(vAniID == openborconstant("ANI_FREESPECIAL7") ){ //cancel freespecial?
if(iLeftR || iRightR){ //Left or Right released?
if(!iLeftH && !iRightH){ //Left and Right not pressed?
changeentityproperty(vSelf, "velocity", 0);
}
} else if(iLeft){ //Left pressed?
changeentityproperty(vSelf, "velocity", -2);
} else if(iRight){ //Right pressed?
changeentityproperty(vSelf, "velocity", 2);
}
}
}
void velo001(float fX, float fZ, float fY){
//velo001
//Damon Vaughn Caskey
//05/06/2007
//
//Replicates movement effect.
//
//fX: X axis speed.
//fZ: Z axis speed.
//fY: Y axis speed.
void vSelf = getlocalvar("self"); //Get calling entity.
if (getentityproperty(vSelf, "direction")==0){ //Is entity facing right?
fX = -fX; ////Reverse X direction to match facing.
}
changeentityproperty(vSelf, "velocity", fX, fZ, fY); //Apply movement.
}
Which ever freespecial you are using you could add button held/released to your keyscripts
void iLeftH = playerkeys(iPlIndex, 0, "moveleft"); // key held
void iRightH = playerkeys(iPlIndex, 0, "moveright"); // key held
void iLeftR = playerkeys(iPlIndex, 2, "moveleft"); // Release status of "Left"
void iRightR = playerkeys(iPlIndex, 2, "moveright"); // Release status of "Right"
and something like
C:if(vAniID == openborconstant("ANI_FREESPECIAL7") ){ //cancel freespecial? if(iLeftR || iRightR){ //Left or Right released? if(!iLeftH && !iRightH){ //Left and Right not pressed? changeentityproperty(vSelf, "velocity", 0); } } else if(iLeft){ //Left pressed? changeentityproperty(vSelf, "velocity", -2); } else if(iRight){ //Right pressed? changeentityproperty(vSelf, "velocity", 2); } } }
I'd like this sequence of inputs in keyscript and I don't want to drive the velocity. Here is a sketch to be more understandable:You don't need to implement a sequence of inputs using keyscript to maintain velocity during cancel freespecial.
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 animpos = getentityproperty(vSelf, "animpos"); //Get current animation frame
int iDir = getentityproperty(vSelf, "direction"); //Get current facing direction
int MPower = getentityproperty(vSelf,"mp");
void vName = getentityproperty(vSelf,"name"); //Get name of calling entity
void iUp = playerkeys(iPlIndex, 1, "moveup"); // New key status of "Up"
void iDown = playerkeys(iPlIndex, 1, "movedown"); // New key status of "Down"
void iLeft = playerkeys(iPlIndex, 1, "moveleft"); // New key status of "Left"
void iRight = playerkeys(iPlIndex, 1, "moveright"); // New key status of "Right"
void iJump = playerkeys(iPlIndex, 1, "jump"); //New key status of "Jump"
void iSpecial = playerkeys(iPlIndex, 1, "Special"); //New key status of "Special"
void iAttack = playerkeys(iPlIndex, 1, "attack"); //New key status of "Attack"
void iAttack2 = playerkeys(iPlIndex, 1, "attack2"); // New key of "Attack 2"
void iAttack3 = playerkeys(iPlIndex, 1, "attack3"); // New key of "Attack 3"
void iAttack4 = playerkeys(iPlIndex, 1, "attack4"); // New key of "Attack 4"
void iUpR = playerkeys(iPlIndex, 2, "moveup"); // Release status of "UP"
void iLeftR = playerkeys(iPlIndex, 2, "moveleft"); // Release status of "Left"
void iRightR = playerkeys(iPlIndex, 2, "moveright"); // Release status of "Right"
void iDownR = playerkeys(iPlIndex, 2, "movedown"); //Release status of "Down"
void iAttackR = playerkeys(iPlIndex, 2, "attack"); //Release status of "Attack"
void iAttack2R = playerkeys(iPlIndex, 2, "attack2"); //Release status of "Attack"
void iUpH = playerkeys(iPlIndex, 0, "moveup");
void iDownH = playerkeys(iPlIndex, 0, "movedown");
void iLeftH = playerkeys(iPlIndex, 0, "moveleft");
void iRightH = playerkeys(iPlIndex, 0, "moveright");
void iAttackH = playerkeys(iPlIndex, 0, "attack");
void iAttack2H = playerkeys(iPlIndex, 0, "attack2");
if (vAniID == openborconstant("ANI_FORWARDJUMP") && animpos >= 1 && animpos <= 6){ //forward jump
if(iAttack){ //attack pressed
performattack(vSelf, openborconstant("ANI_FREESPECIAL16")); // jump forward attack
}
}
if (vAniID == openborconstant("ANI_FREESPECIAL16") && animpos >= 0 && animpos <= 2){ //forward jump attack
if(iAttack){ //attack pressed
performattack(vSelf, openborconstant("ANI_FREESPECIAL17")); // jump forward attack cancel
}
}
}
anim slide
cancel 0 1 0 D F A FREESPECIAL10
loop 0
offset 84 132
delay 99
jumpframe 0 2 -2
landframe 1
bbox 64 32 36 74
frame data/chars/andy'/bdash01.png
delay 7
bbox 59 40 40 92
frame data/chars/andy'/crouch01.png
In the freespecial10 above the player falls like an anvil. But if I add "jumpframe 0 2 -2" in it, the player double-jumps.anim freespecial10
offset 84 132
forcedirection -1
bbox 63 31 36 100
landframe 1
delay 999
Energycost 100 1 0
hitflash flash3
frame data/chars/andy'/jump04.png
delay 10
frame data/chars/andy'/crouch01.png
frame data/chars/andy'/fspec101.png
frame data/chars/andy'/fspec102.png
delay 8
attack 79 42 98 39 35 1 0 0 0 17 //
dropv 2 3.5
frame data/chars/andy'/fspec103.png
frame data/chars/andy'/fspec104.png
attack 139 42 53 39 35 1 0 0 0 17 //
dropv 2 3.5
frame data/chars/andy'/fspec105.png
frame data/chars/andy'/fspec106.png
delay 6
attack 0 0 0 0 0
frame data/chars/andy'/fspec107.png
frame data/chars/andy'/fspec108.png
frame data/chars/andy'/fspec108.png
void main()
{//All players Keyscripts
int playerIndex = getlocalvar("player"); //Get calling player
void self = getplayerproperty(playerIndex ,"entity"); //Get calling entity
void exists = getentityproperty(self, "health")>0?1:NULL(); // Is caller alive
if (openborvariant("in_level") && exists)
{
void ani_id = getentityproperty(self,"animationID"); //Get current animation ID
char name = getentityproperty(self,"name"); //Get current name
int dir = getentityproperty(self, "direction"); //Get current facing direction
dfa_input;
//Press Keys
void attack = playerkeys(playerIndex, 1, "attack"); //New key status of "Attack"
void down = playerkeys(playerIndex, 1, "movedown"); //New key status of "MoveDown"
void forward = playerkeys(playerIndex, 1, dir==0?"moveleft":"moveright"); //Check if pressed forward based on direction
//void backward = playerkeys(playerIndex, 1, dir==0?"moveright":"moveleft"); //Check if pressed backward based on direction
if( name == "Ryu" && ani_id == openborconstant("ani_jump") || ani_id == openborconstant("ani_jumpattack") ) //check right player and animation
{
if(down){ dfa_input=1;} // Input step 1
if(forward && dfa_input==1){ dfa_input=2;} // Input step 2
if(attack && dfa_input==2){ performattack(self, openborconstant("ANI_freespecial2")); dfa_input=0;} // Input step 3 and reset step counter
}
}
}
In the freespecial10 above the player falls like an anvil. But if I add "jumpframe 0 2 -2" in it, the player double-jumps.
I realized that jumpframe 0 0 -2 allow to keep the velocity exactly like I want.To answer this, if you use the same jumpframe properties in both anim slide and freespecial10 then you will do a double jump, in freespecial10 use different jumpframe properties like jumpframe 0 0 -0.8
However msmalik's solution is much better as it allows 'mid-air command cancel while maintaining velocity' which I also think you should change this thread's title to.
At last I tried your code (without any modification, just to test) but OB shut down and OBLog says "Script compile error in 'entitykeyscript': dfa_input line 24, column 22".C-like:void main() {//All players Keyscripts int playerIndex = getlocalvar("player"); //Get calling player void self = getplayerproperty(playerIndex ,"entity"); //Get calling entity void exists = getentityproperty(self, "health")>0?1:NULL(); // Is caller alive if (openborvariant("in_level") && exists) { void ani_id = getentityproperty(self,"animationID"); //Get current animation ID char name = getentityproperty(self,"name"); //Get current name int dir = getentityproperty(self, "direction"); //Get current facing direction dfa_input; //Press Keys void attack = playerkeys(playerIndex, 1, "attack"); //New key status of "Attack" void down = playerkeys(playerIndex, 1, "movedown"); //New key status of "MoveDown" void forward = playerkeys(playerIndex, 1, dir==0?"moveleft":"moveright"); //Check if pressed forward based on direction //void backward = playerkeys(playerIndex, 1, dir==0?"moveright":"moveleft"); //Check if pressed backward based on direction if( name == "Ryu" && ani_id == openborconstant("ani_jump") || ani_id == openborconstant("ani_jumpattack") ) //check right player and animation { if(down){ dfa_input=1;} // Input step 1 if(forward && dfa_input==1){ dfa_input=2;} // Input step 2 if(attack && dfa_input==2){ performattack(self, openborconstant("ANI_freespecial2")); dfa_input=0;} // Input step 3 and reset step counter } } }
void main()
{//All players Keyscripts
int playerIndex = getlocalvar("player"); //Get calling player
void self = getplayerproperty(playerIndex ,"entity"); //Get calling entity
void exists = getentityproperty(self, "health")>0?1:NULL(); // Is caller alive
if (openborvariant("in_level") && exists)
{
void ani_id = getentityproperty(self,"animationID"); //Get current animation ID
char name = getentityproperty(self,"name"); //Get current name
int dir = getentityproperty(self, "direction"); //Get current facing direction
int dfa_input;
//Press Keys
void attack = playerkeys(playerIndex, 1, "attack"); //New key status of "Attack"
void down = playerkeys(playerIndex, 1, "movedown"); //New key status of "MoveDown"
void forward = playerkeys(playerIndex, 1, dir==0?"moveleft":"moveright"); //Check if pressed forward based on direction
//void backward = playerkeys(playerIndex, 1, dir==0?"moveright":"moveleft"); //Check if pressed backward based on direction
if( name == "Ryu" && ani_id == openborconstant("ani_jump") || ani_id == openborconstant("ani_jumpattack") ) //check right player and animation
{
if(down){ dfa_input=1;} // Input step 1
if(forward && dfa_input==1){ dfa_input=2;} // Input step 2
if(attack && dfa_input==2){ performattack(self, openborconstant("ANI_freespecial")); dfa_input=0;} // Input step 3 and reset step counter
}
}
}
The picture explain it perfectly even with stick men.I'd like this sequence of inputs in keyscript and I don't want to drive the velocity. Here is a sketch to be more understandable:
Be careful, it's a 16-bit Fighter's copyright.The picture explain it perfectly even with stick men.
I might use the same process as well.