Solved Animation Check on Different Sides of Wall(s) for Wall-Jumping Using jumpwall

Question that is answered or resolved.

maxman

Well-known member
I'm trying to give an animation check on the values of the conditions. Even though I gave level wall checks of left and right corners for which side of walls the character will interact, a half of them doesn't exactly play like the script is telling the engine what to do. Instead, it reads two of them in the onblockwscript. Animations for fly and sonic tackle kick play, but not the remaining which I'm trying to make them play every time he interacts with wall corners/sides.


Code:
onblockWscript          data/scripts/spikesw3sbmcho.c

C:
void main()
{
    void self = getlocalvar("self");
    void Dir = getentityproperty(self, "direction");
    void vAniID = getentityproperty(self,"animationID");
    void wallt = getlocalvar("type");
    int iPIndex = getentityproperty(self,"playerindex");
    void iJump = playerkeys(iPIndex, 1, "jump");
    void iLeft = playerkeys(iPIndex, 0, "moveleft");
    void iRight = playerkeys(iPIndex, 0, "moveright");
    void vSpawn;
    int SFX = loadsample("data/sounds/beatxm2.wav");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int b = getentityproperty(self, "base");
    int jumpMoveX = getentityproperty(self, "jumpmovex");
    int WPos = 0;
    int wDif = 0;
    int wAdd = wDif*1;
    int Windex = WPos + (wDif*1);
    int xwall = getlevelproperty("wall", Windex, "x");
    int zwall = getlevelproperty("wall", Windex, "z");
    int ULCorner = getlevelproperty("wall", Windex, "upperleft");
    int LLCorner = getlevelproperty("wall", Windex, "lowerleft");  
    int URCorner = getlevelproperty("wall", Windex, "upperright");
    int LRCorner = getlevelproperty("wall", Windex, "lowerright");
    int depth = getlevelproperty("wall", Windex, "depth");
    int height = getlevelproperty("wall", Windex, "height");
    int type = getlevelproperty("wall", Windex, "type");

    if(wallt==1){
        if(vAniID != openborconstant("ANI_FALL80")){
            clearspawnentry();
            setspawnentry("name", "Bflash");
            vSpawn = spawn();
            changeentityproperty(vSpawn, "position", x-5, z+2, y+51);
            changeentityproperty(vSpawn, "direction", Dir);
            spawn();
            damageentity(self, self, 10, 1, openborconstant("ATK_NORMAL"));
            changeentityproperty(self, "direction", 0);
            tossentity(self, 1.3, 0.8, 0);
            playsample(SFX, 0, 60, 60, 100, 0);
        }
    }else if(wallt==2){
        if(vAniID != openborconstant("ANI_FALL80")){
            clearspawnentry();
            setspawnentry("name", "Bflash");
            vSpawn = spawn();
            changeentityproperty(vSpawn, "position", x+5, z+2, y+51);
            changeentityproperty(vSpawn, "direction", Dir);
            spawn();
            damageentity(self, self, 10, 1, openborconstant("ATK_NORMAL"));
            changeentityproperty(self, "direction", 1);
            tossentity(self, 1.3, -0.8, 0);
            playsample(SFX, 0, 60, 60, 100, 0);
        }
    }else if(wallt!=3){
        if(vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_FORWARDJUMP") || vAniID == openborconstant("ANI_RUNJUMP")){
            if(iJump && y > b+15 && ULCorner && LLCorner && height > 0 && Dir == 0){ // Face left BEHIND left side of wall?
                //changeentityproperty(self, "direction", 0);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial46")); // Backwards jump attack
            }else if(iJump && y > b+15 && URCorner && LRCorner && height > 0 && Dir == 1){ // Face right BEHIND right side of wall?
                //changeentityproperty(self, "direction", 1);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial6")); // Fly
            }else if(iJump && y > b+15 && URCorner && LRCorner && height > 0 && Dir == 0){ // Face left TO right side of wall?
                //changeentityproperty(self, "direction", 1);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial4")); // Sonic Tackle Kick
            }else if(iJump && y > b+15 && ULCorner && LLCorner && height > 0 && Dir == 1){ // Face right TO left side of wall?
                //changeentityproperty(self, "direction", 0);
                changeentityproperty(self, "animation", openborconstant("ANI_Freespecial13")); // Captain Swords
            }
        }
    }
   
}

"jumpmovex" is used in anim jump for it.

