void main()
{
int iPlIndex = getlocalvar("player"); //Get calling player
void vSelf = getplayerproperty(iPlIndex , "entity"); //Get calling entity
void vTarget = getentityproperty(vSelf, "opponent"); //Get calling opponent
//void vTarget = getlocalvar(self, "opponent);
//void vTarget = findtarget("opponent"); //Get nearest opponent to caller.
void vAniID = getentityproperty(vSelf,"animationID"); //Get current animation ID
void vAniPos = getentityproperty(vSelf, "animpos"); //Get current animation frame
int iFrame = getentityproperty(vSelf, "animpos"); //Caller's frame
int iDir = getentityproperty(vSelf, "direction"); //Get current facing direction
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 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 iUpH = playerkeys(iPlIndex, 0, "moveup"); //Hold status of "Up"
void iDownH = playerkeys(iPlIndex, 0, "movedown");//Hold status of "Down"
void iLeftH = playerkeys(iPlIndex, 0, "moveleft");//Hold status of "Left"
void iRightH = playerkeys(iPlIndex, 0, "moveright");//Hold status of "Right"
void iJumpR = playerkeys(iPlIndex, 2, "jump"); // Release status of "Jump"
void iSpecialR = playerkeys(iPlIndex, 2, "special"); //Release status of "Special"
void iAttack2R = playerkeys(iPlIndex, 2, "attack2"); //Release status of "Attack2"
void iAttack3R = playerkeys(iPlIndex, 2, "attack3"); //Release status of "Attack3"
void iAttack4R = playerkeys(iPlIndex, 2, "attack4"); //Release status of "Attack4"
void iAttackH = playerkeys(iPlIndex, 0, "attack"); //Hold status of "Attack"
void iJumpH = playerkeys(iPlIndex, 0, "jump"); //Hold status of "Jump"
void iSpecialH = playerkeys(iPlIndex, 0, "special"); //Hold status of "Special"
void iAttack2H = playerkeys(iPlIndex, 0, "attack2"); //Hold status of "Attack2"
void iAttack3H = playerkeys(iPlIndex, 0, "attack3"); //Hold status of "Attack3"
void iAttack4H = playerkeys(iPlIndex, 0, "attack4"); //Hold status of "Attack4"
//void iStart = playerkeys(iPlIndex, 1, "start"); //New key status of "Start"
//void iStartR = playerkeys(iPlIndex, 2, "start"); //Release key status of "Start"
//void iButton(Normal/Hold/Release) = playerkeys(iPlIndex, number, "Button");
//0 = Hold; 1 = Press; 2 = Release
//PlIndex = Player Index
//changeentityproperty(entity, propname, value)
//Property name = propname
//Jump
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Which animation are you going to press up for jumping while standing or moving?
if(iUpH){ //Jump pressed?
changeentityproperty(vSelf, "aiflag", "jumping", 1); // Enable jumping status
changeentityproperty(vSelf, "aiflag", "idling", 0); // Disable idling status
if(iLeftH){ //Left held?
changeentityproperty(vSelf, "direction", 1); // Change direction to face right
changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW3"),1); //Change animation for going left
tossentity(vSelf, 4, -1.5, 0); //Move entity to the left in air. tossentity(vSelf, y, x, z)
} else if(iRightH){ //Right held?
changeentityproperty(vSelf, "direction", 1); //Change direction to face right
changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW2"),1); //Change animation for going right
tossentity(vSelf, 4, 1.5, 0); //Move entity to the right in air.
} else { //Nothing
changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW1"),1); //Change to animation for moving straight up
tossentity(vSelf, 4, 0, 0); //Jumping straight up
}
}
}
//Unduck
if(vAniID == openborconstant("ANI_DUCK")){ //Ducking?
if(iDownR){ //Release key of Down
changeentityproperty(vSelf, "aiflag", "idling", 0); //Disable idling status
performattack(vSelf, openborconstant("ANI_FOLLOW6")); //Perform unduck animation
}
}
if(iAttack){ //Attack button pressed?
if(vAniID == openborconstant("ANI_DUCK") ){ //Ducking?
performattack(vSelf, openborconstant("ANI_DUCKATTACK") ); //Duckattack anim performed? / Crouch low punch performed
}
}
if(iAttack2){ //Attack2 button pressed?
if(vAniID == openborconstant("ANI_DUCK")){ //Ducking?
performattack(vSelf, openborconstant("ANI_FREESPECIAL6")); //Crouch middle punch performed
}
}
//Stand middle punch
if(iAttack2){ //Attack2 button pressed?
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Perform an attack move in one of the three animations
performattack(vSelf, openborconstant("ANI_ATTACK2")); //Perform middle punch
changeentityproperty(vSelf, "velocity", 0, 0, 0); // Move? No, because all of the velocity is 0.
//That's why Ryu is not moving while he's attacking!
}
}
//Stand high punch
if(iAttack3){ //Attack3 button pressed?
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Perform an attack move in one of the three animations
performattack(vSelf, openborconstant("ANI_ATTACK3")); //Perform high punch
changeentityproperty(vSelf, "velocity", 0, 0, 0); // Move?
}
}
//Stand low kick
if(iJump){ //Jump button pressed?
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Perform an attack move in one of the three animations
performattack(vSelf, openborconstant("ANI_ATTACK4")); //Perform low kick
changeentityproperty(vSelf, "velocity", 0, 0, 0); // Move?
}
}
//Stand middle kick
if(iSpecial){
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Perform an attack move in one of the three animations
performattack(vSelf, openborconstant("ANI_ATTACK5")); //Perform middle kick
changeentityproperty(vSelf, "velocity", 0, 0, 0); // Move?
}
}
//Stand high kick
if(iAttack4){
if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_BACKWALK")){
//Perform an attack move in one of the three animations
performattack(vSelf, openborconstant("ANI_ATTACK6")); //Perform high kick
changeentityproperty(vSelf, "velocity", 0, 0, 0); // Move?
}
}
}