raise the grenade up off the ground before it explodes. or just increase the z component of the ORIGIN first. otherwise its more than likely spawning out of PVS and inside the floor.
-omega Blackened Interactive http://www.nofadz.com/blackened ----- Original Message ----- From: "_Phantom_" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 15, 2001 11:02 AM Subject: Re: [hlcoders] [hlcoders]Temp entity problem > The sprite is being pre-cache'd as it's being per-cache'd in the > Precache(void) function in my CEMPGrenade class (along with the models it > uses), also the fact that it works on certain objects but not on others also > proves it being precached. > > I did try your idea however, but it didnt make any difference at all, still > only works on the crossbeams and not on the floor > :( > > > > > I had a look through this... like you say there's certainly no obvious > > reason for it not to work. > > > > Just one thing though, you don't show that youv'e precached the sprite... > I > > know you probably have if not it wouldn't compile, but just try > changing.... > > WRITE_SHORT( m_iSpriteTexture ); > > to this: > > WRITE_SHORT( g_sModelIndexFireball ); > > > > As a temporary measure to make sure the sprite is getting called properly. > > > > Mike. > > ----- Original Message ----- > > From: "_Phantom_" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, November 14, 2001 10:47 PM > > Subject: [hlcoders] [hlcoders]Temp entity problem > > > > > > > lo ppl > > > > > > Here the basic problem, we have an EMP Gren in our mod and when it goes > > off > > > we dont want the normal bang and flash, instead we want the same effect > > the > > > houndeye does when it fires it's sonic attack (the nice circles). > > > > > > Now, in theory this is easy, the Emp Gren is a contact gren, however > > instead > > > of looking like the MP5 contact gren is looks like a standard HE gren > > > (pending a model change). It throw alright using a modified > > ShootContact(..) > > > function, it set the model correct, apon contact with something the > > explode > > > routine works (its a copy of the ExplodeTouch(..) function with the > damage > > > type changed to DMG_EMPBLAST so I can find it later). > > > > > > the EMP Gren is throw using this call -- CGrenade::ShootContactEMP( > > > m_pPlayer->pev, vecSrc, vecThrow, m_iSpriteTexture ); (in Precache > > > m_iSpriteTexutre is the result of a loadmodel) > > > > > > which calls this is CGrenade : > > > > > > CGrenade * CGrenade:: ShootContactEMP( entvars_t *pevOwner, Vector > > vecStart, > > > Vector vecVelocity, int SpriteTexture) > > > { > > > CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); > > > pGrenade->Spawn(); > > > // contact grenades arc lower > > > // below commented out coz it's a normal gren > > > // pGrenade->pev->gravity = 0.5;// lower gravity since grenade is > > > aerodynamic and engine doesn't know it. > > > UTIL_SetOrigin( pGrenade->pev, vecStart ); > > > pGrenade->pev->velocity = vecVelocity; > > > pGrenade->pev->angles = UTIL_VecToAngles (pGrenade->pev->velocity); > > > pGrenade->pev->owner = ENT(pevOwner); > > > > > > // make monsters afaid of it while in the air > > > pGrenade->SetThink( DangerSoundThink ); > > > pGrenade->pev->nextthink = gpGlobals->time; > > > > > > // Tumble in air > > > pGrenade->pev->avelocity.x = RANDOM_FLOAT ( -100, -500 ); > > > > > > // Explode on contact > > > pGrenade->SetTouch( ExplodeEMPTouch ); > > > > > > SET_MODEL(ENT(pGrenade->pev), "models/w_grenade.mdl"); > > > pGrenade->pev->dmg = 0; > > > > > > // grab the SpriteTexture passed to me > > > pGrenade->m_iSpriteTexture = SpriteTexture; > > > > > > return pGrenade; > > > } > > > > > > ----- > > > The modified explode function looks like this : > > > ----- > > > void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) > > > { > > > float flRndSound;// sound randomizer > > > > > > pev->model = iStringNull;//invisible > > > pev->solid = SOLID_NOT;// intangible > > > > > > pev->takedamage = DAMAGE_NO; > > > > > > // Pull out of the wall a bit > > > if ( pTrace->flFraction != 1.0 ) > > > { > > > pev->origin = pTrace->vecEndPos + (pTrace->vecPlaneNormal * > (pev->dmg - > > > 24) * 0.6); > > > } > > > > > > int iContents = UTIL_PointContents ( pev->origin ); > > > if (bitsDamageType == DMG_EMPBLAST) > > > { > > > // emp gren has gone off so do the EMP effect > > > ALERT(at_console, "EMP Burst!!\n"); // code to check we are > > fireing > > > this event! > > > MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); > > > WRITE_BYTE( TE_BEAMCYLINDER ); > > > WRITE_COORD( pev->origin.x); > > > WRITE_COORD( pev->origin.y); > > > WRITE_COORD( pev->origin.z + 32); > > > WRITE_COORD( pev->origin.x); > > > WRITE_COORD( pev->origin.y); > > > WRITE_COORD( pev->origin.z + 32 + 320 / .4); // reach damage radius > > over > > > .3 seconds (replaced houndeye constand with 320) > > > WRITE_SHORT( m_iSpriteTexture ); > > > WRITE_BYTE( 0 ); // startframe > > > WRITE_BYTE( 0 ); // framerate > > > WRITE_BYTE( 4 ); // life > > > WRITE_BYTE( 16 ); // width > > > WRITE_BYTE( 0 ); // noise > > > > > > WRITE_BYTE(0); > > > WRITE_BYTE(255); // bright green > > > WRITE_BYTE(0); > > > > > > WRITE_BYTE( 255 ); //brightness > > > WRITE_BYTE( 0 ); // speed > > > MESSAGE_END(); > > > > > > MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); > > > WRITE_BYTE( TE_BEAMCYLINDER ); > > > WRITE_COORD( pev->origin.x); > > > WRITE_COORD( pev->origin.y); > > > WRITE_COORD( pev->origin.z + 32); > > > WRITE_COORD( pev->origin.x); > > > WRITE_COORD( pev->origin.y); > > > WRITE_COORD( pev->origin.z + 32 + ( 320 / 2 ) / .4); // reach damage > > > radius over .3 seconds (replaced houndeye constand with 320) > > > WRITE_SHORT( m_iSpriteTexture ); > > > WRITE_BYTE( 0 ); // startframe > > > WRITE_BYTE( 0 ); // framerate > > > WRITE_BYTE( 4 ); // life > > > WRITE_BYTE( 16 ); // width > > > WRITE_BYTE( 0 ); // noise > > > > > > WRITE_BYTE(0); > > > WRITE_BYTE(255); // bright green > > > WRITE_BYTE(0); > > > > > > WRITE_BYTE( 255 ); //brightness > > > WRITE_BYTE( 0 ); // speed > > > MESSAGE_END(); > > > > > > CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, > > > NORMAL_EXPLOSION_VOLUME, 3.0 ); // TODO : replace this sound > > > } > > > else > > > { > > > // normal gren effects > > > > > > MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); > > > WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the > > > explosion sprites/sound > > > WRITE_COORD( pev->origin.x ); // Send to PAS because of the sound > > > WRITE_COORD( pev->origin.y ); > > > WRITE_COORD( pev->origin.z ); > > > if (iContents != CONTENTS_WATER) > > > { > > > WRITE_SHORT( g_sModelIndexFireball ); > > > } > > > else > > > { > > > WRITE_SHORT( g_sModelIndexWExplosion ); > > > } > > > WRITE_BYTE( (pev->dmg - 50) * .60 ); // scale * 10 > > > WRITE_BYTE( 15 ); // framerate > > > WRITE_BYTE( TE_EXPLFLAG_NONE ); > > > MESSAGE_END(); > > > CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, > > > NORMAL_EXPLOSION_VOLUME, 3.0 ); > > > } > > > > > > > > > // nuffin changed below here > > > ... > > > .... > > > ... > > > } > > > } > > > > > > Now, the problem is, when you throw the EMP Gren, it hits say the floor, > > it > > > prints the message that the EMP effect has happened, it don't explode > like > > > an HE gren, however the green circles dont appear. However, I've found a > > few > > > instantance when it will make the effect happen, at the spawn point > there > > > are some barriers, throwing the gren so it hit either the top or the > > bottom > > > one causes the effect to appear, also some garage doors also cause the > > > effect to happen. > > > At first I thought it might work coz it was off the ground.. however > > > throwing the gren so it strikes a wall a few feet up fails to make it > > > happen. > > > > > > Any one shead any light on this problem as I'm baffled now. > > > Applogise for the amount of code as well, but I thought I'd better give > as > > > much info as I could.. > > > > > > Cheers, > > > Rob > > > > > > _______________________________________________ > > > 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