Code:
anim jump
@cmd changeentityproperty getlocalvar("self") "jumpmovex" 4
    cancel 1 7 0 b a1    freespecial46    #BACKWARDS JUMP ATTACK
    cancel 1 7 0 f a1    freespecial46    #BACKWARDS JUMP ATTACK
    cancel 3 6 0 u a1    freespecial9    #AIR COMBO 01
    cancel 3 6 0 a2        freespecial4    #SONIC TACKLE KICK
    cancel 3 6 0 a4        freespecial34    #AIR THROW - PILEDRIVER
    cancel 2 6 0 u j    freespecial6    #FLY
    cancel 2 6 0 s        freespecial13    #CAPTAIN SWORDS
    delay        4
    loop        0
    offset        182 282
    bbox        159 266 43 16
sound    data/sounds/run01.wav
    frame        data/chars/sbmcho/ju01.gif
    frame        data/chars/sbmcho/ju02.gif
    frame        data/chars/sbmcho/ju03.gif
    frame        data/chars/sbmcho/ju04.gif
    frame        data/chars/sbmcho/ju05.gif
    delay        15
    frame        data/chars/sbmcho/ju06.gif
    frame        data/chars/sbmcho/ju06.gif
    delay        999
    frame        data/chars/sbmcho/ju06.gif
 
Do you really need to acquire wall type?
IMO you need to acquire wall index from the wall player has interacted with, or blocked by in this case.
 
IMO you need to acquire wall index from the wall player has interacted with, or blocked by in this case.
I do have a problem with checking wall index. I gave a check for wall index. How do I acquire each given wall when they are indexed?

Sorry. I forgot to put the wall index order for a level. The first wall is the center for a wall throw in Z axis. The last two are the sides for jumping to any wall index.

Code:
wall  -500 160 0 0 3000 3000 111 2000
wall -500 265 0 0 615 500 111 2000
wall  785 265 -115 0 500 500 111 2000

wall jump to wall index.png

Do you really need to acquire wall type?
Not sure what you mean. Is it the last parameter of wall?
 
Not sure what you mean. Is it the last parameter of wall?

This line:
C:
void wallt = getlocalvar("type");

How do I acquire each given wall when they are indexed?

I've just reconsidered that and realized that I don't know how. Even if it is possible to do that, player might not always interact with same wall and wall index order is most likely be different in different levels.

The best way is to use checkwall function to check wall's height.
 
I've just reconsidered that and realized that I don't know how. Even if it is possible to do that, player might not always interact with same wall and wall index order is most likely be different in different levels.

The best way is to use checkwall function to check wall's height.
What about checking left and right sides of walls specifically?

I tried using this kind but it doesnt check on the checkwall's height. I'm quite lost on using checkwall function and I haven't used antiwall before. How can I give a check to a different side of a wall block, even if a player is between two wall blocks for jumping on wall directly?
C:
        if(vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_FORWARDJUMP") || vAniID == openborconstant("ANI_RUNJUMP")){
            if(iJump && y > b+15 && Dir == 0 && H == checkwall(x,depth,height)){ // Face left BEHIND left side of wall?
                //changeentityproperty(self, "direction", 0);
                //H = checkwall(UL+LL,depth,height);
                //Hz = checkwall(x+5,z+0);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial6"));
            }else if(iJump && y > b+15 && Dir == 1 && H == checkwall(x,z,height)){ // Face right BEHIND right side of wall?
                //changeentityproperty(self, "direction", 1);
                H = checkwall(UR+LR,depth,height);
                //Hz = checkwall(x+5,z+0);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial46"));
            }else if(iJump && y > b+15 && Dir == 0 && H == checkwall(x,z,height)){ // Face left TO right side of wall?
                //changeentityproperty(self, "direction", 1);
                H = checkwall(x-=0,z,y+=15);
                //Hz = checkwall(x+5,z+0);
                changeentityproperty(self, "animation", openborconstant("ANI_freespecial4"));
            }else if(iJump && y > b+15 && Dir == 1 && H == checkwall(x,depth,height)){ // Face right TO left side of wall?
                //changeentityproperty(self, "direction", 0);
                //H = checkwall(UL+LL,depth,height);
                //Hz = checkwall(x+5,z+0);
                changeentityproperty(self, "animation", openborconstant("ANI_Freespecial13"));
            }
        }

What would be a better option? Should I use checkwall for checking two sides of a wall while jumpmovex is used? Or should I remove jumpmovex for making a replica script ala jumpmove style along with animation script?
 
I'm quite lost on using checkwall function
You could try using checkwall function in some kind of updatescript to check height of wall in front of player. This is for practicing.

How can I give a check to a different side of a wall block, even if a player is between two wall blocks for jumping on wall directly?

