Hey, recently I've been getting started on modding Tremulous's source and have made some pretty fun stuff. Like I modified the lucifer cannon so it shot more like a missile launcher (5 shots per clip, fast bolt travels fast, higher damage, and it plays the EV_human_buildable_explosion effect when it explodes). Now, I wanted to do something similar to that using the same technique but with "acid bombs" (like in TremX). Though I've noticed that the way I had been coding it, alien bolts won't spawn any type of entity. Human bolts will.. (I've spawned hives, explosion effects etc). But alien bolts still spawn nothing. As you probably know, when a bolt reaches it's "next think" it explodes and calls the function "g_explodeMissile". Then in g_missile you can manipulate how a specific bolt explodes (like this):
/*
================
G_ExplodeMissile
Explode a missile without an impact
================
*/
void G_ExplodeMissile( gentity_t *ent )
{
gentity_t *vic, *tent, *other;
vec3_t dir;
vec3_t origin;
if( ent->parent && ent->parent->client && !strcmp( ent->classname, "grenade" ) )
--ent->parent->client->pers.grenadeCount;
BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );
SnapVector( origin );
G_SetOrigin( ent, origin );
// we don't have a valid direction, so just point straight up
dir[ 0 ] = dir[ 1 ] = 0;
dir[ 2 ] = 1;
ent->s.eType = ET_GENERAL;
if( ent->s.weapon != WP_LOCKBLOB_LAUNCHER &&
ent->s.weapon != WP_FLAMER )
G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( dir ) );
ent->freeAfterEvent = qtrue;
switch( ent->s.weapon )
{
case WP_LUCIFER_CANNON:
tent = G_TempEntity( ent->r.currentOrigin, EV_HUMAN_BUILDABLE_EXPLOSION );
break;
default:
break;
}
switch( ent->s.weapon )
{
case WP_ALEVEL3_UPG:
tent = G_TempEntity( ent->r.currentOrigin, EV_ALIEN_BUILDABLE_EXPLOSION );
hiveFire( ent );
break;
default:
break;
}
// splash damage
if( ent->splashDamage )
G_RadiusDamage( ent->r.currentOrigin, ent->parent, ent->splashDamage,
ent->splashRadius, ent, ent->splashMethodOfDeath );
trap_LinkEntity( ent );
}
More specifically, these are the lines which manipulate how the lucifer cannon/dragoon barb explode:
switch( ent->s.weapon )
{
case WP_LUCIFER_CANNON:
tent = G_TempEntity( ent->r.currentOrigin, EV_HUMAN_BUILDABLE_EXPLOSION );
break;
default:
break;
}
switch( ent->s.weapon )
{
case WP_ALEVEL3_UPG:
tent = G_TempEntity( ent->r.currentOrigin, EV_ALIEN_BUILDABLE_EXPLOSION );
hiveFire( ent );
break;
default:
break;
}
They're pretty much the same code, just for different weapons. Though for some reason, the lucifer cannon will spawn the ev_human_buildable_explosion without any problems, but the dragoon barb won't spawn either the ev_alien_buildable_explosion or the hive.
Does anyone know what's wrong? Thanks in advance.