To follow up:

I used this to fix it:

void CParticleEmitter::Spawn( void )
{
        Precache();
}

void CParticleEmitter::Precache( void )
{
        m_usStartParticle = PRECACHE_EVENT( 1, "events/particle.sc" );
}

void CParticleEmitter::MakeAware( edict_t* thisedict )
{
        PLAYBACK_EVENT_FULL( FEV_HOSTONLY, thisedict, m_usStartParticle,
0.0, (float *)&(pev->origin), (float *)&g_vecZero, 0.0, 0.0, type, 0, 0, 0 );
}

with this in the InitHUD function:

        CParticleEmitter* pEntity = NULL;

        while( (pEntity = ((CParticleEmitter*)(UTIL_FindEntityByClassname(
pEntity, "func_particle" )))) != NULL )
        {

                pEntity->MakeAware( pPlayer->edict() );
        }

So basically the same sort of thing as you were talking about, but with an
event rather than a message. Not much difference between the two, just
makes it easier to send a vector, really. :) Thanks for the help.

Persuter

At 10:30 AM 10/27/2002 -0500, you wrote:
I think that A is the crux of the thing not working in one sense. If you're
sending a message on the entities' spawn (or playing an event), the event
is sent to clients far before they are in a state to 'play the event'.

Why not cache the values you need from your entity in member variables in
your keyvalue function, and then send them in InitHUD (just search by
classname, and xmit the data to the clients as they connect).

At least anything I've done that involves some map entity that is relevant
to the client (I render mine with yummy triAPI), I took that approach and
once I realised it was probably good to free the memory for it (big oops in
an internal build), it's been flawless.

One message isn't too costly, paticularly if it's just an 'on/off' type
(one byte).

Cheers,

Pat 'sluggo' Magnan
Tour of Duty mod
http://www.tourofdutymod.com

At 08:16 AM 10/27/2002 -0600, you wrote:
Just taking a swing here at this. But 2 problems I see right off with this
system is the fact that

A.) With a entity being in the map (your grate to emit steam) its spawn
function is called generally when the map is still loading (your not in the
map yet). So wouldnt sending a playevent while your not fully in the game,
b\c the server is still loading, pretty much void that call ?

B.) If this is a multiplayer mod then the other clients would not get this
event b\c its only called on map load. So clients connecting after that load
would never get the msg.

Thats the 2 possible problem areas Im seeing right off.

-Brandon "Axis" Russell
Programmer for
Day of Defeat



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:hlcoders-admin@;list.valvesoftware.com]On Behalf Of Persuter
Sent: Sunday, October 27, 2002 1:25 AM
To: [EMAIL PROTECTED]
Subject: [hlcoders] Problem with client-side events


Hey folks.

I have a question about client-side events. I'm trying to program something
simple here: an entity that sends a message to the client-side telling it
to start a particle system when it spawns, i.e., a grate from which dynamic
steam emits, or something similar.

I have the following code:

void CParticleEmitter::Spawn( void )
{
        Precache();
        PLAYBACK_EVENT_FULL( FEV_GLOBAL | FEV_UPDATE, edict(),
m_usStartParticle,
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, type, 0, 0, 0 );
}

void CParticleEmitter::Precache( void )
{
        m_usStartParticle = PRECACHE_EVENT( 1, "events/particle.sc" );
}

(type, by the way, is the type of system to add)

Now, this all works fine and dandy, the event gets precached, the playback
function goes through fine, the problem is that on the client side the
corresponding function never gets called. On the client-side dll, I've
added the function declaration in both ev_hldm.cpp and hl_events.cpp, and
I've added the HookEvent in hl_events.cpp as well. I dunno, I'm perfectly
able to do weapons but for some reason this one has me at a loss, and the
one client-side non-weapon event in the SDK isn't much help. Am I missing
something required in the spawn function or on the client side that is
simply part of the weapons code?

Thanks for any help.

Persuter

_______________________________________________
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

Reply via email to