Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
20.07.2007, 20:48
Music.x



Hätte jemand eine Ahnung wie man das genau umsetzen könnte?
Ich habe mir das script des crowbars angeguckt, weil es vom prinzip ja auch einen Körper an eine Wandpinnt.
Aber ich will ja das der spieler sich selbst an die wand pinnt und dabei noch lebt.
Leider gibt es nirgendswo eine gute Tutorial seite oder coder forum für halflife 2.
Das beliebte hl2coding.com ist leider tot oder gehackt worden und das seit februar :(

Bitte um hilfestellung oder tipp für das gesuchte von mir.

--

zum Seitenanfang zum Seitenende Profil || Suche
001
21.07.2007, 11:31
Music.x



ich meinte des crossbows...nicht crowbar.
Vom prinzip müsste man den Spieler also movement_player in movement_ragdoll ändern und dann das prinzip vom crossbow benutzen, aber ich wüsste jetzt nicht genau wie ich das anstellen sollte.

--

zum Seitenanfang zum Seitenende Profil || Suche
002
24.07.2007, 01:53
Music.x



niemand?

Ich müsste nur hier etwas dran ändern.
Also der Spieler klebt an der Wand, sobald er Springen drückt.
Drückt er nochmal springen, klebt er nicht mehr an der Wand.

Quellcode:bool CSDKGameMovement::CheckJumpButton()
{
    if (player->pl.deadflag) // is the player dead?
    {
        mv->m_nOldButtons |= IN_JUMP ;   // don't jump again until released
        return false;
    }

    // See if we are waterjumping.  If so, decrement count and return.
    if (player->m_flWaterJumpTime)
    {
        player->m_flWaterJumpTime -= gpGlobals->frametime;
        if (player->m_flWaterJumpTime < 0)
            player->m_flWaterJumpTime = 0;

        return false;
    }

    // If we are in the water most of the way...
    if ( player->GetWaterLevel() >= 2 )
    {  
        // swimming, not jumping
        SetGroundEntity( (CBaseEntity *)NULL );

        if(player->GetWaterType() == CONTENTS_WATER)    // We move up a certain amount
            mv->m_vecVelocity[2] = 100;
        else if (player->GetWaterType() == CONTENTS_SLIME)
            mv->m_vecVelocity[2] = 80;

        // play swiming sound
        if ( player->m_flSwimSoundTime <= 0 )
        {
            // Don't play sound again for 1 second
            player->m_flSwimSoundTime = 1000;
            PlaySwimSound();
        }

        return false;
    }

    // Don't allow jumping when the player is in a stasis field.
    if ( player->m_Local.m_bSlowMovement )
        return false;

    if ( mv->m_nOldButtons & IN_JUMP )
        return false;       // don't pogo stick

    // Cannot jump will in the unduck transition.
    if ( player->m_Local.m_bDucking && (  player->GetFlags() & FL_DUCKING ) )
        return false;

    // Still updating the eye position.
    if ( player->m_Local.m_flDuckJumpTime > 0.0f )
        return false;

    float startz = 0.0f;
    float starty = 0.0f;
    float startx = 0.0f;

    float flMul;

    // This controls how high you jump
    if ( g_bMovementOptimizations )
    {
        Assert( sv_gravity.GetFloat() == 800.0f );
        flMul = 268.3281572999747f;
    }
    else
    {
        flMul = sqrt(2 * sv_gravity.GetFloat() * GAMEMOVEMENT_JUMP_HEIGHT); // 183.303028
    }

    // If we are not on the ground....
    if (player->GetGroundEntity() == NULL)
    {
        int i = 0;
        Vector EndPoint;
        trace_t tr;

        EndPoint[2] = player->GetAbsOrigin()[2];    // set the z value of the trace endpoint to the player z value

        // Store the original velocity
        startx = mv->m_vecVelocity[0];
        starty = mv->m_vecVelocity[1];
        startz = mv->m_vecVelocity[2];

        if( mv->m_nButtons & IN_MOVERIGHT )
        {
            // setup the trace end point as 24 units to the left of the player
            for(i = 0; i < 2; i++)
                EndPoint[i] = player->GetAbsOrigin()[i] + m_vecRight[i] * -24.0f;

            UTIL_TraceLine( player->GetAbsOrigin(), EndPoint, MASK_SOLID_BRUSHONLY, NULL, COLLISION_GROUP_NONE, &tr);
          
            if( tr.fraction < 1.0 )  // if there was a wall
            {
                for(i = 0; i < 2; i++)
                    mv->m_vecVelocity[i] = m_vecRight[i] * 275 * 1.1;

                mv->m_vecVelocity[2] += flMul;    // Jump!
            }
            else
            {
                // no wall found, do nothing
                mv->m_nOldButtons |= IN_JUMP;
                return false;
            }
        }
        else if( mv->m_nButtons & IN_MOVELEFT )
        {
            for(i = 0; i < 2; i++)  // setup the trace end point as 24 units to the right of the player
                EndPoint[i] = player->GetAbsOrigin()[i] + m_vecRight[i] * 24.0f;

            UTIL_TraceLine( player->GetAbsOrigin(), EndPoint, MASK_SOLID_BRUSHONLY, NULL, COLLISION_GROUP_NONE, &tr);

            if( tr.fraction < 1.0 )  // if there was a wall
            {
                for(i = 0; i < 2; i++)
                    mv->m_vecVelocity[i] = m_vecRight[i] * -275 * 1.1;

                mv->m_vecVelocity[2] += flMul;    // Jump!
            }
            else
            {
                // No wall found, do nothing
                mv->m_nOldButtons |= IN_JUMP;
                return false;
            }
        }
    }
    else   // We are on the ground, so jump normally
    {
        // In the air now.
        SetGroundEntity( (CBaseEntity *)NULL );

        player->PlayStepSound( mv->m_vecAbsOrigin, m_pSurfaceData, 1.0, true );

        MoveHelper()->PlayerSetAnimation( PLAYER_JUMP );

        float flGroundFactor = 1.0f;

        if (m_pSurfaceData)
        {
            flGroundFactor = m_pSurfaceData->game.jumpFactor;
        }

        // Acclerate upward
        // If we are ducking...
        startz = mv->m_vecVelocity[2];
        if ( (  player->m_Local.m_bDucking ) || (  player->GetFlags() & FL_DUCKING ) )
        {
            mv->m_vecVelocity[2] = flGroundFactor * flMul;
        }
        else
        {
            mv->m_vecVelocity[2] += flGroundFactor * flMul;
        }
    }

    FinishGravity();

    // I'm really not sure what these affect
    mv->m_outJumpVel.x += mv->m_vecVelocity[0] - startx;
    mv->m_outJumpVel.y += mv->m_vecVelocity[1] - starty;
    mv->m_outJumpVel.z += mv->m_vecVelocity[2] - startz;

    mv->m_outStepHeight += 0.15f;

    // Set jump time.
    if ( gpGlobals->maxClients == 1 )
    {
        player->m_Local.m_flJumpTime = GAMEMOVEMENT_JUMP_TIME;
        player->m_Local.m_bInDuckJump = true;
    }

    // Flag that we jumped.
    mv->m_nOldButtons |= IN_JUMP;    // don't jump again until released
    return true;
}

geänderter Part:
Quellcode:// setup the trace end point as 24 units to the left of the player
for(i = 0; i < 2; i++)
EndPoint[i] = player->GetAbsOrigin()[i] + m_vecRight[i] * -24.0f;

UTIL_TraceLine( player->GetAbsOrigin(), EndPoint, MASK_SOLID_BRUSHONLY, NULL, COLLISION_GROUP_NONE, &tr);

if( tr.fraction < 1.0 ) // if there was a wall
{
for(i = 0; i < 2; i++)
mv->m_vecVelocity[i] = m_vecRight[i] * 275 * 1.1; // mv->m_vecVelocity[2] += flMul; // Jump!
}
else
{
// no wall found, do nothing
mv->m_nOldButtons |= IN_JUMP;
return false;
}
}
else if( mv->m_nButtons & IN_JUMP)
{
for(i = 0; i < 2; i++) // setup the trace end point as 24 units to the right of the player
EndPoint[i] = player->GetAbsOrigin()[i] + m_vecRight[i] * 24.0f;

UTIL_TraceLine( player->GetAbsOrigin(), EndPoint, MASK_SOLID_BRUSHONLY, NULL, COLLISION_GROUP_NONE, &tr);

if( tr.fraction < 1.0 ) // if there was a wall
{
for(i = 0; i < 2; i++)
mv->m_vecVelocity[i] = m_vecRight[i] * -275 * 1.1;

mv->m_vecVelocity[2] += flMul; // Jump!
}
else
{
// No wall found, do nothing
mv->m_nOldButtons |= IN_JUMP;
return false;
}
}
}

--


Dieser Beitrag wurde am 24.07.2007 um 02:12 von Music.x bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche