So I did it, changed some stuff but still no luck... This is the revised
function:
//This function takes care of holstering unused weapons, it should be run
by PostThink() function
void CHL2MP_Player::ManageHolsters()
{
int RHipTaken = -1;
int LHipTaken = -1;
int BackTaken = -1;
for ( int i = 0 ; i < WeaponCount(); i++ )
{
CBaseCombatWeapon* pWeapon = GetWeapon( i );
if ( pWeapon && pWeapon != GetActiveWeapon() ) //dont holster
active
weapon
{
if ( pWeapon->GetSlot() == 1 ) //hand pistol, holster
it on right hip
{
if( RHipTaken != -1 )
{
int attachment =
LookupBone("ValveBiped.Bip01_holster1");
if(attachment)
{
pWeapon->SetWeaponVisible( true
);
pWeapon->RemoveEffects(
EF_NODRAW );
pWeapon->SetParent( this,
attachment );
//HolsterWeapon( pWeapon,
attachment, 1 ); //holster the weapon
RHipTaken = i;
}
}
}
else if ( pWeapon->GetSlot() == 2 ) //blaster, holster
it on left hip
{
if( LHipTaken != -1 )
{
int attachment =
LookupBone("ValveBiped.Bip01_holster");
if(attachment)
{
pWeapon->SetWeaponVisible( true
);
pWeapon->RemoveEffects(
EF_NODRAW );
pWeapon->SetParent( this,
attachment );
//HolsterWeapon( pWeapon,
attachment, 1 ); //holster the weapon
LHipTaken = i;
}
}
}
else if ( pWeapon->GetSlot() == 3 ) //biiiiig gun,
holster it on back
{
if( BackTaken != -1 )
{
int attachment =
LookupBone("ValveBiped.Bip01_holster");
if(attachment)
{
pWeapon->SetWeaponVisible( true
);
pWeapon->RemoveEffects(
EF_NODRAW );
pWeapon->SetParent( this,
attachment );
//HolsterWeapon( pWeapon,
attachment, 1 ); //holster the weapon
BackTaken = i;
}
}
}
}
}
if( GetActiveWeapon() == GetWeapon( LHipTaken ) )
{//active weapon changed, remove the holster
LHipTaken = -1;
//HolsterWeapon( GetActiveWeapon(), 0, 0 ); //unholster the
weapon
}
else if( GetActiveWeapon() == GetWeapon( RHipTaken ) )
{//active weapon changed, remove the holster
RHipTaken = -1;
//HolsterWeapon( GetActiveWeapon(), 0, 0 ); //unholster the
weapon
}
else if( GetActiveWeapon() == GetWeapon( BackTaken ) )
{//active weapon changed, remove the holster
BackTaken = -1;
//HolsterWeapon( GetActiveWeapon(), 0, 0 ); //unholster the
weapon
}
}
--
[ Picked text/plain from multipart/alternative ]
When a weapon is holstered it is merely hidden, but it is still there
floating on the player. Just go into the base code and change that, make
the
weapon attach to a back bone or something and not hidden.
On 10/11/07, Emiel Regis <[EMAIL PROTECTED]> wrote:
Could you present me the relevant code?
> --
> [ Picked text/plain from multipart/alternative ]
> I personally did it in the weapons draw method, and included the name
of
> the
> attachment in the weapons script file. Then all it it does is when
the
> weapon is inactive it sets the models location to the appropriate
> attachment
> on the player.
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders