Climbing (or Walking) on Walls and Ceilings

maxman

Well-known member
I have some issues with how the character interacts with the bottom of the platform (or ceiling). I got that climbing script on ceiling working, but when I'm dropping myself after the jumping momentum and touching the bottom of the platform overhead, I'm able to grip while being a bit far away from the ceiling and it's weird. Also, while gripping the ceiling, I can move only right, but I cannot move left. How am I going to press left after making this keyscript for it? How can I make the character grip the ceiling overhead without gripping far away from it?

Character text file:

wolvkey.c:
C:
void main(){
    int index = getlocalvar("player");
    void self = getplayerproperty(index, "entity");
    void aniID = getentityproperty(self, "animationid");
    int dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int y = getentityproperty(self, "a");
    int frame = getentityproperty(self, "animpos");

    // Holds
    void UpH = playerkeys(index, 0, "moveup");
    void RightH = playerkeys(index, 0, "moveright");
    void LeftH = playerkeys(index, 0, "moveright");
    void DownH = playerkeys(index, 0, "movedown");

    void JumpH = playerkeys(index, 0, "jump");

    // Presses
    void Up = playerkeys(index, 1, "moveup");
    void Right = playerkeys(index, 1, "moveright");
    void Left = playerkeys(index, 1, "moveright");
    void Down = playerkeys(index, 1, "movedown");

    void Jump = playerkeys(index, 1, "jump");

    // Releases
    void UpR = playerkeys(index, 2, "moveup");
    void RightR = playerkeys(index, 2, "moveright");
    void LeftR = playerkeys(index, 2, "moveright");
    void DownR = playerkeys(index, 2, "movedown");

    void Plat = checkplatformabove(x, z, y+1);
    //void PlatSide = checkplatformbetween(x, z, y+0, y+14); // checkplatformbetween(x,z,ymin,ymax);
    int Length; int Px; int Py; void PlatA; void PlatB; int Wall;
    int PlatY = getentityproperty(Plat, "y");
    void PlatBase = getentityproperty(Plat, "base");


    /*
    if(Plat){
        Length = getentityproperty(Plat, "antigrab");
        Px = getentityproperty(Plat, "x");
    }
    */
    
    //Grip the ceiling
    if(UpH && Plat){
        if(aniID == openborconstant("ANI_JUMP") ){
            changeentityproperty(self, "subject_to_gravity", 0);
            changeentityproperty(self, "aiflag", "jumping", 0);
            Length = getentityproperty(Plat, "antigrab");
            Px = getentityproperty(Plat, "x");
            Py = getentityproperty(Plat, "a");
            performattack(self, openborconstant("ANI_FOLLOW8"));
        }
    }
    

    /*
    if(Plat){
        if(aniID == openborconstant("ANI_FOLLOW8")){
            if(LeftR || LeftR){
                if(!LeftH && !RightH){
                    changeentityproperty(self, "velocity", 0, 0, 0);
                }
            }else if(Left){
                changeentityproperty(self, "velocity", -1, 0, 0);
                changeplayerproperty(self, "playkeys, 0);
                performattack(self, openborconstant("ANI_FOLLOW5"));
            }else if(Right){
                changeentityproperty(self, "velocity", 1, 0, 0);
                changeplayerproperty(self, "playkeys, 0);
                performattack(self, openborconstant("ANI_FOLLOW5"));
                }
            }
        }

        if(aniID == openborconstant("ANI_FOLLOW5")){
            if(LeftR || LeftR){
                if(!LeftH && !RightH){
                    changeentityproperty(self, "velocity", 0);
                    performattack(self, openborconstant("ANI_FOLLOW8"));
                }
            }
        }
    }
    */

    
    // Move around the ceiling
    if(aniID == openborconstant("ANI_FOLLOW8")){
        if(LeftR || RightR || DownR){
            if(!LeftH || !RightH || !DownH ){
                changeentityproperty(self, "velocity", 0, NULL(), NULL());
                //changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
            }
        }
        if(Left){
            changeentityproperty(self, "direction", 0);
            changeentityproperty(self, "velocity", -1.5, NULL(), NULL());
            changeplayerproperty(self, "playkeys", 0);
            changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
            //performattack(self, openborconstant("ANI_FOLLOW5"));
        }if(Right){
            changeentityproperty(self, "direction", 1);
            changeentityproperty(self, "velocity", 1.5, NULL(), NULL());
            changeplayerproperty(self, "playkeys", 0);
            changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
            //performattack(self, openborconstant("ANI_FOLLOW5"));
        }
        
        if(DownH && Jump){
            //tossentity(self, -1, 0, 0);
            performattack(self, openborconstant("ANI_FREESPECIAL4"));
            changeentityproperty(self, "subject_to_gravity", 1);
            changeentityproperty(self, "aiflag", "jumping", 1);
        }
        
    }
    

    
    if(aniID == openborconstant("ANI_FOLLOW5")){
        if(LeftR || RightR){
            if(!LeftH || !RightH){
                changeentityproperty(self, "velocity", 0, NULL(), NULL());
                changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
            }
        }
    }
    
}

