Solved Change movement to jump while attacking

Question that is answered or resolved.

DD Tokki

Well-known member
jump3.PNG

I needed to evade, so I tried to jump with a cancellation during the attack, but it seems that only freespecials are allowed. Is there any other way?
 
You need the keyscript data/scripts/key/xxx.c script to edit your consumption or keys.
Code:
void xxx()
{
    void self      = getlocalvar("self");
    void vAniID  = getentityproperty(self,"animationID");
    int iPIndex  = getlocalvar("player");
    int mp            = getentityproperty(self, "mp");
    int cost        = 15;
   
    if(playerkeys(iPIndex, 1, "attack3")){
    if(mp >= cost){
    if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK") || vAniID == openborconstant("ANI_RUN")){
      changeentityproperty(self, "mp", mp-cost);
      changeentityproperty(self, "velocity", 0, 0, 0);
      performattack(self, openborconstant("ANI_FREESPECIAL1"), 0);
     }
    }
 }
}
 
jump.PNG

thank you.
I changed it to jump and confirmed that the attack changes to jump, but it doesn't float in the air, so I think I need to modify the code a bit more.
But I don't know how to write a script.
 
Just tested, you need to create an animation with anim jump, you can name it anim follow1 and finally add @cmd jump 1 to the animation
Code:
anim follow1
    loop    0
    delay   15
        offset  72 131
        bbox    64 122 16 10
     jumpframe  0 3 0 0
        @cmd jump 1
        frame   data/chars/mboss05/jump.gif
 
Last edited:
void main()
{
void self = getlocalvar("self");
void vAniID = getentityproperty(self,"animationID");
int iPIndex = getlocalvar("player");
int mp = getentityproperty(self, "mp");
int cost = 0;

if(playerkeys(iPIndex, 1, "jump")){
if(mp >= cost){
if(vAniID == openborconstant("ANI_attack1")){
changeentityproperty(self, "mp", mp-cost);
changeentityproperty(self, "velocity", 0, 0, 0);
performattack(self, openborconstant("ANI_follow1"), 0);
}
}
}
}


I finally succeeded. Switches to jumping while attacking.

But there is something I want to get rid of here. It's Mp. If I touch it, an error occurs, so I want to ask you to fix it.
 
void main()
{
void self = getlocalvar("self");
void vAniID = getentityproperty(self,"animationID");
int iPIndex = getlocalvar("player");
int mp = getentityproperty(self, "mp");
int cost = 0;

if(playerkeys(iPIndex, 1, "jump")){
if(mp >= cost){
if(vAniID == openborconstant("ANI_attack1")){
changeentityproperty(self, "mp", mp-cost);
changeentityproperty(self, "velocity", 0, 0, 0);
performattack(self, openborconstant("ANI_follow1"), 0);
}
}
}
}


I finally succeeded. Switches to jumping while attacking.

But there is something I want to get rid of here. It's Mp. If I touch it, an error occurs, so I want to ask you to fix it.
Can you record a video so I can see what's going on.
 
void main()
{
void self = getlocalvar("self");
void vAniID = getentityproperty(self,"animationID");
int iPIndex = getlocalvar("player");
int mp = getentityproperty(self, "mp");
int cost = 0;

if(playerkeys(iPIndex, 1, "jump")){
if(mp >= cost){
if(vAniID == openborconstant("ANI_attack1")){
changeentityproperty(self, "mp", mp-cost);
changeentityproperty(self, "velocity", 0, 0, 0);
performattack(self, openborconstant("ANI_follow1"), 0);
}
}
}
}


I finally succeeded. Switches to jumping while attacking.

But there is something I want to get rid of here. It's Mp. If I touch it, an error occurs, so I want to ask you to fix it.

@DD Tokki,

Use code tags when posting script or text samples. This will help everyone read your code. See here if you don't know how.

This is what your script looks like if posted correctly:

C:
void main()
{
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self, "animationID");
    int iPIndex = getlocalvar("player");
    int mp = getentityproperty(self, "mp");
    int cost = 0;

    if (playerkeys(iPIndex, 1, "jump")) {

        if (mp >= cost) {

            if (vAniID == openborconstant("ANI_attack1")) {

                changeentityproperty(self, "mp", mp - cost);
                changeentityproperty(self, "velocity", 0, 0, 0);
                performattack(self, openborconstant("ANI_follow1"), 0);

            }
        }
    }
}

HTH,
DC
 
Code:
void main()
{
    void self      = getlocalvar("self");
    void vAniID  = getentityproperty(self,"animationID");
    int iPIndex  = getlocalvar("player");
  
    if(playerkeys(iPIndex, 1, "jump")){
    if(vAniID == openborconstant("ANI_attack1")){
      performattack(self, openborconstant("ANI_follow1"), 0);
     }
   }
}

I finally solved it.
Just delete the } at the end.
 
Back
Top Bottom