Hello,
I'm Nick/Jangalomph and I'm new to C++ coding for the Source Engine, i have 6
months visual basic experience from school. But down to the nitty gritty.
I have this code taken from grenade_ar2.cpp.
What I've made bold are the changes I've made with the help of a noob coder as
myself.
void CGrenadeAR2::Detonate(void)
{
DispatchParticleEffect( "sb_smg1_explosion_1", GetAbsOrigin(),
GetAbsAngles() );
}
{
if (!m_bIsLive)
{
return;
}
m_bIsLive = false;
m_takedamage = DAMAGE_NO;
if(m_hSmokeTrail)
{
UTIL_Remove(m_hSmokeTrail);
m_hSmokeTrail = NULL;
}
CPASFilter filter( GetAbsOrigin() );
te->Explosion( filter, 0.0,
&GetAbsOrigin(),
g_sModelIndexFireball,
2.0,
15,
TE_EXPLFLAG_NONE,
m_DmgRadius,
m_flDamage );
Vector vecForward = GetAbsVelocity();
VectorNormalize(vecForward);
trace_t tr;
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT,
this, COLLISION_GROUP_NONE, &tr);
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
{
// non-world needs smaller decals
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
{
UTIL_DecalTrace( &tr, "SmallScorch" );
}
}
else
{
UTIL_DecalTrace( &tr, "Scorch" );
}
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
RadiusDamage ( CTakeDamageInfo( this, GetThrower(), m_flDamage, DMG_BLAST
), GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
UTIL_Remove( this );
}
void CGrenadeAR2::Precache( void )
{
PrecacheParticleSystem( "sb_smg1_explosion_1" );
PrecacheModel("models/Weapons/ar2_grenade.mdl");
}
CGrenadeAR2::CGrenadeAR2(void)
{
m_hSmokeTrail = NULL;
}
I've added 2 - 3 lines of code that preaches a particle effect along with the
normal explosion. The particle dispatched is a PCF file created by me. The
explosion works. And all is well. It looks good with the normal explosion
spawning too. First off why does it spawn it at that certain line in the code?
If i place the line else where it would give me errors. All in all, why does it
work? So if you precache a grenade effect like this in the smg1 grenade. How
could you do it for a Frag grenade?
My second question is. I had an idea to replace the combine ball/orb with an
electric beam. I could either dispatch particle effects "PCF KIND" to go where
the cross-hair is, or go to the nearest NPC and zap them to vaporize them as
the combine ball does. How would this be done?
My third question goes back to particle effects. In Smod you see lots of impact
particle effects, from grenade explosions creating dust clouds in the air, to
new sparks. How could i replace hard coded impacts with PCF impact effects?
My fourth and final question "for now" is how would i parent a blood particle
effect to an NPC. As if i shoot an NPC in the head and the emission starts from
there and he moves and the blood is still squirting. Is there a way to hard
code this? And if the NPC dies/ragdolls how could you make the blood effects
follow that ragdoll?
Thanks,
Nick S.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders