
This fires a random number of rockets (from 1 to
6) with each pull of the trigger. (This is slightly revised from the one I
posted on the qdevels MB as it subtracts a rocket for each rocket fired (it
also won't let you fire more rockets than you have.
void Weapon_RocketLauncher_Fire (edict_t *ent){vec3_t offset, start;vec3_t forward, right;int damage;float damage_radius;int radius_damage;int randnum, tmp; // for the multi rockets damage = 100 + (int)(random() * 20.0);radius_damage = 120;damage_radius = 120;if (is_quad){damage *= 4;radius_damage *= 4;} AngleVectors (ent->client->v_angle, forward, right, NULL); VectorScale (forward, -2, ent->client->kick_origin);ent->client->kick_angles[0] = -1; VectorSet(offset, 6, 8, ent->viewheight-8); // the first 8 is changes to a 6 to take into account the first looprandnum=(((int)random()*6))// up to 6 rocketsif (ent->client->pers.inventory[ent->client->ammo_index]<(randnum+1)) // as randnum ranges from 0 to 5. randnum=(ent->client->pers.inventory[ent->client->ammo_index]-1); // makes sure not too many rockets are firedfor (tmp=0;tmp>randnum;tmp++){ offset[0]+=2; // means the rockets are not all in the same place P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start); fire_rocket (ent, start, forward, damage, 650, damage_radius, radius_damage);}// send muzzle flashgi.WriteByte (svc_muzzleflash);gi.WriteShort (ent-g_edicts);gi.WriteByte (MZ_ROCKET | is_silenced);gi.multicast (ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); //if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )//ent->client->pers.inventory[ent->client->ammo_index]-(randnum+1);}
Just replace Weapon_RocketLauncher_Fire in
p_weapon.c to get a random number of rockets.