Jump from walls / edges

NED

Well-known member
Basically, I'm trying to understand how to do triangle jump (Chun Li wall jump move) But with an automatic move done like triangle jump kick...

I would like it to be possible on screen edge, walls and vertical surface of obstacles and platforms.

I've seen in the BK chinese mod I won't name here...

Is there a way to use this feature?
Thanks
 
Here my key.c

Code:
void main()
{
//	int iPlIndex = 0; //Player index.
	int iPlIndex = getlocalvar("self"); //Get calling player
//	int iPlIndex = getentityproperty(self,"playerindex"); //Get player index
    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");	// Get x pos
    int y = getentityproperty(vSelf, "a");	// Get y pos
    int z = getentityproperty(vSelf, "z");	// Get z pos

    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 status of "Attack 2"
    void iAttack3 = playerkeys(iPlIndex, 1, "attack3"); // New key status of "Attack 3"
    void iAttack4 = playerkeys(iPlIndex, 1, "attack4"); // New key status of "Attack 4"

	void iUpR = playerkeys(iPlIndex, 2, "moveup"); // Release status of "moveup"
	void iDownR = playerkeys(iPlIndex, 2, "movedown"); // Release status of "movedown"
    void iLeftR = playerkeys(iPlIndex, 2, "moveleft"); // Release status of "Left"
    void iRightR = playerkeys(iPlIndex, 2, "moveright"); // Release status of "Right"
	void iJumpR = playerkeys(iPlIndex, 2, "jump"); // Release status of "Jump"
	void iSpecialR = playerkeys(iPlIndex, 2, "Special"); // Release status of "Special"
	void iAttackR = playerkeys(iPlIndex, 2, "attack"); //Release status of "Attack"
	void iAttack2R = playerkeys(iPlIndex, 2, "attack2"); // Release status of "Attack 2"
	void iAttack3R = playerkeys(iPlIndex, 2, "attack3"); // Release status of "Attack 3"
	void iAttack4R = playerkeys(iPlIndex, 2, "attack4"); // Release status of "Attack 4"

	if(vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_FORWARDJUMP") || vAniID == openborconstant("ANI_RUNJUMP") || vAniID == openborconstant("ANI_FOLLOW16"))
	{ //Jumping?	
		if (iJump)
		{ //New jump key press?
			if(iDir == 1 && y <= checkwall(x+5,z))
			{ // There is a wall
				changeentityproperty(vSelf, "direction", 0); 
				// Change to left facing
				changeentityproperty(vSelf, "velocity", 0, 0, 0); 
				// Set velocity
				changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW16"));
				// Switch to wall jump anim
			}
			else if(iDir == 0 && y <= checkwall(x-5,z))
			{ // There is a wall
				changeentityproperty(vSelf, "direction", 1);
				// Change to left facing
				changeentityproperty(vSelf, "velocity", 0, 0, 0);
				// Set velocity
				changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW16"));
				// Switch to wall jump anim
			}
			else if(y > checkwall(x-5,z) || checkwall(x-5,z))
			{ // There is no wall
				changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW4"));
				// Switch to double jump anim
			}
		}	
	}

Then on the player anim:

Code:
#-------WALL JUMP
anim	follow16
	delay	9
	offset	74 123
	bbox	67 67 25 22
		frame	data/chars/shinobi/193.png
	@cmd	leaper	1.2 3.5 0
		frame	data/chars/shinobi/193.png
	delay	35
	bbox	67 63 17 61
	sound	data/chars/shinobi/jump.wav
		frame	data/chars/shinobi/190.png
	delay	8
		frame	data/chars/shinobi/191.png
	bbox	67 71 17 50
		frame	data/chars/shinobi/192.png

I test it and works.
 
O Ilusionista said:
Care to show how you did?

Well, I just set keyscript like above in player's text.
The script I posted in previous page doesn't change animation. The only change you can see is that when player bounces wall or screen edge, he/she will jump again still playing JUMP or FORWARDJUMP animation

Oh yes, in Avengers demo I noticed that players can move and flip while jumping. If you hold say right button while trying to bounce off rightscreen edge, it will appear that player isn't bouncing but the truth is holding button moves player to right after the bounce making it as if screen edge bounce isn't performed
That's what happened in my first test before I figured out the cause :)
 
O Ilusionista said:
Care to show how you did?

Well, I just set keyscript like above in player's text.
The script I posted in previous page doesn't change animation. The only change you can see is that when player bounces wall or screen edge, he/she will jump again still playing JUMP or FORWARDJUMP animation

Oh yes, in Avengers demo I noticed that players can move and flip while jumping. If you hold say right button while trying to bounce off rightscreen edge, it will appear that player isn't bouncing but the truth is holding button moves player to right after the bounce making it as if screen edge bounce isn't performed
That's what happened in my first test before I figured out the cause :)
 
Oh yes, in Avengers demo I noticed that players can move and flip while jumping. If you hold say right button while trying to bounce off rightscreen edge, it will appear that player isn't bouncing but the truth is holding button moves player to right after the bounce making it as if screen edge bounce isn't performed
ahhhhhh so maybe its the reason, let me check it out.

edit: I changed the jumpmove to this:
jumpmove  0  2
But the code isn't working yet.
Wait, I am stupid and forgot to press J again, lol
 
I am using Goliath's version (both both works) so I can use a new animation.

edit: I got it working the way I wanted:

anim follow5
loop 1 2 5
delay 60
offset 67 114
landframe 5
jumpframe 1 2 2
@script
    if(frame==0){
      void self = getlocalvar("self");
      changeentityproperty(self, "velocity", 0, 0 , 0);
      int  iTime = openborvariant("elapsed_time");
      changeentityproperty(self, "tosstime", iTime + 400);
    }

@end_script
bbox 55 75 33 28
frame data/chars/wolverine/jmpa2-7.png
        delay 12
        frame data/chars/wolverine/roll01.png
delay 6
sound data/sounds/vuu4.wav
frame data/chars/wolverine/roll01.png
frame data/chars/wolverine/roll02.png
frame data/chars/wolverine/roll03.png
frame data/chars/wolverine/roll00.png
bbox 52 72 31 42
delay 4
sound data/chars/ironman/run.wav
frame data/chars/wolverine/a2-3.png
frame data/chars/wolverine/jumpland.png
 
ive made this one only for when the entity dies
but iam using it on the entity header
it will pull the entity inside the screen even if he is 1000 pixel away
you can remove the hp <=0 && lines to make it always work

script @script
void main()
{
  void self = getlocalvar("self");
int x = getentityproperty(self, "x");
int XPos = openborvariant("xpos");
int Screen = openborvariant("hResolution");
int hp = getentityproperty(self, "health");
    void anim = getentityproperty(self,"animationID");

if(anim != openborconstant("ANI_DIE")){

  if( hp <=0 && x >= XPos+Screen-60) // right
  {
tossentity(self, 1, -2, 0);
  }
  else if( hp <=0 && x <= XPos+60) // left
  {
tossentity(self, 1, 2, 0);
  }
  }
}
@end_script
 
I think a combination of elements from these 2 scripts should do it :
-This wall and edge script
-Magggas's wall bounce script

I might be intersted on this one to for some specific game modes
 
I meant I had to lower the +60/-60 values to +10/-10 or it didn't look right.

Code:
   if( hp <=0 && x >= XPos+Screen-60) // right
      {
   tossentity(self, 1, -2, 0);
      }
   else if( hp <=0 && x <= XPos+60) // left
      {
   tossentity(self, 1, 2, 0);
      }
  }
}
 