wolvOnMoveA.c:
C:
void main(){
    void self = getlocalvar("self");
    void ani = getentityproperty(self, "animationid");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "y");
    int z = getentityproperty(self, "z");
    int Vy = getentityproperty(self, "tossv");
    void Plat = checkplatformabove(x, z, y);

    if(ani == openborconstant("ANI_FOLLOW8") && Plat ){
        changeentityproperty(self, "velocity", 0, 0, 0);
        //changeentityproperty(self, "y", y+20);
    }
}

onBlockPScript.c:
C:
void main()
{
    void self = getlocalvar("self"); //Get calling entity.
    //int index = getentityproperty(self, "playerindex");
    //int up = playerkeys(index, 0, "moveup");
    //int right = playerkeys(index, 0, "moveright");
    //int left = playerkeys(index, 0, "moveleft");
    //int down = playerkeys(index, 0, "movedown");
    //int x = getentityproperty(self, "x);
    //int z = getentityproperty(self, "z");
    //int y = getentityproperty(self, "y");
    void platform = getlocalvar("platform"); //Get calling entity.
    //void aniID = getentityproperty(self, "animationid");
    float selfH = getentityproperty(self,"y")+getentityproperty(self,"height"); //get player height
    float platformH = getentityproperty(platform,"y")+getentityproperty(platform,"height"); //get platform height

    float hang = platformH - getentityproperty(self,"aggression");

    //float H = checkplatformbelow(x, z, y);

    if(selfH > platformH &&  getentityproperty(self, "animationid")==openborconstant("ANI_JUMP"))
    {
        changeentityproperty(self, "velocity", 0, 0, 0); //Stop momentum!
        changeentityproperty(self, "antigravity", 1);//stop falling
        changeentityproperty(self, "y",hang); //change altitude to match platform
        changeentityproperty(self, "animation", openborconstant("ANI_freespecial3"));
    }
}

I will ask about climbing on walls later. For now, my issue is the ceiling.
 

Bloodbane

Well-known member
You know,maxman, I think this kind of problem is best shown with small demo. Even if all of quoted scripts are working, it's hard to tell the issue without the level.
 

maxman

Well-known member
The keyscript from anim follow8 looks like it's working well, but the weird thing is that I cannot press left. The build I'm using is build 7142, according to the log.

Code:
settime 0
# Load images
#bglayer    data/bgs/climbtest/wall.gif
panel    data/bgs/climbtest/wall.gif
direction both
order a

wall 0 216 -5 -5 93 93 10 128
#wall 416 216 0 0 104 104 10 132
wall 396 216 0 0 104 104 10 132

#scrollx 0 1000
#at 0

group 100 100
at 0

#scrollx 0 5000
#at 0

spawn    ene
#@script
void main(){
  settextobj(0, 130 , 140 , 2, -1, "WALL");
}
@end_script
coords    0 216
at    0

#spawn platform1
#coords 0 216 131
#at 0

#group 1 1
#at 0

