Outdated Wall Running?

BullyWiiPlaza

Modder
Messages
214
Reaction score
174
Points
818
How would you implement a
You do not have permission to view link Log in or register now.
?
You do not have permission to view link Log in or register now.
. I guess you get the gist. How would start about doing this? I'm a bit out of ideas on how to detect the distance towards a wall for example and how to attach to it.

Possibly useful functions:
Code:
float distance( vector, vector )
vector getVelocity()
void setVelocity( vector )
void setPlayerGravity( int )

Thanks :grinning:
 

Liam

BU4
Messages
185
Reaction score
171
Points
818
the walls obviously have collisions and/or models.
try something like

if(Distance(self.origin, model.origin) < 20)
{
//attach here
}

idk exactly
 
S

SeriousHD-

Guest
How would you implement a
You do not have permission to view link Log in or register now.
?
You do not have permission to view link Log in or register now.
. I guess you get the gist. How would start about doing this? I'm a bit out of ideas on how to detect the distance towards a wall for example and how to attach to it.

Possibly useful functions:
Code:
float distance( vector, vector )
vector getVelocity()
void setVelocity( vector )
void setPlayerGravity( int )

Thanks :grinning:
Check out my Iconic Source. The "ghost walker" function demonstrates how to get the distance from the walls and whatnot.
 
S

SeriousHD-

Guest
the walls obviously have collisions and/or models.
try something like

if(Distance(self.origin, model.origin) < 20)
{
//attach here
}

idk exactly
They dont. The "level" object can be handled with physicstrace
 

BullyWiiPlaza

Modder
Messages
214
Reaction score
174
Points
818
Check out my Iconic Source. The "ghost walker" function demonstrates how to get the distance from the walls and whatnot.
Thanks for the tip. I extracted the necessary code pieces below. So which parts are needed? It seems a bit messy...
Code:
AddOption("Ghost Walker", ::void_handler, 156);
Code:
else if( option == 156 )
    {
        if(sToggle(156))
            self thread loop_handler( 156 );

    }
Code:
else if( option == 156 )
    {
        a_ent = self get_ahead_ent();
        g_ent = undefined;
        g_tonext = undefined;
        x = undefined;
        y = undefined;
        z = undefined;
        while( sGetBool(156) )
        {
            a_ent = self get_ahead_ent();
            if(isDefined(a_ent))
            {
                g_tonext = self get_free_space();
                if(isDefined(g_tonext))
                {
                    g_ent = self getGroundZPosition( g_tonext );
                    if(isDefined(g_ent))
                    {
                        z = g_ent[2];
                    }
                    else
                        z = (self GetOrigin())[2];
                    x = g_tonext[0];
                    y = g_tonext[1];
                    self setOrigin((x,y,z));
                }
                while(!self isOnGround())
                    wait .01;
            }
            wait .2;
        }
    }

get_ahead_ent()
{
    self.ghostvelocity = self getvelocity();
    if ( lengthsquared( self.ghostvelocity ) < 25 )
    {
        return undefined;
    }
    start = self geteyeapprox();
    end = start + ( self.ghostvelocity * 0.3 );
    mins = ( 0, 1, 0 );
    maxs = ( 0, 1, 0 );
    trace = physicstrace( start, end, vectorScale( ( 0, 1, 0 ), 15 ), vectorScale( ( 0, 1, 0 ), 15 ), self, level.physicstracemaskclip );
    if ( isDefined( trace[ "entity" ] ) )
    {
        return trace[ "entity" ];
    }
    else
    {
        if ( trace[ "fraction" ] < 0.99 || trace[ "surfacetype" ] != "none" )
        {
            return level;
        }
    }
    return undefined;
}

getGroundZPosition( pos1 )
{
    return bullettrace( pos1, (pos1 - (0,0,10000) ), 0, undefined )["position"];
}