Bloodbane said:
Wall jump requires keyscript like this:

walljump.c

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 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_JUMP")){
    if(iJump && iDir == 1 && y <= checkwall(x+15,z)){
        changeentityproperty(vSelf, "direction", 0);
        tossentity(vSelf, 3, -1, 0); // Wall Jump
      } else if(iJump && iDir == 0 && y <= checkwall(x-15,z)){
        changeentityproperty(vSelf, "direction", 1);
        tossentity(vSelf, 3, 1, 0); // Wall Jump
      }
    }
}

Copy this in a file name walljump.c, save it in data/scripts folder then declare it like this:

keyscript data/scripts/walljump.c

To perform wall jump, simply jump against a wall then press jump when character is blocked by wall. The character will change direction, jumps higher WITHOUT changing animation

HTH

Got this working with normal and forward jumps, no problems.

-How to make it change to another animation? like for example, I want my characters to jump again, but i have this wallbounce sprite i want to put when this happens.

-How to make it work just at the the peak of the jump instead being able to walljump even if i'm already going down and at a very low altitude?

 
-How to make it change to another animation? like for example, I want my characters to jump again, but i have this wallbounce sprite i want to put when this happens.

Simply change this part :

Code:
    if(vAniID == openborconstant("ANI_JUMP")){
     if(iJump && iDir == 1 && y <= checkwall(x+15,z)){
        changeentityproperty(vSelf, "direction", 0);
        tossentity(vSelf, 3, -1, 0); // Wall Jump
      } else if(iJump && iDir == 0 && y <= checkwall(x-15,z)){
        changeentityproperty(vSelf, "direction", 1);
        tossentity(vSelf, 3, 1, 0); // Wall Jump
      }
    }

