AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   LongJump Sound (https://forums.alliedmods.net/showthread.php?t=162831)

GordonFreeman (RU) 07-23-2011 11:52

LongJump Sound
 
5 Attachment(s)
http://gf.hldm.org/wp-content/upload...2/lj_sound.jpg

Plugin make 'Sound' when player doing longjump, like in Opposing Force

If you have Opposing Force, just copy pow_big_jump.wav from gearbox/sound/ctf to valve/sound/misc
If not, download and copy that wav to valve/sound/misc

bibu 07-23-2011 12:23

Re: LongJump Sound
 
Check if entity is on ground. Should fix the problem.

ANTICHRISTUS 07-23-2011 17:27

Re: LongJump Sound
 
a longjump plugin, and from Gordon Freeman himself. that's awesome :D !!

but, just a question, should it work in counter-strike ? cause there is a longjump module in some maps, and in CSDM too.

regards.

GordonFreeman (RU) 07-24-2011 11:09

Re: LongJump Sound
 
Quote:

Originally Posted by bibu (Post 1516818)
Check if entity is on ground. Should fix the problem.

I don't know how make check of ES_OnGround

Bug fixed, finnaly :)
I used player's model's frame. And it work!
Fakemeta has very interesting functions.

PS: Play with p_longjump.amxx plugin ;)

Quote:

Originally Posted by ANTICHRISTUS
should it work in counter-strike ?

It will be work if you replace 9 to 7 in code. (seq==7&&frame==0)
LongJump sequence in HL is 9, in CS is 7 :D

bibu 07-24-2011 11:21

Re: LongJump Sound
 
Quote:

Originally Posted by GordonFreeman (RU) (Post 1517431)
It will be work if you replace 9 to 7 in code. (seq==7&&frame==0)
LongJump sequence in HL is 9, in CS is 7 :D

Check the game and do it. :)

ANTICHRISTUS 07-24-2011 18:41

Re: LongJump Sound
 
Quote:

Originally Posted by GordonFreeman (RU)
It will be work if you replace 9 to 7 in code. (seq==7&&frame==0)
LongJump sequence in HL is 9, in CS is 7 :D

tested in CSDM 2.1.2k, the sound isn't working :(

KORD_12.7 07-24-2011 19:22

Re: LongJump Sound
 
GordonFreeman (RU), GJ.

Can you make a plugin to remove longjump sound from Opposing Force? :D

ConnorMcLeod 07-26-2011 00:49

Re: LongJump Sound
 
I think that proper way is to hook Ham_Player_Jump as post and there check if m_IdealActivity (or m_Activity) is equal to ACT_LEAP and frame (or gaitsequence) is equal to 0.

From HLSDK :
Code:

void CBasePlayer::Jump()
{
        Vector                vecWallCheckDir;// direction we're tracing a line to find a wall when walljumping
        Vector                vecAdjustedVelocity;
        Vector                vecSpot;
        TraceResult        tr;
       
        if (FBitSet(pev->flags, FL_WATERJUMP))
                return;
       
        if (pev->waterlevel >= 2)
        {
                return;
        }

        // jump velocity is sqrt( height * gravity * 2)

        // If this isn't the first frame pressing the jump button, break out.
        if ( !FBitSet( m_afButtonPressed, IN_JUMP ) )
                return;        // don't pogo stick

        if ( !(pev->flags & FL_ONGROUND) || !pev->groundentity )
        {
                return;
        }

// many features in this function use v_forward, so makevectors now.
        UTIL_MakeVectors (pev->angles);

        // ClearBits(pev->flags, FL_ONGROUND);                // don't stairwalk
       
        SetAnimation( PLAYER_JUMP );

        if ( m_fLongJump &&
                (pev->button & IN_DUCK) &&
                ( pev->flDuckTime > 0 ) &&
                pev->velocity.Length() > 50 )
        {
                SetAnimation( PLAYER_SUPERJUMP );
        }

        // If you're standing on a conveyor, add it's velocity to yours (for momentum)
        entvars_t *pevGround = VARS(pev->groundentity);
        if ( pevGround && (pevGround->flags & FL_CONVEYOR) )
        {
                pev->velocity = pev->velocity + pev->basevelocity;
        }
}

Code:

// Set the activity based on an event or current state
void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
{
        /* [ ... ] */

        switch (m_IdealActivity)
        {
        case ACT_HOVER:
        case ACT_LEAP:
        case ACT_SWIM:
        case ACT_HOP:
        case ACT_DIESIMPLE:
        default:
                if ( m_Activity == m_IdealActivity)
                        return;
                m_Activity = m_IdealActivity;

                animDesired = LookupActivity( m_Activity );
                // Already using the desired animation?
                if (pev->sequence == animDesired)
                        return;

                pev->gaitsequence = 0;
                pev->sequence                = animDesired;
                pev->frame                        = 0;
                ResetSequenceInfo( );
                return;


So in Jump hook post, you come right after SetAnimation( PLAYER_SUPERJUMP ).

GordonFreeman (RU) 07-30-2011 01:50

Re: LongJump Sound
 
Done.
Thanks for KORD for offsets

ConnorMcLeod 07-30-2011 04:55

Re: LongJump Sound
 
Quote:

Originally Posted by GordonFreeman (RU) (Post 1521555)
Done.
Thanks for KORD for offsets

You forgot to POST hook Ham_Player_Jump.
Also, you don't need to create act and frame vars because you only use their value once.
You should name offset and sequence for readability (const or define).

So, works the way i suggested ?


All times are GMT -4. The time now is 22:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.