get_free_space()
{
    start = self geteyeapprox();
    end = undefined;
    for( i =2; i < 50; i++)
    {
        wait .02;
        end = start + ( self.ghostvelocity * 0.3);
        trace = physicstrace( start, end, vectorScale( ( 0, 1, 0 ), 15 ), vectorScale( ( 0, 1, 0 ), 15 ), self, level.physicstracemaskclip );
        if ( isDefined( trace[ "entity" ] ) )
        {
            start = end;
            continue;
        }
        else if ( trace[ "fraction" ] < 0.99 || trace[ "surfacetype" ] != "none" )
        {
            start = end;
            continue;
        }
        break;
    }
    if( end != start)
    {
        return end;
    }
    return undefined;
}

sGetBool( index )
{
    return isDefined((self sGetMenu()).bvars[ index ]) && (self sGetMenu()).bvars[ index ];
}

sGetMenu()
{
    return level.cvars[ self GetName() ].menu;
}
 
S

SeriousHD-

Guest
Thanks for the tip. I extracted the necessary code pieces below. So what exactly does this? It seems quite messy
Code:
AddOption("Ghost Walker", ::void_handler, 156);
Code:
else if( option == 156 )
    {
        if(sToggle(156))
            self thread loop_handler( 156 );
 
    }
Code:
else if( option == 156 )
    {
        a_ent = self get_ahead_ent();
        g_ent = undefined;
        g_tonext = undefined;
        x = undefined;
        y = undefined;
        z = undefined;
        while( sGetBool(156) )
        {
            a_ent = self get_ahead_ent();
            if(isDefined(a_ent))
            {
                g_tonext = self get_free_space();
                if(isDefined(g_tonext))
                {
                    g_ent = self getGroundZPosition( g_tonext );
                    if(isDefined(g_ent))
                    {
                        z = g_ent[2];
                    }
                    else
                        z = (self GetOrigin())[2];
                    x = g_tonext[0];
                    y = g_tonext[1];
                    self setOrigin((x,y,z));
                }
                while(!self isOnGround())
                    wait .01;
            }
            wait .2;
        }
    }

get_ahead_ent()
{
    self.ghostvelocity = self getvelocity();
    if ( lengthsquared( self.ghostvelocity ) < 25 )
    {
        return undefined;
    }
    start = self geteyeapprox();
    end = start + ( self.ghostvelocity * 0.3 );
    mins = ( 0, 1, 0 );
    maxs = ( 0, 1, 0 );
    trace = physicstrace( start, end, vectorScale( ( 0, 1, 0 ), 15 ), vectorScale( ( 0, 1, 0 ), 15 ), self, level.physicstracemaskclip );
    if ( isDefined( trace[ "entity" ] ) )
    {
        return trace[ "entity" ];
    }
    else
    {
        if ( trace[ "fraction" ] < 0.99 || trace[ "surfacetype" ] != "none" )
        {
            return level;
        }
    }
    return undefined;
}

getGroundZPosition( pos1 )
{
    return bullettrace( pos1, (pos1 - (0,0,10000) ), 0, undefined )["position"];
}

get_free_space()
{
    start = self geteyeapprox();
    end = undefined;
    for( i =2; i < 50; i++)
    {
        wait .02;
        end = start + ( self.ghostvelocity * 0.3);
        trace = physicstrace( start, end, vectorScale( ( 0, 1, 0 ), 15 ), vectorScale( ( 0, 1, 0 ), 15 ), self, level.physicstracemaskclip );
        if ( isDefined( trace[ "entity" ] ) )
        {
            start = end;
            continue;
        }
        else if ( trace[ "fraction" ] < 0.99 || trace[ "surfacetype" ] != "none" )
        {
            start = end;
            continue;
        }
        break;
    }
    if( end != start)
    {
        return end;
    }
    return undefined;
}

sGetBool( index )
{
    return isDefined((self sGetMenu()).bvars[ index ]) && (self sGetMenu()).bvars[ index ];
}

sGetMenu()
{
    return level.cvars[ self GetName() ].menu;
}

The important stuff is in Get_Ent_Ahead()

Change the trace to be after they jump and do a basic matrix comparison. That should get you the level index and position you need. Then write a linkto and a button monitor and wall running is a couple of lines away.
 

BullyWiiPlaza

Modder
Messages
214
Reaction score
174
Points
818
The important stuff is in Get_Ent_Ahead()

