Sorry to revive an old thread, but I was adding this to my mod and found a way to make the ammo/med packs go in different directions(a circle around the player actually):
take bacons original code
int i, drop;
if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9;
for( i = 0 ; i < drop ; i++ ) {
Weapon_MagicAmmo( self );
}
} else if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC) {
drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;
for( i = 0 ; i < drop ; i++ ) {
Weapon_Medic( self );
}
}
and change it to this:
int i, drop;
// x and y components of the direction vector
float x, y;
// the item (med/ammo pack)
gitem_t *item;
// direction vector
vec3_t dir;
if( self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
// find the right item
item = BG_FindItem( self->client->sess.skill[SK_SIGNALS] >= 1 ? "Mega Ammo Pack" : "Ammo Pack" );
drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9;
} else if(self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC ) {
// find the right item
item = BG_FindItemForClassName("item_health");
drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;
} else {
item = 0;
}
if( item ) {
// do this for all the packs
for( i = 0; it < drop; i++ ) {
// find the x component
x = 300 * cos( DEG2RAD(360 / drop) * i );
// find the y component
y = 300 * sin( DEG2RAD(360 / drop) * i );
// set the direction vector
VectorSet( dir, x, y, 5 );
// launch the pack
ent2 = LaunchItem( item, self->r.currentOrigin, dir, self->s.number );
// so it will go away after a while like normal packs do
ent2->think = MagicSink;
ent2->nextthink = level.time + 30000;
}
}
Now you’ll have a ring of packs around the dead player.
dvl
EDIT:
you need to add this in g_local.h
void MagicSink( gentity_t *self );