[Tutorial] Visible Secondary Weapon

Junior Spellweaver
Joined
Sep 28, 2013
Messages
121
Reaction score
14
This tutorial will help you to show your secondary on the character
i dont know how a title is good for this tutorial. Anyways,lets get started.

First,open "AI_PlayerAnim.cpp" and search for

Code:
void CUberEquip::DrawSlot(ESlot slotId, const D3DXMATRIX& world, DrawType dt, bool skin, bool draw_firstperson, const r3dSkeleton* wpnSkeleton){
    if(slotId == SLOT_WeaponSide)
        return;
    if(draw_firstperson)
    {
        if(slotId == SLOT_Armor || slotId == SLOT_LowerBody || slotId == SLOT_Head || slotId == SLOT_Helmet || slotId == SLOT_Backpack)
            return;
    }

and remove

Code:
if(slotId == SLOT_WeaponSide)
        return;

Now,its not done yet because its only for Melee's only. Now lets do it for ALL Secondary weapons.


We're still on AI_PlayerAnim.cpp.

Now,search for

Code:
 D3DXMATRIX world = getWeaponBone(skel, CharMat);
        if(!first_person)
        {
            if(slots_[SLOT_WeaponBackRight].wpn)
            {
                skel->GetBoneWorldTM("Weapon_BackRight", &world, CharMat);
                DrawSlot(SLOT_WeaponBackRight, world, dt, false, first_person, NULL);
            }
            if(slots_[SLOT_WeaponSide].wpn)
            {
                skel->GetBoneWorldTM("Weapon_Side", &world, CharMat);

And add this code,after you done adding Codes will be like that

Code:
        D3DXMATRIX world = getWeaponBone(skel, CharMat);
        if(!first_person)
        {
            if(slots_[SLOT_WeaponBackRight].wpn)
            {
                skel->GetBoneWorldTM("Weapon_BackRight", &world, CharMat);
                DrawSlot(SLOT_WeaponBackRight, world, dt, false, first_person, NULL);
            }
            if(slots_[SLOT_WeaponSide].wpn)
            {
                skel->GetBoneWorldTM("Weapon_Side", &world, CharMat);


                if(slots_[SLOT_WeaponSide].wpn->getCategory() == storecat_MELEE) {
                    D3DXMATRIX mr1;
                    D3DXMatrixRotationYawPitchRoll(&mr1, 0, R3D_PI/2 + 40, 30);
                    skel->GetBoneWorldTM("Weapon_Side", &world, CharMat);
                    world = mr1 * world;
                }


                DrawSlot(SLOT_WeaponSide, world, dt, false, first_person, NULL);
            }
        }


Guys, if there is any mistake please inform me because im not professional coder.

 
Note: One guy already do this and post in tutorials.

89SYb2u - [Tutorial] Visible Secondary Weapon - RaGEZONE Forums


hAVh3ID - [Tutorial] Visible Secondary Weapon - RaGEZONE Forums
 
Back