Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[TUTORIAL] Inspecting Gun In FirstPerson

Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
So seen this a couple of times, everyone wants this inspect weapon from cs:go.

Follow the tutorial below and you will be successful, however this tutorials only offer the outline for code only, I cannot supply the animation. I'm sure you can do some digging and find one. Make sure you place it inside Animation5 folder.

GetRektBambi - [TUTORIAL] Inspecting Gun In FirstPerson - RaGEZONE Forums
------------------


Ripped and Uploaded by AimZMMo

------------------

EclipseStudio/Sources/ObjectsCode/AI/AI_Player.CPP
Find:
Code:
if(wpn && hudAttm && hudAttm->isActive() && wpn->getCategory()>=storecat_ASR && wpn->getCategory()<=storecat_SMG)
         isInAttmMenu = true;
Add Below:
Code:
bool isWantingToInspect = (InputMappingMngr->isPressed(r3dInputMappingMngr::KS_INSPECT_GUN) && wpn && wpn->getCategory()>=storecat_ASR && wpn->getCategory()<=storecat_SMG && hudMain && !hudPause->isActive() && !hudAttm->isActive() && !hudVault->isActive() && !hudRepair->isActive() && !hudCraft->isActive() && !hudSafelock->isActive() && !hudTrade->isActive() && !hudStore->isActive() && !hudMain->isChatInputActive() && !Mouse->GetMouseVisibility() && !InputMappingMngr->isPressed(r3dInputMappingMngr::KS_PRIMARY_FIRE) && !InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM));

Find:
Code:
uberAnim_->SyncAnimation(PlayerState, PlayerMoveDir, force, wpn, isInAttmMenu);
Replace:

Code:
uberAnim_->SyncAnimation(PlayerState, PlayerMoveDir, force, wpn, isInAttmMenu, isWantingToInspect);

----------------

EclipseStudio/Sources/ObjectsCode/AI/AI_PlayerAnim.cpp
Find:
Code:
aid_.attmMenuIdleWeapon[5] = AddAnimation("FPS_Attch_Idle_SMG");
Add Below:
Code:
aid_.InspectWeapon[0] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //ASR
aid_.InspectWeapon[1] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //SNP
aid_.InspectWeapon[2] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //SHG
aid_.InspectWeapon[3] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //MG
aid_.InspectWeapon[4] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //HG
aid_.InspectWeapon[5] = AddAnimation("[COLOR=#ff0000]XXXXYOURANIMATIONNAMEHEREXXXX[/COLOR]"); //SMG

Find:
Code:
void CUberAnim::SyncAnimation(int PlayerState, int MoveDir, bool force, const Weapon* weap, bool isInAttmMenu)
Replace
Code:
void CUberAnim::SyncAnimation(int PlayerState, int MoveDir, bool force, const Weapon* weap, bool isInAttmMenu, bool isWantingToInspect)

Find:
Code:
if(isInAttmMenu && CurrentWeapon && IsFPSMode()
Replace:
Code:
if(!isWantingToInspect && isInAttmMenu && CurrentWeapon && IsFPSMode()

Find:
Code:
// switch anim state
Add Above:
Code:
///Inspect


    if(isWantingToInspect && CurrentWeapon && IsFPSMode()
        && !IsSwimming && PlayerState != PLAYER_SWIM_IDLE && PlayerState != PLAYER_SWIM_SLOW && PlayerState != PLAYER_SWIM && PlayerState != PLAYER_SWIM_FAST
        )
    {
        bool AlreadyPlayingInspect = false;


        int animIdx = 0;
        switch(CurrentWeapon->getCategory())
        {
        case storecat_ASR:
            animIdx = 0;
            break;
        case storecat_SNP:
            animIdx = 1;
            break;
        case storecat_SHTG:
            animIdx = 2;
            break;
        case storecat_MG:
            animIdx = 3;
            break;
        case storecat_HG:
            animIdx = 4;
            break;
        case storecat_SMG:
            animIdx = 5;
            break;
        default:
            r3d_assert(false);
            break;
        }


        r3dgameVector(r3dAnimation::r3dAnimInfo)::iterator it;
        for(it=anim.AnimTracks.begin(); it!=anim.AnimTracks.end(); ++it) 
        {
            const r3dAnimation::r3dAnimInfo& ai = *it;
            if(ai.pAnim->iAnimId == data_->aid_.InspectWeapon[animIdx])
            {
                AlreadyPlayingInspect = true;
                break;
            }
        }
        
        if(!AlreadyPlayingInspect)
            anim.StartAnimation(data_->aid_.InspectWeapon[animIdx], ANIMFLAG_RemoveOtherNow | ANIMFLAG_Looped, 0.0f, 1.0f, 0.1f);
        else // playing idle anim
        {
            // do nothing :)
        }


        AnimPlayerState = -1; // reset, so that after attm menu we will return back to proper animation
        return;
    }


    ///END of Inspect

-----------------

EclipseStudio/Sources/ObjectsCode/AI/AI_PlayerAnim.h
Find:
Code:
int        attmMenuIdleWeapon[6];
Add Below:
Code:
int        InspectWeapon[6];

Find:
Code:
void        SyncAnimation(int PlayerState, int MoveDir, bool force, const Weapon* weap, bool isInAttmMenu);
Replace:
Code:
void        SyncAnimation(int PlayerState, int MoveDir, bool force, const Weapon* weap, bool isInAttmMenu, bool isWantingToInspect = false);

-------------------

Eternity/Include/r3dInput.h

Find:
Code:
KS_NUM,
Add Above:
Code:
KS_INSPECT_GUN,

------------------

Eternity/Source/r3dInput.cpp
Inside: r3dInputMappingMngr::r3dInputMappingMngr() at the very bottom of the container
Add:
Code:
m_Mapping[KS_INSPECT_GUN] =                KeyboardMapping(INPUTMAP_KEYBOARD, kbsB, "INSPECT GUN", false);

------------------
Any problems here the pastebin of all changes made

How it works.. Hold "B" and it will play the inspect animation that you chose on a loop.

Give me credit where possible. Thanks

Enjoy!
Hit that
3j1uW4b - [TUTORIAL] Inspecting Gun In FirstPerson - RaGEZONE Forums
!!! ;)
 

Attachments

You must be registered for see attachments list
Last edited:
Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
Re: [TUTORIAL] Inpecting Gun In FirstPerson

In light of a small bug with Aiming and Firing

Tutorial has changed

Find:
Code:
bool isWantingToInspect = (InputMappingMngr->isPressed(r3dInputMappingMngr::KS_INSPECT_GUN) && wpn && wpn->getCategory()>=storecat_ASR && wpn->getCategory()<=storecat_SMG && hudMain && !hudPause->isActive() && !hudAttm->isActive() && !hudVault->isActive() && !hudRepair->isActive() && !hudCraft->isActive() && !hudSafelock->isActive() && !hudTrade->isActive() && !hudStore->isActive() && !hudMain->isChatInputActive() && !Mouse->GetMouseVisibility());

Replace:
Code:
bool isWantingToInspect = (InputMappingMngr->isPressed(r3dInputMappingMngr::KS_INSPECT_GUN) && wpn && wpn->getCategory()>=storecat_ASR && wpn->getCategory()<=storecat_SMG
        && hudMain && !hudPause->isActive() && !hudAttm->isActive() && !hudVault->isActive() && !hudRepair->isActive() && !hudCraft->isActive() && !hudSafelock->isActive()
        && !hudTrade->isActive() && !hudStore->isActive() && !hudMain->isChatInputActive() && !Mouse->GetMouseVisibility()
        && !InputMappingMngr->isPressed(r3dInputMappingMngr::KS_PRIMARY_FIRE) && !InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM));

