Solved air attack keyscript

Question that is answered or resolved.

msmalik681

OpenBOR Developer
Staff member
I have made a keyscript to cancel into a air attack using performattack command but when the player runs their air attack they will play full animation before they hit the ground is there anyway to fix this problem ?

tried landframe but it did not work

here is the code:

void main()//keyscripts
{
    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
    int iDir = getentityproperty(vSelf, "direction");  //Get current facing direction
    int x = getentityproperty(vSelf, "x");
    int y = getentityproperty(vSelf, "a");
    int z = getentityproperty(vSelf, "z");

    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"

    if(vAniID == openborconstant("ANI_FORWARDJUMP")){
    if(iJump){
performattack(vSelf,openborconstant("ANI_FREESPECIAL5"),1);
      }
    }
}


just fixed this by changing performattack with changeentityproperty(vSelf, "animation", openborconstant("ANI_FREESPECIAL5"),0);

I have a issue with the above script can anyone tell me what the last digit highlighted in red controls ?
 
I can only guess as I've never read full description of that parameter
I'm guessing setting that parameter to 2 means to run the next lines before changing the animation
Ex:
void keyint(void Ani, int Frame, void Key, int Hflag, int Limit)
{// Change current animation if proper key is pressed or released
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp"); 
    int iDir = getentityproperty(self, "direction"); 
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

      if (Key=="U"){ //Up Required?
        iRKey = playerkeys(iPIndex, 0, "moveup"); // "Up"
      } else if (Key=="D"){ //Down Required?
        iRKey = playerkeys(iPIndex, 0, "movedown"); // "Down"
      } else if (Key=="F"){ //Forward Required?
        if (iDir==0){ //Facing left?
        iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
        } else if (iDir==1){ //Facing right?
        iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
        }
      } else if (Key=="J"){ //Jump Required?
        iRKey = playerkeys(iPIndex, 0, "jump"); // "Jump"
      } else if (Key=="A"){ //Attack Required?
        iRKey = playerkeys(iPIndex, 0, "attack"); // "Attack"
      } else if (Key=="S"){ //Special Required?
        iRKey = playerkeys(iPIndex, 0, "special"); // "Special"
      } else if (Key=="A2"){ //Attack2 Required?
        iRKey = playerkeys(iPIndex, 0, "attack2"); // "Attack2"
      } else if (Key=="A3"){ //Attack3 Required?
        iRKey = playerkeys(iPIndex, 0, "attack3"); // "Attack3"
      } else if (Key=="A4"){ //Attack4 Required?
        iRKey = playerkeys(iPIndex, 0, "attack4"); // "Attack4"
      }

      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
}

      if ((MP > Limit)&&iRKey){
        changeentityproperty(self, "animation", openborconstant(Ani), 2);
      changeentityproperty(self, "animpos", Frame);
      }
}

As you can see in this function, animation is changed before animation frame is changed. Doing this cause the entity to change animation which ignores the latter step. I'm not sure why it ignores that step but setting that parameter to 2 will make entity not ignore that step
 
thanks for the reply bloodbane but now I have a new issue when i cancel into my new jump attack i can keep cancel into into the attack over and over.  I have set noaircancel to 2 but it wont help.  I am still able to cancel into the new air attack on landing this looks strange but i am not sure how to fix it.

all fixed it was a noob mistake from my end thanks bloodbane.
 
Back
Top Bottom