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!

[Snippet] Change AIM Camera

☆Dying Dawn☆
Joined
Jan 30, 2012
Messages
971
Reaction score
727
Snippet to change the aim camera when wasPressed and wasReleased, basically when you're in TPS and you aim, the camera will change to FPS aim automatic and when you release the aim btn you will return to the TPS camera again i made this in a few mins, need more settings maybe when i get more time i will add the rest of the code like disable the switch fps to tps bottom / fix the back to TPS when you're in FPS mode



Lets look for this in AI_Player.cpp
bool oldAiming = m_isAiming;
if(g_toggle_aim->GetBool())
{
if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_AIM))
m_isAiming = !m_isAiming;
}
else
{
m_isAiming = InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM) || gamepadLeftTrigger > 0;
}

And replace for this simple code
bool oldAiming = m_isAiming;
if (InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_AIM))
{
if (g_camera_mode->GetInt() == 0)
{
switchFPS_TPS();
}
m_isAiming = !m_isAiming;
}
else if (InputMappingMngr->wasReleased(r3dInputMappingMngr::KS_AIM))
{
if (g_camera_mode->GetInt()==2)
{
switchFPS_TPS();
}
m_isAiming = InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM) || gamepadLeftTrigger > 0;
}
 
Last edited:
I can do it!, i guess...
Joined
May 14, 2014
Messages
758
Reaction score
770
thats preatty usefull and amazing, the only thing that could improve it.. is to add a new "ifs" or something that makes your aim "worse" if you are shooting "frim hip"

so like.. when you aim with the weapon, you get normal spread / acuracy, but while shooting but not aiming you get like -50% or even -75%, that would be actualy amazing ( i think and i hope )
 
Experienced Elementalist
Joined
Nov 1, 2014
Messages
237
Reaction score
117
I had been contemplating this myself..good job Bombillo..saved me a small headache...

 
Newbie Spellweaver
Joined
Aug 12, 2016
Messages
9
Reaction score
3
Fix problem aim from fps and function auto switch to tps

Code:
    int m_Cam2 = 0;
    if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_AIM))
    {
        if(g_camera_mode->GetInt() == 0)
        {
            m_Cam = 0;
            switchFPS_TPS();
        }
        else if ( g_camera_mode->GetInt() == 2)
        {
            m_Cam = 2;
        }
        m_isAiming = !m_isAiming;
    }
    else if (InputMappingMngr->wasReleased(r3dInputMappingMngr::KS_AIM))
    {
        if(g_camera_mode->GetInt() == 2 && m_Cam == m_Cam2)
        {
            switchFPS_TPS();
        }
        m_isAiming = InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM) || gamepadLeftTrigger > 0;
    }
And define
int m_Cam;

in AI_Player.h anywhere
 
Banned
Banned
Joined
Jan 25, 2014
Messages
126
Reaction score
12
Fix problem aim from fps and function auto switch to tps

Code:
    int m_Cam2 = 0;
    if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_AIM))
    {
        if(g_camera_mode->GetInt() == 0)
        {
            m_Cam = 0;
            switchFPS_TPS();
        }
        else if ( g_camera_mode->GetInt() == 2)
        {
            m_Cam = 2;
        }
        m_isAiming = !m_isAiming;
    }
    else if (InputMappingMngr->wasReleased(r3dInputMappingMngr::KS_AIM))
    {
        if(g_camera_mode->GetInt() == 2 && m_Cam == m_Cam2)
        {
            switchFPS_TPS();
        }
        m_isAiming = InputMappingMngr->isPressed(r3dInputMappingMngr::KS_AIM) || gamepadLeftTrigger > 0;
    }
And define
int m_Cam;

in AI_Player.h anywhere
thanks.
 
Last edited:
Back
Top