Add this to your derived classes server side public:

    virtual int UpdateTransmitState()
    {
        return SetTransmitState( FL_EDICT_ALWAYS );
    }

It wont send updates unless you have some rules, this will always send when
a change is made.

On Wed, Feb 11, 2009 at 6:37 AM, Christopher Harris
<[email protected]>wrote:

> Hi,
>
> Also no entities send network updates automatically unless they have a
> model
> by default. It is easy to override this behavior.
>
> Chris
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Tony Sergi
> Sent: Wednesday, February 11, 2009 2:26 AM
> To: Discussion of Half-Life Programming
> Subject: Re: [hlcoders] CNetworkVar madness
>
> Make sure you have a LINK_ENTITY_TO_CLASS that links the entity properly on
> both the server and client, as well.
>
> server
> LINK_ENTITY_TO_CLASS( derivedentity, CDerivedClass );
>
> Client
> LINK_ENTITY_TO_CLASS( derivedentity, C_DerivedClass );
>
> -Tony
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Skyler Clark
> Sent: February-11-09 2:20 AM
> To: Discussion of Half-Life Programming
> Subject: Re: [hlcoders] CNetworkVar madness
>
> This is probably an obvious question, but it's always best to make
> sure obvious ones were considered...
>
> Are you sure the derived class is actually the one being instantiated
> (on both client and server)?
>
> -Skyler
>
>
> On Wed, Feb 11, 2009 at 12:58 AM, Josh Clark
> <[email protected]> wrote:
> >        Hi, all. I've been lurking here for a while, but something's
> recently
> > come up in my code that prompted me to post. I've looked through my
> entire
> > backlog of hlcoders messages (almost 3000 at this point), searched the
> SDK
> > wiki and the Steam Forums, and even did a brief google for this, and
> still
> > I haven't found anything close to an answer.
> >
> >        In my mod, I've got a base class, something like:
> >
> > // --- server ---
> >
> > class CBaseClass : public CBaseEntity
> > {
> > public:
> >        DECLARE_CLASS( CBaseClass, CBaseEntity );
> >        DECLARE_SERVERCLASS();
> >
> > private:
> >        CNetworkVar( int, m_index );
> > };
> >
> > IMPLEMENT_SERVERCLASS_ST( CBaseClass, DT_BaseClass )
> >        SendPropInt( SENDINFO( m_index ), 10, SPROP_UNSIGNED ),
> > END_SEND_TABLE()
> >
> > // --- client ---
> >
> > class C_BaseClass : public C_BaseEntity
> > {
> > public:
> >        DECLARE_CLASS( C_BaseClass, C_BaseEntity );
> >        DECLARE_CLIENTCLASS();
> >
> >        int m_index;  // couldn't get this to work under private:
> > };
> >
> > IMPLEMENT_CLIENTCLASS_DT( C_BaseClass, DT_BaseClass, CBaseClass )
> >        RecvPropInt( RECVINFO( m_index ) ),
> > END_RECV_TABLE()
> >
> >        So far, so good, right? Follows the wiki, Valve's code, etc.
> Compiles
> > with no errors. Load up the mod, and it works as expected.
> >
> >        Now, here's the fun part. If I derive a class from my base class,
> like so:
> >
> > // --- server ---
> >
> > class CDerivedClass : public CBaseClass
> > {
> > public:
> >        DECLARE_CLASS( CDerivedClass, CBaseClass );
> >        DECLARE_SERVERCLASS();
> >
> > private:
> >        CNetworkVar( int, m_something );
> > };
> >
> > IMPLEMENT_SERVERCLASS_ST( CDerivedClass, DT_DerivedClass )
> >        SendPropInt( SENDINFO( m_something ), 10, SPROP_UNSIGNED ),
> > END_SEND_TABLE()
> >
> > // --- client ---
> >
> > class C_DerivedClass : public C_BaseClass
> > {
> > public:
> >        DECLARE_CLASS( C_DerivedClass, C_BaseClass );
> >        DECLARE_CLIENTCLASS();
> >
> >        int m_something;
> > };
> >
> > IMPLEMENT_CLIENTCLASS_DT( C_DerivedClass, DT_DerivedClass, CDerivedClass
> )
> >        RecvPropInt( RECVINFO( m_something ) ),
> > END_RECV_TABLE()
> >
> >        ...the code compiles and runs just fine, but the client side of
> the
> > derived class *never* gets any updates when m_something is set. What
> blows
> > my mind is that I can cut and paste the code into the base class, and it
> > will behave exactly as it should. What the heck is going on here? There's
> > no indication that I can find in Valve's code or the wiki that I'm doing
> > anything wrong, or that more/different code is needed. Someone mentioned
> > CNetworkVarForDerived, but that doesn't seem to be the ideal solution,
> > since you're still declaring a variable in the base class, and I want
> > completely unique variables in some of the derived classes.
> >
> >        Any thoughts/suggestions? I'm at my wits' end here...
> >
> >
> > _______________________________________________
> > 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
>
>
> _______________________________________________
> 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
>
>


-- 
~Ryan ( skidz )
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to