Creating simple pickup: Difference between revisions
Jump to navigation
Jump to search
(fixing code, posted wrong...) |
NikoDash2020 (talk | contribs) mNo edit summary |
||
Line 3: | Line 3: | ||
Version: Orange Box SDK. | Version: Orange Box SDK. | ||
------- | ------- | ||
Update: 2015-8-15 | |||
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject". | First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject". | ||
Line 15: | Line 16: | ||
</source> | </source> | ||
with | Note: For some reason this system has a bug and is the object that pulling the gun is fired so to fix this problem replaces the code above with this | ||
<source lang=cpp> | <source lang=cpp> | ||
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize ) | void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize ) | ||
Line 23: | Line 25: | ||
return; | return; | ||
BaseClass::PickupObject(pObject,bLimitMassAndSize); | BaseClass::PickupObject(pObject,bLimitMassAndSize); | ||
// Can't be picked up if NPCs are on me | // Can't be picked up if NPCs are on me | ||
if ( pObject->HasNPCsOnIt() ) | if ( pObject->HasNPCsOnIt() ) | ||
return; | return; | ||
HideViewModels(); | |||
ClearActiveWeapon(); | |||
Weapon_Switch( Weapon_OwnsThisType( "nameofyourweaponentitygotohere" ) ); | |||
PlayerPickupObject( this, pObject ); | |||
} | } | ||
</source> | </source> | ||
The | |||
Tanks For SecobMod Team For The Update Code | |||
[[Category:Programming]] | [[Category:Programming]] |
Revision as of 10:39, 15 August 2015
What: I will explain how you can add a simple pickup like you have in the singleplayer Version: Orange Box SDK.
Update: 2015-8-15
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject".
replace the function:
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize )
{
}
Note: For some reason this system has a bug and is the object that pulling the gun is fired so to fix this problem replaces the code above with this
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize )
{
// can't pick up what you're standing on
if ( GetGroundEntity() == pObject )
return;
BaseClass::PickupObject(pObject,bLimitMassAndSize);
// Can't be picked up if NPCs are on me
if ( pObject->HasNPCsOnIt() )
return;
HideViewModels();
ClearActiveWeapon();
Weapon_Switch( Weapon_OwnsThisType( "nameofyourweaponentitygotohere" ) );
PlayerPickupObject( this, pObject );
}
Tanks For SecobMod Team For The Update Code