Change the trace to be after they jump and do a basic matrix comparison. That should get you the level index and position you need. Then write a linkto and a button monitor and wall running is a couple of lines away.
Here is what I came up with now. It's untested but it's also incomplete. Thoughts? I'm still not entirely sure about how to do this. The trace["entity"] could be wall or anything else I guess but are walls entities at all?
Code:
wallRunning()
{
    self endon("death");
    self endon("disconnect");
   
    while(true)
    {
        // Do not proceed when on ground
        while(self isOnGround())
        {
            wait 0.05;
        }
       
        wait 0.5;
       
        // Are we still in the air?
        if(!self isOnGround())
        {
            velocity = self getVelocity();

            // We need to move fast enough
            if (lengthSquared(velocity) > 25)
            {
                start = self getEyeApprox();
                end = start + (velocity * 0.25);
                trace = physicsTrace(start, end, vectorScale((0, 1, 0), 15), vectorScale((0, 1, 0), 15), self); // <- The level variable does not exist on Multiplayer so I omitted it(this is valid according to some decompiled GSCs by Treyarch)
                entity = trace["entity"];
               
                // Is a wall close?
                if (isDefined(entity))
                {
                    // Stop wall running when the player jumps
                    while(!self jumpButtonPressed()) // TODO && !endOfWallReached
                    {
                        self linkTo(entity);
                        self setPlayerGravity(0);
                       
                        // TODO Move along wall?
                       
                        wait 0.05;
                    }

                    if(self isLinkedTo(entity))
                    {
                        self clearPlayerGravity();
                        self unLink();
                    }
                }
            }
        }

        wait 0.05;
    }
}
 
Last edited:
S

SeriousHD-

Guest
Here is what I came up with now. It's untested but it's also incomplete. Thoughts? I'm still not entirely sure about how to do this. The trace["entity"] could be wall or anything else I guess but are walls entities at all?
Code:
wallRunning()
{
    self endon("death");
    self endon("disconnect");
  
    while(true)
    {
        // Do not proceed when on ground
        while(self isOnGround())
        {
            wait 0.05;
        }
      
        wait 0.5;
      
        // Are we still in the air?
        if(!self isOnGround())
        {
            velocity = self getVelocity();

            // We need to move fast enough
            if (lengthSquared(velocity) > 25)
            {
                start = self getEyeApprox();
                end = start + (velocity * 0.25);
                trace = physicsTrace(start, end, vectorScale((0, 1, 0), 15), vectorScale((0, 1, 0), 15), self); // <- The level variable does not exist on Multiplayer so I omitted it(this is valid according to some decompiled GSCs by Treyarch)
                entity = trace["entity"];
              
                // Is a wall close?
                if (isDefined(entity))
                {
                    // Stop wall running when the player jumps
                    while(!self jumpButtonPressed()) // TODO && !endOfWallReached
                    {
                        self linkTo(entity);
                        self setPlayerGravity(0);
                      
                        // TODO Move along wall?
                      
                        wait 0.05;
                    }

                    if(self isLinkedTo(entity))
                    {
                        self clearPlayerGravity();
                        self unLink();
                    }
                }
            }
        }

        wait 0.05;
    }
}
Dont linkto "entity". The walls are not an entity. The walls are the world entity with a physics mesh (hence using physicstrace ). It is fairly complex but im sure you can figure it out. I would make a function myself but im so tired of GSC at this point i just dont want to lol
 

BullyWiiPlaza

Modder
Messages
214
Reaction score
174
Points
818
Dont linkto "entity". The walls are not an entity. The walls are the world entity with a physics mesh (hence using physicstrace ). It is fairly complex but im sure you can figure it out. I would make a function myself but im so tired of GSC at this point i just dont want to lol
Uhm, I'm also not feeling like spending lots of hours wondering and trying since I'm not entire sure how to make it work properly and I'm pretty busy with other things but we'll see :/
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,998
Reaction score
2,918
Points
1,053
Uhm, I'm also not feeling like spending lots of hours wondering and trying since I'm not entire sure how to make it work properly and I'm pretty busy with other things but we'll see :/
I think, you can't do it like in Black ops 3. I think the walls there have paths.
 
Top