Make NPCs fire at different locations on the player

50% - Chest
30% - Legs
20% - Head
This commit is contained in:
Simon 2022-11-20 17:15:27 +00:00
parent c46603adf3
commit b9b10a9876

View file

@ -2033,7 +2033,16 @@ int NPC_ShotEntity( gentity_t *ent, vec3_t impactPos )
{
CalcEntitySpot( NPC, SPOT_WEAPON, muzzle );
}
CalcEntitySpot( ent, SPOT_CHEST, targ );
int location = Q_irand(0, 9);
if (location <= 4 || cg.renderingThirdPerson ||
ent->client->ps.clientNum != 0) { //50% chance (unless ent is not the player, then always go for chest, which is original behaviour)
CalcEntitySpot(ent, SPOT_CHEST, targ);
} else if (location <= 7) { //30% chance
CalcEntitySpot(ent, SPOT_LEGS, targ);
} else { // 20% chance
CalcEntitySpot(ent, SPOT_HEAD, targ);
}
// add aim error
// use weapon instead of specific npc types, although you could add certain npc classes if you wanted