to this:

Code:
    if(vAniID == openborconstant("ANI_JUMP")){
     if(iJump && iDir == 1 && y <= checkwall(x+15,z)){
        changeentityproperty(vSelf, "direction", 0);
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW3"));
      } else if(iJump && iDir == 0 && y <= checkwall(x-15,z)){
        changeentityproperty(vSelf, "direction", 1);
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW3"));
      }
    }

The 2nd code changes animation to FOLLOW3 when wall jump is performed
Note : I removed tossentity function cause I assume the jumping will be set in FOLLOW3 animation. Also since player is still in jumping state, when FOLLOW3 is played, player still have jumping momentum IOW not stopping and might fall

-How to make it work just at the the peak of the jump instead being able to walljump even if i'm already going down and at a very low altitude?

If walljump is excluded, it should be simple but if it is, then it's rather complex
 
As O'Ilusionista request this is my hold wall jump.
Assume that you JUMP animation is FOLLOW45:

script data/scripts/player_script.c
Code:
void main() {
  void self = getlocalvar("self");
    // WALL/PLATFORM-SPLAT
    check_hold_platform(self); // (onblockascript??)
    check_hold_wall_anim(self);
}

int check_hold_wall_anim(void player) {
    int anim_id = getentityproperty(player,"animationid");

    if ( anim_id == openborconstant("ANI_FOLLOW45") && getentityproperty(player, "animpos") <= 0 ) {
        int p = getentityproperty(player, "playerindex");
        int game_speed = openborvariant("game_speed");
        float xdir = 1;

        // In questo modo il toss durerà tanto quanto dura il frame 0 di FOLLOW45
        changeentityproperty(player, "tosstime", getentityproperty(player,"tosstime")+game_speed/10);
        changeentityproperty(player, "aiflag", "jumping", 0);
        changeentityproperty(player, "aiflag", "running", 0);
        changeentityproperty(player, "velocity", 0,0,0);
        if ( getentityproperty(player, "direction") == 1 ) xdir *= -1;

        if ( playerkeys(p,0,"jump") ) {
            //changeentityproperty(player,"tosstime",0);
            xdir *= 2;
            tossentity(player, 3, xdir, 0);
            xdir /= 1.5;

            changeentityproperty(player, "aiflag", "running", 1);
            setentityvar(player,5,xdir);
            //changeentityproperty(player, "aiflag", "jumping", 1);
            //performattack(player, openborconstant("ANI_JUMP"), 1);
        } else setentityvar(player,5,xdir);
    }
}

int check_hold_platform(void player) {
    int anim_id = getentityproperty(player,"animationid");
    int p = getentityproperty(player, "playerindex");
    float x = getentityproperty(player, "x");
    float z = getentityproperty(player, "z");
    float a = getentityproperty(player, "y");
    int dir = getentityproperty(player, "direction");
    float t_dist = 3;

    if ( anim_id == openborconstant("ANI_JUMP") ) { // && anim_id != openborconstant("ANI_FOLLOW45") && getentityproperty(player, "aiflag", "jumping")
        if ( playerkeys(p,0,"moveright") == 8 && playerkeys(p,0,"moveleft") != 4 && dir ) {
            void platform = find_platform_in_a(x+t_dist,z+0,a,MAX_ALTITUDE,10,3); // Stabiliamo l'altezza della piattaforma e la quota della stessa

            if ( platform != NULL() ) {
                    changeentityproperty(player, "aiflag", "jumping", 0); // se è a 1 possiamo muoverci
                    //changeentityproperty(player, "aiflag", "running", 0);
                    performattack(player, openborconstant("ANI_FOLLOW45"), 1);
                    //set_hold_wall_anim(player);
            }
        } else if ( playerkeys(p,0,"moveleft") == 4 && playerkeys(p,0,"moveright") != 8 && !dir ) {
            void platform = find_platform_in_a(x-t_dist,z+0,a,MAX_ALTITUDE,10,3); // Stabiliamo l'altezza della piattaforma e la quota della stessa

            if ( platform != NULL() ) {
                    changeentityproperty(player, "aiflag", "jumping", 0); // se è a 1 possiamo muoverci
                    //changeentityproperty(player, "aiflag", "running", 0);
                    performattack(player, openborconstant("ANI_FOLLOW45"), 1);
                    //set_hold_wall_anim(player);
            }

        }
    } // fine se sta saltando
}