Thanks AlexRedd for the report.
 
Experienced Elementalist
Joined
Oct 14, 2015
Messages
267
Reaction score
294
Re: [TUTORIAL] Inpecting Gun In FirstPerson

Help me please error

Are you kidding?

Please read the thread carefully before attempting a copy paste. Tutorials are a guidance and you should never just copy paste without reading.

I clearly stated " I cannot supply the animation. I'm sure you can do some digging and find one. Make sure you place it inside Animation5 folder"

I even marked in red where the file name should go once you retrieve this animation. That is your error.
 
☆Dying Dawn☆
Joined
Jan 30, 2012
Messages
971
Reaction score
727
nice release GetRektBambi I was looking for this a long time ago
 
Newbie Spellweaver
Joined
Jul 5, 2014
Messages
7
Reaction score
0
  • ("FPS_Inspect_ASR");
  • ("FPS_Inspect_SNP");
  • ("FPS_Inspect_SHG");
  • ("FPS_Inspect_MG");
  • ("FPS_Inspect_HG");
  • ("FPS_Inspect_SMG");
    I can find it from?
 
Junior Spellweaver
Joined
Feb 16, 2016
Messages
102
Reaction score
11
Where we have to write some code to add a new keybinding option ? to be able to change the key in game.
 
Junior Spellweaver
Joined
Feb 16, 2016
Messages
102
Reaction score
11
@VitorZaions , what should I read, read more my message, I know on this code B is binded to start inspection animation but we can't change it in game like other key like crouch sprint.
 
☆Dying Dawn☆
Joined
Jan 30, 2012
Messages
971
Reaction score
727
VitorZaions , what should I read, read more my message, I know on this code B is binded to start inspection animation but we can't change it in game like other key like crouch sprint.

Eternity/Source/r3dInput.cpp
Inside: r3dInputMappingMngr::r3dInputMappingMngr() at the very bottom of the container
Add:
Code:
m_Mapping[KS_INSPECT_GUN] =                KeyboardMapping(INPUTMAP_KEYBOARD, kbsB, "INSPECT GUN", false);

try to check how the vehicle bottoms in the frontend file works to get the change inspecting Gun in your option menu
 
Junior Spellweaver
Joined
Feb 16, 2016
Messages
102
Reaction score
11
@Bombillo , thanks, I was also looking for this, but I only found key for "Reset, Apply" or VOIP SENSIVITY line, not action button.


Nevermind, button fixed, just put the wrong name


Well the button appear on the option alone, maybe because I didnt saw it before or maybe because I change the name to a name linked to the langpack.

And ATM I'm trying to "improve" it.
 
Last edited:
Newbie Spellweaver
Joined
Aug 26, 2015
Messages
11
Reaction score
1
Upload file named XXXXYOURANIMATIONNAMEHEREXXXX.anm for me. The lack of this one single or graphite is due out soon.



No one can help me please Thai {I'm Thai.}.
 
Back
Top