spawn    plat1
coords    192 216 92
at 0

spawn    plat2
coords    574 216 24
at    0

spawn    plat3
coords    690 216 69
at    0

spawn    plat4
coords    825 216 100
at    0

#spawn platform2
#coords 203 216 131
#at 0

spawn    ene
coords    100 216
at    0

Four platforms and one empty enemy type entity.

Code:
name plat1
type none
shadow 0
antigravity 100
height 93

anim idle

    delay 100
    offset 0 0
    platform 0 0 0 0 111 111 10 93
    frame data/chars/misc/empty.gif

Code:
name plat2
type none
shadow 0
antigravity 100

anim idle
    delay 100
    offset 0 0
    platform 0 0 0 0 100 100 10 29
    frame data/chars/misc/empty.gif

Code:
name plat3
type none
shadow 0
antigravity 100

anim idle

    delay 100
    offset 0 0
    platform 0 0 0 0 114 114 10 29
    frame data/chars/misc/empty.gif

Code:
name plat4
type none
shadow 0
antigravity 100

anim idle

    delay 100
    offset 0 0
    platform 0 0 0 0 127 127 10 34
    frame data/chars/misc/empty.gif

Code:
name    ene
health    110
speed 0
type    enemy
shadow    0
icon    data/chars/misc/empty.gif
nomove 1

anim idle
coords 0 0
delay 0
frame    data/chars/misc/empty.gif

I'll show a video of it of what I mean when I come back.

Here is the problem.


The look of the keyscript looks like it's working but I cannot press or hold left if you watch the video.
 

Attachments

  • bor - 0000.png
    bor - 0000.png
    3.1 KB · Views: 1
Last edited:

maxman

Well-known member
Sadly, having else if condition with the Right key results him moving left instead. I cannot make him move right and press left key at all.

C:
    // Move around the ceiling
    if(aniID == openborconstant("ANI_FOLLOW8")){
        if(LeftR || RightR || DownR){
            if(!LeftH || !RightH || !DownH ){
                changeentityproperty(self, "velocity", 0, NULL(), NULL());
                //changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
            }
        }

        if(Left){
            changeentityproperty(self, "direction", 0);
            changeentityproperty(self, "velocity", -1.5, NULL(), NULL());
            changeplayerproperty(self, "playkeys", 0);
            changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
            //performattack(self, openborconstant("ANI_FOLLOW5"));
        }
        else if(Right){
            changeentityproperty(self, "direction", 1);
            changeentityproperty(self, "velocity", 1.5, NULL(), NULL());
            changeplayerproperty(self, "playkeys", 0);
            changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
            //performattack(self, openborconstant("ANI_FOLLOW5"));
        }
        
        if(DownH && Jump){
            //tossentity(self, -1, 0, 0);
            performattack(self, openborconstant("ANI_FREESPECIAL4"));
            changeentityproperty(self, "subject_to_gravity", 1);
            changeentityproperty(self, "aiflag", "jumping", 1);
        }
        
    }

Is there something wrong with the key input? I already have checkplatformabove in check, but I don't know how to detect the platform's ground altitude on air between that and the character's top of his head within Y axis.
 

Cachito

