--
[ Picked text/plain from multipart/alternative ]
Alright, I have tested this and it works, Simply, in sdk_player.h (if you
did create mod from scratch) or hl2_player.h (if you did modify half-life 2)
or hl2mp_player.h (if you did modify half-life 2 Deathmatch) you need to add
the following:

#define BOX_MODEL_NAME  "models/props/barrelLid.mdl"
//
--------------------------------------------------------------------------------
//
//
--------------------------------------------------------------------------------
//
class CBox : public CBaseProp
{
public:
    public:
    DECLARE_CLASS( CBox, CBaseProp );
    typedef CBaseProp BaseClass;

    CBox();

    //bool    CreateVPhysics( void );
    void    Spawn( void );

    virtual void Precache();

    DECLARE_DATADESC();
};

 Then somewhere under class CSDKPlayer (or CHL2Player, or CHL2MPPlayer) add

CBox *pBox; // This makes it a global variable so you can call it in both
the InitialSpawn, and on death.

In sdk_player.cpp (or hl2_player.cpp or hl2mp_player.cpp) add the following
somewhere near the top.

BEGIN_DATADESC( CBox )

END_DATADESC()

LINK_ENTITY_TO_CLASS( box, CBox );


void CBox::Precache()
{
    SetModel( BOX_MODEL_NAME );
    BaseClass::Precache();
}

CBox::CBox()
{
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBox::Spawn( void )
{

    Precache();
    SetModelName( MAKE_STRING( BOX_MODEL_NAME ) );

}


Then find the InitialSpawn() function and add the following:

pBox = CREATE_ENTITY( CBox, "box" );

    Vector origin = GetAbsOrigin();
    origin.z += 65; //Spawn above player, can be tweaked

    pBox->SetAbsOrigin(origin);
    pBox->SetAbsAngles(GetAbsAngles());
    pBox->Spawn();
    pBox->SetParent(this);


Then, goto the Event_Killed( const CTakeDamageInfo &info )

and add UTIL_Remove(pBox);


That should be it, hope this helped.
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to