// Retrieves platform entity handler if player "y" is about the same height of the platform
void find_platform_in_a(float distx, float distz, float a, float alt_threshold, float shifty, float h_fix) {
    void platform = NULL(), platform_up = NULL();
    float height = NULL(), altitude = NULL();
    //int visit_flag = 0;

    if ( h_fix == NULL() ) h_fix = 1;
    if ( shifty == NULL() ) shifty = 0;
    do {
        platform = checkplatform(distx,distz,alt_threshold);
        if ( platform == NULL() ) return NULL();

        height = getentityproperty(platform, "height");
        altitude = getentityproperty(platform, "y");
        if ( height == NULL() ) height = 0;
        //if ( visit_flag == 0 ) visit_flag = 1;
        //if ( visit_flag == 0 ) return NULL(); // se sin da subito non troviamo alcuna piattaforma al di sotto di alt_threshold è inutile proseguire la ricerca

        if ( a >= altitude-shifty && a <= altitude+(height/h_fix)+shifty ) {
            return platform;
        }

        if ( altitude > a ) {
            platform_up = platform;
            alt_threshold = altitude+height-1;
            continue;
        }

        if ( platform == platform_up ) break;
        if ( a >= altitude || alt_threshold <= 0 ) break;

        --alt_threshold;
    } while( checkplatform(distx,distz,alt_threshold) != NULL() );

    return NULL();
}  

void checkplatform(float distx, float distz, float altitude) {
    void platform = checkplatformbelow(distx,distz,altitude);

    /*if ( typeof(platform) == openborconstant("VT_DECIMAL") ) return NULL();
    else {
        if ( platform == checkplatformbelow(0,0,0) ) return NULL();
        else return platform;
    }*/

    if ( typeof(platform) == openborconstant("VT_PTR") ) {
        if ( platform != checkplatformbelow(0,0,0) ) return platform;
    }

    return NULL();
}

onblockwscript data/scripts/wall_script.c
Code:
#import "data/scripts/player_script.c"
void main() {
    void self = getlocalvar("self");
    check_hold_wall(self);
}

int check_hold_wall(void player) {
    int anim_id = getentityproperty(player,"animationid");
    int p = getentityproperty(player, "playerindex");
    float x = getentityproperty(player, "x");
    float z = getentityproperty(player, "z");
    float a = getentityproperty(player, "y");
    float t_dist = 3;

    if ( anim_id == openborconstant("ANI_JUMP") && checksplattablewall(player,t_dist,t_dist,1) ) { // && anim_id != openborconstant("ANI_FOLLOW45") && getentityproperty(player, "aiflag", "jumping")
        if ( checkwall(x+t_dist,z+0) >= a && playerkeys(p,0,"moveright") == 8 && playerkeys(p,0,"moveleft") != 4 ) {
            changeentityproperty(player, "aiflag", "jumping", 0); // se è a 1 possiamo muoverci
            changeentityproperty(player, "aiflag", "running", 0);
            performattack(player, openborconstant("ANI_FOLLOW45"), 1);
            //set_hold_wall_anim(player);
        } else if ( checkwall(x-t_dist,z+0) >= a && playerkeys(p,0,"moveleft") == 4 && playerkeys(p,0,"moveright") != 8 ) {
            changeentityproperty(player, "aiflag", "jumping", 0);
            changeentityproperty(player, "aiflag", "running", 0);
            performattack(player, openborconstant("ANI_FOLLOW45"), 1);
            //set_hold_wall_anim(player);
        }
    } // fine se sta saltando

    // La funzione di perform holdjump viene fatta attraverso check_hold_platform()
}

in your entity.txt write:
script data/scripts/player_script.c
onblockwscript data/scripts/wall_script.c

and the follow45 anim (example):
Code:
anim	FOLLOW45 # (Hold Wall)
	jumpframe 1 1 -1.5
	landframe 5

	delay 16
		offset  57  80
		bbox  28  25  35  33
	frame	data/chars/leo/s_01.gif
	delay 8
		offset  46  68
		bbox  17  25  35  37
	frame	data/chars/leo/s_02.gif
		offset  44  68
		bbox  31  25  28  40
	frame	data/chars/leo/s_03.gif
		bbox  23  29  35  33
		offset  40  68
	frame	data/chars/leo/s_04.gif
		bbox  27  22  31  37
		offset  38  68
	frame	data/chars/leo/s_05.gif
		bbox  26  19  28  46
		offset  36  68
	frame	data/chars/leo/s_06.gif
 
Back
Top Bottom