[HELP]Red hitmarker when headshot!?

Results 1 to 13 of 13
  1. #1
    Apprentice hawkingsamcro is offline
    MemberRank
    Nov 2015 Join Date
    In your mindLocation
    23Posts

    shout [HELP]Red hitmarker when headshot!?

    Hello guys, im trying to do this, but never works.

    I already try to do a simple code, like you can see below
    Code:
    if(boneId_Bip01_Head) 
            {                
            m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/headshot.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
            r3d_assert(m_HitMarkerTex != NULL);        
        }        
        else       
         {           
             m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/normal.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
                    r3d_assert(m_HitMarkerTex != NULL);
            }
    But only loads the red hitmarker.

    I also tried to change where to place the code, change to
    Code:
    void obj_Player::ApplyDamage(const r3dPoint3D& dmgPos, float damage, GameObject* fromObj, int bodyBone, int dmgType)

    And put this code. (in this void). (i think you also see which what i based to make this)
    Code:
    if (fromObj == gClientLogic().localPlayer_)   
                 {
                    if(bodyBone == uberAnim_->GetBoneID("Bip01_Head"))
                    {
                            m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/headshot.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
                            r3d_assert(m_HitMarkerTex != NULL);
                    }
                    else
                    {
                            m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/normal.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
                            r3d_assert(m_HitMarkerTex != NULL);
                    }
              }
    And, with the "same" code i already try this
    Code:
                   // look for player                
    if (fromObj == gClientLogic().localPlayer_)
            {
                    // call player head
                    if(bodyBone == boneId_Bip01_Head)
                    {
                            // show headshot hitmarker
                            m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/headshot.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
                            r3d_assert(m_HitMarkerTex != NULL);
                    }
                    else
                    {
                            // if not headshot, use normal hitmarker
                            m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/normal.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
                            r3d_assert(m_HitMarkerTex != NULL);
                    }
            }

    In the last 2 codes always appears white hitmaker even headshot.
    If anyone can help me.
    Thanks


  2. #2
    Make WarZ great again! Nikita505 is offline
    MemberRank
    Mar 2014 Join Date
    Mountain ViewLocation
    223Posts

    Re: [HELP]Red hitmarker when headshot!?

    dunno maybe it's not correct, but try this:


    if(boneId_Bip01_Head){
    m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/headshot.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerTex != NULL);
    }

    else
    {
    if(!=boneId_Bip01_Head) {
    m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/normal.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerTex != NULL);
    }
    }

  3. #3
    failed in javascript ItzFdr is offline
    MemberRank
    May 2013 Join Date
    BrasilLocation
    293Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by Nikita505 View Post
    dunno maybe it's not correct, but try this:
    Just a better example, it's obvious that if you put else after if, you don't have to repeat the condition.

    Code:
    if(BodyHit == boneId_Bip01_Head)
    { 
        m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/headshot.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
        r3d_assert(m_HitMarkerTex != NULL); 
    }
    else 
    { 
        m_HitMarkerTex = r3dRenderer->LoadTexture("data/hitmarkers/normal.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
        r3d_assert(m_HitMarkerTex != NULL);
    }
    Anyways, i was looking at eclipse source, and i found it, maybe here you have to do it.

    Code:
    if(m_HitMarkerFadeout>0)
    {
    	float rw = (float)m_HitMarkerTex->GetWidth();
    	float rh = (float)m_HitMarkerTex->GetHeight();
    	r3dColor clr = r3dColor::white; clr.A = BYTE(m_HitMarkerFadeout*255.0f);
    	if(m_isInScope)
            {
    		r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
            }
    	else
    	{
    		float yy = g_camera_mode->GetInt() == 1?cy2:cy;
    		r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    	}
    }

  4. #4
    Apprentice hawkingsamcro is offline
    MemberRank
    Nov 2015 Join Date
    In your mindLocation
    23Posts

    Re: [HELP]Red hitmarker when headshot!?

    fdr.
    I try make a simple code (I'm not a programmer, i know the very basics.)
    But only loads the red hitmarker.
    Code:
    if(m_HitMarkerFadeout>0)
    {
    	float rw = (float)m_HitMarkerTex->GetWidth();
    	float rh = (float)m_HitMarkerTex->GetHeight();
    	r3dColor clr = r3dColor::white; clr.A = BYTE(m_HitMarkerFadeout*255.0f);
    	if(m_isInScope)
            {
    		r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
            }
    	else if(uberAnim_->GetBoneID("Bip01_Head"))
    	{
    		r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::red, m_HitMarkerTex);
    	}	
    	else
    	{
    		float yy = g_camera_mode->GetInt() == 1?cy2:cy;
    		r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    	}

  5. #5
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: [HELP]Red hitmarker when headshot!?

    If you have not solved this.. I will tell you quickly how I would approach this.

    AI_Player.H
    Search
    // hit marker
    float m_HitMarkerFadeout;
    r3dTexture* m_HitMarkerTex; // only for local player
    Replace
    // hit marker
    float m_HitMarkerFadeout;
    int m_HitMarkerType;
    r3dTexture* m_HitMarkerTex; // only for local player
    r3dTexture* m_HitMarkerHeadTex; // only for local player
    AI_Player.CPP
    Load()

    Search
    m_HitMarkerFadeout = 0;
    m_HitMarkerTex = NULL;
    Replace
    m_HitMarkerFadeout = 0;
    m_HitMarkerType = 0;
    m_HitMarkerTex = NULL;
    m_HitMarkerHeadTex = NULL;
    OnCreate()
    Search
    m_HitMarkerTex = r3dRenderer->LoadTexture("data/weapons/hitmarker.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerTex != NULL);
    Add Under
    m_HitMarkerHeadTex = r3dRenderer->LoadTexture("data/weapons/hitmarkerhead.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerHeadTex != NULL);
    ResPawnFast()
    Search
    m_HitMarkerTex = r3dRenderer->LoadTexture("data/weapons/hitmarker.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerTex != NULL);
    Add Under
    m_HitMarkerHeadTex = r3dRenderer->LoadTexture("data/weapons/hitmarkerhead.dds", D3DFMT_UNKNOWN, false, 1, 0, D3DPOOL_MANAGED, PlayerTexMem );
    r3d_assert(m_HitMarkerHeadTex != NULL);


    ProcessBulletHit()
    Search
    if(!trgt->bDead && ownerPlayer) {
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }
    Replace
    Quote Originally Posted by italofialho View Post
    if(!trgt->bDead && ownerPlayer)
    {
    ownerPlayer->m_HitMarkerType = (trgt->uberAnim_->GetBoneID(hitActorName)== trgt->uberAnim_->GetBoneID("Bip01_Head") ? 1 : 0);
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }
    DrawReticle()
    Search
    if(m_HitMarkerFadeout>0) {
    float rw = (float)m_HitMarkerTex->GetWidth();
    float rh = (float)m_HitMarkerTex->GetHeight();
    r3dColor clr = r3dColor::white; clr.A = BYTE(m_HitMarkerFadeout*255.0f);
    if(m_isInScope)
    r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    else
    {
    float yy = g_camera_mode->GetInt() == 1?cy2:cy;
    r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    }
    }
    Replace
    if(m_HitMarkerFadeout>0) {
    if(m_HitMarkerType == 0) {
    float rw = (float)m_HitMarkerTex->GetWidth();
    float rh = (float)m_HitMarkerTex->GetHeight();
    r3dColor clr = r3dColor::white; clr.A = BYTE(m_HitMarkerFadeout*255.0f);
    if(m_isInScope)
    r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    else
    {
    float yy = g_camera_mode->GetInt() == 1?cy2:cy;
    r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerTex);
    }
    } else {
    float rw = (float)m_HitMarkerHeadTex->GetWidth();
    float rh = (float)m_HitMarkerHeadTex->GetHeight();
    r3dColor clr = r3dColor::white; clr.A = BYTE(m_HitMarkerFadeout*255.0f);
    if(m_isInScope)
    r3dDrawBox2D(float(cx-(rw/2)), float(cy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerHeadTex);
    else
    {
    float yy = g_camera_mode->GetInt() == 1?cy2:cy;
    r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, m_HitMarkerHeadTex);
    }
    }
    }

    Haven't compiled and tested, but this should work fine. You can even use this to add even more types for example, no damage hitmarker for over distance for damage, or even add a penis shot you will need to add "Bip01_Pelvis" to your UberAnim data.
    Last edited by GetRektBambi; 11-12-15 at 10:57 AM.

  6. #6
    Apprentice hawkingsamcro is offline
    MemberRank
    Nov 2015 Join Date
    In your mindLocation
    23Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by GetRektBambi View Post
    If you have not solved this.. I will tell you quickly how I would approach this.

    AI_Player.H
    Search

    Replace


    AI_Player.CPP
    Load()

    Search

    Replace


    OnCreate()
    Search

    Add Under


    ResPawnFast()
    Search

    Add Under




    ProcessBulletHit()
    Search

    Replace


    DrawReticle()
    Search

    Replace



    Haven't compiled and tested, but this should work fine. You can even use this to add even more types for example, no damage hitmarker for over distance for damage, or even add a penis shot you will need to add "Bip01_Pelvis" to your UberAnim data.

    Thanks u, i'll test this, but i think that works fine!
    BTW, i send a private message for you.
    Thanks alot for the help.

  7. #7
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by hawkingsamcro View Post
    Thanks u, i'll test this, but i think that works fine!
    BTW, i send a private message for you.
    Thanks alot for the help.
    Let me know if the above works :)

    Remember you will need to make a red hitmarker file
    data/weapons/hitmarkerhead.dds
    You can do this by opening the original bring down the brightness a tad and use colorize, re-save as hitmarkerhead DDS (DXT5)


    And replied to your pm.

  8. #8
    Apprentice hawkingsamcro is offline
    MemberRank
    Nov 2015 Join Date
    In your mindLocation
    23Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by GetRektBambi View Post
    Let me know if the above works :)

    Remember you will need to make a red hitmarker file

    You can do this by opening the original bring down the brightness a tad and use colorize, re-save as hitmarkerhead DDS (DXT5)


    And replied to your pm.

    Yes i already did this.
    But other think, you ask to change the
    Code:
    if(!trgt->bDead && ownerPlayer) {
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }
    
    to

    Code:
    if(!trgt->bDead && ownerPlayer) {
    ownerPlayer->m_HitMarkerType = (trgt->uberAnim_->GetBoneID(hitActorName)==boneId_Bip01_Head?1:0);
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }
    
    Appears an error. "boneId_Bip01_Head" is not declared.

    I change your code to
    Code:
    if(!trgt->bDead && ownerPlayer)
    			{
    				ownerPlayer->m_HitMarkerType = (trgt->uberAnim_->GetBoneID("Bip01_Head")?1:0);
    				ownerPlayer->m_HitMarkerFadeout = 1.0f;
    			}
    Maybe don't work, i think, with my change.






  9. #9
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: [HELP]Red hitmarker when headshot!?

    Ok will take a look when I get home :)

  10. #10
    Enthusiast italofialho is offline
    MemberRank
    Apr 2014 Join Date
    40Posts

    Re: [HELP]Red hitmarker when headshot!?

    The correct way and 100% functional
    Change this:
    if(!trgt->bDead && ownerPlayer) {
    ownerPlayer->m_HitMarkerType = (trgt->uberAnim_->GetBoneID(hitActorName)==boneId_Bip01_Head?1:0);
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }
    Change so:
    if(!trgt->bDead && ownerPlayer)
    {
    ownerPlayer->m_HitMarkerType = (trgt->uberAnim_->GetBoneID(hitActorName)== trgt->uberAnim_->GetBoneID("Bip01_Head") ? 1 : 0);
    ownerPlayer->m_HitMarkerFadeout = 1.0f;
    }

  11. #11
    Apprentice hawkingsamcro is offline
    MemberRank
    Nov 2015 Join Date
    In your mindLocation
    23Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by italofialho View Post
    The correct way and 100% functional
    Change this:

    Change so:
    Yes, that's right, already tested and working 100%.

  12. #12
    Account Upgraded | Title Enabled! Returnerzx is offline
    MemberRank
    Apr 2011 Join Date
    236Posts

    Re: [HELP]Red hitmarker when headshot!?

    What is This ?

  13. #13
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: [HELP]Red hitmarker when headshot!?

    Quote Originally Posted by Returnerzx View Post
    What is This ?
    When you shoot a player you currently only get a white cross "hitmarker"

    This thread will teach you how to have a white cross "hitmarker" for all hits and show a red for headshots.



Advertisement