Source: Autospawn Particle issues.

Grab your favourite IDE and tinker with the innards of game engines

Source: Autospawn Particle issues.

Postby reepblue on Sat May 25, 2013 6:25 am

Hi,

It's been a while since I post anything here. I visited every so often and now I actually need help.

I'm constructing entities that use particle effects that spawn when the map/entity spawns. However, just spawning the particle in the spawn function will not make the particle start. To fix this issue, I added it to a think function and have the think function "think" a full second after the entity spawned. It works, but I'm noticing that when the entities are in a different location of the player; divided by a area portal (it seems), the particle will not spawn, but things like sounds will.

Is there a way to fix this issue? I know the bandage fix is to make an input to refresh the particles so it can do this via trigger, but I want it to do it automatically.

Here is the code showing what I'm talking about.

Code: Select all
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropParticleBallSpawn::Spawn( void )
{
   Precache();

   SetModel( "models/props_gameplay/punt_launcher.mdl" );
   m_bSpawnedParticle = false;
   SetNextThink( gpGlobals->curtime + 1.0 );

   BaseClass::Spawn();
}

void CPropParticleBallSpawn::Think( void )
{
   if (m_bSpawnedParticle)
      return;

   if ( m_bType == 0)
   {
      DispatchParticleEffect (PROP_PARTICLE_BALL_PARTICLE0, PATTACH_ABSORIGIN, this );
      m_bSpawnedParticle = true;
   }

   if ( m_bType == 1)
   {
      DispatchParticleEffect (PROP_PARTICLE_BALL_PARTICLE1, PATTACH_ABSORIGIN, this );
      m_bSpawnedParticle = true;
   }

   if ( m_bType == 2)
   {
      DispatchParticleEffect (PROP_PARTICLE_BALL_PARTICLE2, PATTACH_ABSORIGIN, this );
      m_bSpawnedParticle = true;
   }

   BaseClass::Think();
}


Code is a WIP.
reepblue
Member
Member
 
Joined: Sun Feb 21, 2010 10:28 pm

Return to Programming

Who is online

Users browsing this forum: No registered users