You need to acquire player's velocity. If player is moving to the right, then check wall to the right of player, if moving to the left, check to the left. That should work whether there's another wall opposite of the player.

Should I use checkwall for checking two sides of a wall while jumpmovex is used?
No, just check the direction player is moving toward to.
should I remove jumpmovex for making a replica script ala jumpmove style along with animation script?

There's no need to replicate jumpmove since onblockwscript should work with any movement.
 
Eh maxman, something just crossed my mind. Do you really need to check wall's height in onblockWscript? if your character has been blocked by wall, that simply means the wall is tall enough to block the character. IOW there's no need to check wall's height.
OTOH I've checked my other projects and recalled that I've used keyscript for wall jump. Since keyscript is not related to any walls, checking wall's height is necessary before performing wall jump animation.

onblockwscript should be used if you want character to change animation to wall stop or wall latch animation when they are blocked by walls. IIRC Double Dragon 3 features jump kick which could bounce off wall, onblockwscript is perfect for this.
 
Good news, Bloodbane. I was able to solve this with the checkwall function working under onblockWscript. BTW I'm not using keyscript for this, so it's now working as I was expecting with onblockW. The checkwall function you suggested earlier works perfectly!

Here's a new change.

C:
void main()
{
    void self = getlocalvar("self");
    void Dir = getentityproperty(self, "direction");
    void vAniID = getentityproperty(self,"animationID");
    void wallt = getlocalvar("type");
    int iPIndex = getentityproperty(self,"playerindex");
    void iJump = playerkeys(iPIndex, 1, "jump");
    void vSpawn;
    int SFX = loadsample("data/sounds/beatxm2.wav");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int b = getentityproperty(self, "base");
    float leftSideOfWall;
    float rightSideOfWall;

    if(wallt==1){
        if(vAniID != openborconstant("ANI_FALL80")){
            clearspawnentry();
            setspawnentry("name", "Bflash");
            vSpawn = spawn();
            changeentityproperty(vSpawn, "position", x-5, z+2, y+51);
            changeentityproperty(vSpawn, "direction", Dir);
            spawn();
            damageentity(self, self, 10, 1, openborconstant("ATK_NORMAL"));
            changeentityproperty(self, "direction", 0);
            tossentity(self, 1.3, 0.8, 0);
            playsample(SFX, 0, 60, 60, 100, 0);
        }
    }else if(wallt==2){
        if(vAniID != openborconstant("ANI_FALL80")){
            clearspawnentry();
            setspawnentry("name", "Bflash");
            vSpawn = spawn();
            changeentityproperty(vSpawn, "position", x+5, z+2, y+51);
            changeentityproperty(vSpawn, "direction", Dir);
            spawn();
            damageentity(self, self, 10, 1, openborconstant("ATK_NORMAL"));
            changeentityproperty(self, "direction", 1);
            tossentity(self, 1.3, -0.8, 0);
            playsample(SFX, 0, 60, 60, 100, 0);
        }
    }
    if(vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_RUNJUMP")){
        leftSideOfWall = checkwall(x-5,z); // Viewer's right (left side of wall platform)
        rightSideOfWall = checkwall(x+5,z); // Viewer's left (right side of wall platform)

        if(iJump && y > b+15 && Dir == 0 && rightSideOfWall == 0){ // Jump TOWARDS RIGHT SIDE of wall at LEFT SIDE of screen WHILE FACING LEFT
            changeentityproperty(self, "animation", openborconstant("ANI_freespecial6")); // Fly
        }else if(iJump && y > b+15 && Dir == 1 && leftSideOfWall == 0){ // Jump TOWARDS LEFT SIDE of wall at RIGHT SIDE of screen WHILE FACING RIGHT
            changeentityproperty(self, "animation", openborconstant("ANI_freespecial46")); // Jump attack
        }else if(iJump && y > b+15 && Dir == 0 && leftSideOfWall == 0){ // Jump BEHIND LEFT SIDE of wall at RIGHT SIDE of screen WHILE FACING LEFT
            changeentityproperty(self, "animation", openborconstant("ANI_jumpcant")); // Jump cant
        }else if(iJump && y > b+15 && Dir == 1 && rightSideOfWall == 0){ // Jump BEHIND RIGHT SIDE of wall at LEFT SIDE of screen WHILE FACING RIGHT
            changeentityproperty(self, "animation", openborconstant("ANI_attack2")); //Attack 2 combo
        }
    }

}

The checkwall function is a lot useful. Thank you very much, Bloodbane.
 
Last edited:
Back
Top Bottom