New member
Why don't you try to make something like this as you could see in second 38
. My solution to make Pimple could climb the fence was to set an entity (two in reality, I'll explain late) at the foot of the fence that hits you without reaction. At it's place, this entity give a weapon (in this case Pimple climb) and you can move as you can see. By the way, when you going down there's another entity that hits you again, returning Pimple to it's normal state (without any weapon). If you look well in the video I share, it's shown the exactly moment when happen because I let visible those entities names as Weapcon and Weapsin... Forgive me if I'm anoying, I'd just like to share my way to find out any solution for those Who don't know to make scripts but keep trying to solve it's troubles someother way. Hope this be helpful in this case or maybe other time. Greetings.
 

DCurrent

Site Owner, OpenBOR Project Leader
Staff member
Why don't you try to make something like this as you could see in second 38
. My solution to make Pimple could climb the fence was to set an entity (two in reality, I'll explain late) at the foot of the fence that hits you without reaction. At it's place, this entity give a weapon (in this case Pimple climb) and you can move as you can see. By the way, when you going down there's another entity that hits you again, returning Pimple to it's normal state (without any weapon). If you look well in the video I share, it's shown the exactly moment when happen because I let visible those entities names as Weapcon and Weapsin... Forgive me if I'm anoying, I'd just like to share my way to find out any solution for those Who don't know to make scripts but keep trying to solve it's troubles someother way. Hope this be helpful in this case or maybe other time. Greetings.

You're not annoying anyone @Cachito, so don't worry about that. However, we generally try to discourage "anti-script" alternatives. OpenBOR didn't always have script, and we used techniques like this for a very long time. We called them Hackarounds. The problem is they are not fully stable, and tend to have unwanted side effects.

Example: What happens when you want to climb a ladder AND carry a weapon. Are you going to make weapon models for every possible combination? That's just one of many issues that can come from your method. If something can be done well without script, that's the solution we offer. When we offer a scripted solution instead, it's because we already know about the hackaround version and realized it wasn't the best idea. You aren't making things easier by avoiding script. Quite the opposite. You are giving yourself (and possibly others) more work for less benefit.

@maxman,

The first thing you are doing wrong is using individual key variables. Please have another look at my recent tutorials on keyscripts. You can (and should) use bitwise logic to check your active keys. This will help simplify the code and weed out the bugs. I will try to take a closer look soon.

DC
 

Cachito

New member
You're not annoying anyone @Cachito, so don't worry about that. However, we generally try to discourage "anti-script" alternatives. OpenBOR didn't always have script, and we used techniques like this for a very long time. We called them Hackarounds. The problem is they are not fully stable, and tend to have unwanted side effects.

Example: What happens when you want to climb a ladder AND carry a weapon. Are you going to make weapon models for every possible combination? That's just one of many issues that can come from your method. If something can be done well without script, that's the solution we offer. When we offer a scripted solution instead, it's because we already know about the hackaround version and realized it wasn't the best idea. You aren't making things easier by avoiding script. Quite the opposite. You are giving yourself (and possibly others) more work for less benefit.

@maxman,

The first thing you are doing wrong is using individual key variables.ease have another look at my recent tutorials on keyscripts. You can (and should) use bitwise logic to check your active keys. This will help simplify the code and weed out the bugs. I will try to take a closer look soon.

DC
OK. I'm just begining and this is my first mod. Don't know if will be another one. Also don't know if gonna learn about scripts and just enjoying making my own game. I'll just step aside and limit myself to share my mod. Greetings and good luck to @maxman on his quest.
 

DCurrent

Site Owner, OpenBOR Project Leader
Staff member
OK. I'm just begining and this is my first mod. Don't know if will be another one. Also don't know if gonna learn about scripts and just enjoying making my own game. I'll just step aside and limit myself to share my mod. Greetings and good luck to @maxman on his quest.

@Cachito

No need to step aside as you put it. Just let us help you and trust our experience. Next time you're needing to do something complex or you are unsure about a trick, let us know and we might be able to save you a lot of time getting it going. The whole point of this forum is to pass on knowledge to help you create. :)

DC
 

Bloodbane

Well-known member
results him moving left instead.

Let me get this right, if you press Left, Wolvie will move left but if you press right, he moves left?

I cannot make him move right and press left key at all.

What do you mean? you want to move right while pressing left key?

I've attempted something similar before with Spiderman and I used functions to allow him to move left or right while sticking on ceiling. It's hard to tell the system in detail but it's similar to Billy's climb ladder from Double Dragon Mini.
 
Last edited:

maxman

Well-known member
Let me get this right, if you press Left, Wolvie will move left but if you press right, he moves left?
What do you mean? you want to move right while pressing left key?
No. What I mean is this. When I press right key, he moves only left. But when I press left key, he doesn't move at all.

With else if condition set for Right key, he only moves left. If I revert back to the if condition for the Right key, he moves right side, but I cannot move left side with Left key.
 

maxman

Well-known member
Thanks DC (@DCurrent)! The bitwise logic works well as you said! But I'm still having trouble with the overhead hitting the bottom of the platform or the ceiling because he can grip without touching the ceiling OR by overreaching the ceiling which he can't move sometimes. Is it because the character has a height of 50 or something?

Here is my new keyscript.

wolvkey.c:
C:
void main(){
    ceilingGripping();
}

void ceilingGripping(){

    void target;        // Target entity for action.
    int player_index;   // Player index triggering event.
    void animation_ID;
    void direction;
    int x_coordinate;
    int y_coordinate;
    int z_coordinate;
    //int height;
    int frame;
    void PlatformCeiling;
    void ClimbWall;

    // Key status.
    int key_hold;
    int key_press;
    int key_release;
    int key_forward;

    // Get the player index and target entity.
    player_index    = getlocalvar("player");
    target          = getplayerproperty(player_index, "entity");     

    // Get action from target entity.
    animation_ID = getentityproperty(target, "animationid");
    direction = getentityproperty(target, "direction");
    x_coordinate = getentityproperty(target, "x");
    y_coordinate = getentityproperty(target, "y");
    z_coordinate = getentityproperty(target, "z");
    frame = getentityproperty(target, "animpos");

    PlatformCeiling = checkplatformabove(x_coordinate, z_coordinate, 0);
    ClimbWall = checkwall(0, z_coordinate, 0);

    // Get key hold status.
    key_hold    = getplayerproperty(player_index, "keys");
    key_press    = getplayerproperty(player_index, "newkeys");
    key_release    = getplayerproperty(player_index, "releasekeys");

    if(PlatformCeiling && key_hold & openborconstant("FLAG_MOVEUP")){ // CEILING CLIMB/GRIP?

        if(animation_ID == openborconstant("ani_jump")){
            changeentityproperty(target, "subject_to_gravity", 0);
            changeentityproperty(target, "aiflag", "jumping", 0);
            //Length = getentityproperty(PlatformCeiling, "antigrab");
            //Px = getentityproperty(PlatformCeiling, "x");
            //Py = getentityproperty(PlatformCeiling, "a");
            performattack(target, openborconstant("ANI_FOLLOW8"));
        }

    }

  
    if(ClimbWall){ // WALL CLIMB?

        if( (key_hold & openborconstant("FLAG_MOVERIGHT") && direction == openborconstant("DIRECTION_RIGHT")) || (key_hold & openborconstant("FLAG_MOVELEFT") && direction == openborconstant("DIRECTION_LEFT")) ){

            if(animation_ID == openborconstant("ani_jump") || animation_ID == openborconstant("ani_walk") ){
                changeentityproperty(target, "subject_to_gravity", 0);
                changeentityproperty(target, "aiflag", "jumping", 0);
                performattack(target, openborconstant("ANI_FOLLOW4"));
            }

        }

    }
  

  
    if(animation_ID == openborconstant("ani_follow4")){ // STICKING TO WALL?

        if(key_hold & openborconstant("FLAG_MOVEUP")){
            changeentityproperty(target, "velocity", 0, 0, 1);
            performattack(target, openborconstant("ani_follow1"));
        }

        if(key_hold & openborconstant("FLAG_MOVEDOWN")){
            changeentityproperty(target, "velocity", 0, 0, -1);
            performattack(target, openborconstant("ani_follow2"));
        }
    }
  

    if(animation_ID == openborconstant("ani_follow8")){ // STICKING TO CEILING?

        if(key_hold & openborconstant("FLAG_MOVELEFT")){
            changeentityproperty(target, "direction", 0);
            changeentityproperty(target, "velocity", -1, 0, 0);
            performattack(target, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVERIGHT")){
            changeentityproperty(target, "direction", 1);
            changeentityproperty(target, "velocity", 1, 0, 0);
            performattack(target, openborconstant("ani_follow5"));      
        }

        if(key_hold & openborconstant("FLAG_MOVELEFT") && direction == openborconstant("DIRECTION_RIGHT")){
            changeentityproperty(target, "direction", 0);
            changeentityproperty(target, "x", x_coordinate-7);
            changeentityproperty(target, "velocity", -1, 0, 0);
            performattack(target, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVERIGHT") && direction == openborconstant("DIRECTION_LEFT")){
            changeentityproperty(target, "direction", 1);
            changeentityproperty(target, "x", x_coordinate+7);
            changeentityproperty(target, "velocity", 1, 0, 0);
            performattack(target, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVEDOWN") && key_press & openborconstant("FLAG_JUMP")){

            performattack(target, openborconstant("ANI_FREESPECIAL4"));  
            changeentityproperty(target, "subject_to_gravity", 1);
            changeentityproperty(target, "aiflag", "jumping", 1);

        }
    }

    if(animation_ID == openborconstant("ani_follow5")){ // JUMP OFF FROM CEILING?
        changeentityproperty(target, "velocity", 0, 0, 0);
        performattack(target, openborconstant("ANI_FOLLOW8"));
        updateframe(target, 2);
    }

}

If you look at the code of the wall platform, I'm also having trouble climbing up or down when interacting with walls for climbing vertically. Whether I jump or walk to it, I can't have him perform the climb part.

Code:
anim follow1 # Climbing up
    delay    1
    offset 76 106
    loop 1 1
    frame    data/chars/logan/climb/cv1.png
    delay    6
    frame    data/chars/logan/climb/cv1.png
    frame    data/chars/logan/climb/cv2.png
    frame    data/chars/logan/climb/cv3.png
    frame    data/chars/logan/climb/cv4.png
    frame    data/chars/logan/climb/cv5.png
    frame    data/chars/logan/climb/cv6.png

anim follow2 # Climbing down
    delay    1
    offset 76 106
    loop 1 1
    frame    data/chars/logan/climb/cv6.png
    delay    6
    frame    data/chars/logan/climb/cv6.png
    frame    data/chars/logan/climb/cv5.png
    frame    data/chars/logan/climb/cv4.png
    frame    data/chars/logan/climb/cv3.png
    frame    data/chars/logan/climb/cv2.png
    frame    data/chars/logan/climb/cv1.png

There's something I forgot about. If I want to reach the edge of the ceiling or the bottom platform, how can I make him jump off from it after passing by the end of it?
 
Last edited:

Bloodbane

Well-known member
Whether I jump or walk to it, I can't have him perform the climb part.

Hmmm.... maybe you should check onblockwscript to see if Wolvie would climb wall if he's blocked by a wall when jumping or walking toward a wall.

If I want to reach the edge of the ceiling or the bottom platform, how can I make him jump off from it after passing by the end of it?

The challenge is to know when you've reached the edge. 2D platforms in my 2D games have antigrab and grabforce defining their length and width respectively. With their offset defined at the center of the platform, I could measure entity's distance from platform's edge. You should do the same :).
 

maxman

Well-known member
@Cachito It sounds like a very good idea when it comes to no doing script especially when I use some older versions because there are new script functions that other older versions cannot understand depending on their availability and their existence before other updated builds released.

Hmmm.... maybe you should check onblockwscript to see if Wolvie would climb wall if he's blocked by a wall when jumping or walking toward a wall.
The challenge is to know when you've reached the edge. 2D platforms in my 2D games have antigrab and grabforce defining their length and width respectively. With their offset defined at the center of the platform, I could measure entity's distance from platform's edge. You should do the same :).
Do you have any example for the climb-off drop after surpassing the edge of the platform?

And how about Beast flipping/jumping to the ceiling but goes upside down with his anim idle? I wonder if using normal anim walk on the ceiling is possible.
 

maxman

Well-known member
I made a new onblockPscript and added Length as antigrab property here, but I can't seem to have him jump off the ceiling. What did I do wrong?

platform.c:
C:
void main(){
    plataforma();
}

void plataforma(){

    int index = getlocalvar("player");
    int entity = getplayerproperty(index, "entity");
    void aniID = getentityproperty(entity, "animationid");
    void dir = getentityproperty(entity, "direction");
    int x = getentityproperty(entity, "x");
    int z = getentityproperty(entity, "z");
    int y = getentityproperty(entity, "y");

    void Climb;
    void Ceiling;

    void Length;
    void Width;
    int Px; void PlatA; void PlatB; //int Wall;

    int key_hold = getplayerproperty(index, "keys");
    int key_press = getplayerproperty(index, "newkeys");
    int key_release = getplayerproperty(index, "releasekeys");

    Ceiling = checkplatformabove(x, z, y-2);
    //Climb = checkplatformbetween(x, z, y);

    if(Ceiling && key_hold & openborconstant("FLAG_MOVEUP")){
        changeentityproperty(entity, "subject_to_gravity", 0);
        changeentityproperty(entity, "aiflag", "jumping", 0);
        performattack(entity, openborconstant("ANI_FOLLOW8"));
    }

    if(aniID == openborconstant("ANI_FOLLOW8")){

        Length = getentityproperty(Ceiling, "antigrab");
        Px = getentityproperty(Ceiling, "x");

        if(dir == openborconstant("DIRECTION_RIGHT")){
            PlatA = checkplatformabove(x+24, z, y-2);
            PlatB = checkplatformabove(x+24, z, y+2);
        }else{
            PlatA = checkplatformabove(x-24, z, y-2);
            PlatB = checkplatformabove(x-24, z, y+2);
        }

        if(x >= Px + Length/2 - 23 && PlatA == PlatB){
            performattack(entity, openborconstant("ANI_WALKOFF"));
            changeentityproperty(entity, "velocity", 1, 0, 0);
            changeentityproperty(entity, "subject_to_gravity", 1);
            changeentityproperty(entity, "aiflag", "jumping", 1);
        }else if(x <= Px - Length/2 + 23 && PlatA == PlatB){
            performattack(entity, openborconstant("ANI_WALKOFF"));
            changeentityproperty(entity, "velocity", -1, 0, 0);
            changeentityproperty(entity, "subject_to_gravity", 1);
            changeentityproperty(entity, "aiflag", "jumping", 1);
        }

        if(key_hold & openborconstant("FLAG_MOVELEFT")){
            changeentityproperty(entity, "direction", 0);
            changeentityproperty(entity, "velocity", -1, 0, 0);
            performattack(entity, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVERIGHT")){
            changeentityproperty(entity, "direction", 1);
            changeentityproperty(entity, "velocity", 1, 0, 0);
            performattack(entity, openborconstant("ani_follow5"));        
        }

        if(key_hold & openborconstant("FLAG_MOVELEFT") && dir == openborconstant("DIRECTION_RIGHT")){
            changeentityproperty(entity, "direction", 0);
            changeentityproperty(entity, "x", x-7);
            changeentityproperty(entity, "velocity", -1, 0, 0);
            performattack(entity, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVERIGHT") && dir == openborconstant("DIRECTION_LEFT")){
            changeentityproperty(entity, "direction", 1);
            changeentityproperty(entity, "x", x+7);
            changeentityproperty(entity, "velocity", 1, 0, 0);
            performattack(entity, openborconstant("ani_follow5"));
        }

        if(key_hold & openborconstant("FLAG_MOVEDOWN") && key_press & openborconstant("FLAG_JUMP")){

            performattack(entity, openborconstant("ANI_FREESPECIAL4"));    
            changeentityproperty(entity, "subject_to_gravity", 1);
            changeentityproperty(entity, "aiflag", "jumping", 1);

        }
    }


}

I'll do the climbing on both walls and entity platforms later.
 

maxman

Well-known member
Sweet! I think you only showed me the video and explained to me that walls and ceilings are enemy type instead of none type, but there's no need to use script for it. Problem for me is the lack of example(s). However, I'm looking forward to the upload whether there's script or not. Thank you very much.

EDIT:
Sweet! Thanks for the upload! I'm gonna check it out myself.
 
Last edited:
Top Bottom