defs.qc: added killed_monsters_oldcount so I can keep track of how many

monsters were previously seen by the kill detection code in combat.qc.

combat.qc now has a while loop to determine how many kills it should update
the client with.

boss.qc has an adjustment to prevent the boss death from giving you 2 frags.

all the rest have adjustments to make killed_monsters++ on monster death,
assuming you have respawn_enabled set to 1, it will only count gibs. Otherwise
it should work normally.

This code is a little buggy, but Grievre wanted to see, so... *shrug*

Hikaru
This commit is contained in:
Timothy C. McGrath 2004-02-14 11:23:40 +00:00
parent 029ab404b5
commit 9871fa2401
16 changed files with 61 additions and 7 deletions

View file

@ -182,6 +182,7 @@ void() boss_death9 = [$death9, boss_death10]
void() boss_death10 = [$death9, boss_death10]
{
killed_monsters++;
killed_monsters_oldcount++;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
SUB_UseTargets ();
remove (self);

View file

@ -56,7 +56,6 @@ Killed
void(entity targ, entity attacker) Killed =
{
local entity oself;
oself = self;
self = targ;
@ -75,8 +74,10 @@ void(entity targ, entity attacker) Killed =
// bump the monster counter
if (self.flags & FL_MONSTER)
{
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
while (killed_monsters_oldcount < killed_monsters) {
killed_monsters_oldcount++;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
}
}
ClientObituary(self, attacker);

View file

@ -38,6 +38,7 @@ float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
float killed_monsters_oldcount;//number of monsters killed in last sweep.
float respawn_enabled; // is respawn allowed
// spawnparms are used to encode information about clients across server

View file

@ -160,10 +160,15 @@ void() demon_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
killed_monsters++;
return;
}
// regular death
if (!respawn_enabled)
killed_monsters++;
demon1_die1 ();
};

View file

@ -236,6 +236,7 @@ void() dog_die =
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowHead ("progs/h_dog.mdl", self.health);
killed_monsters++;
return;
}
@ -243,6 +244,9 @@ void() dog_die =
sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
if (!respawn_enabled)
killed_monsters++;
if (random() > 0.5)
dog_die1 ();
else

View file

@ -278,11 +278,15 @@ void() enf_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
// regular death
sound (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
if (random() > 0.5)
enf_die1 ();
else

View file

@ -140,10 +140,14 @@ void () f_death =
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
remove (self);
return;
}
if (!respawn_enabled)
killed_monsters++;
f_death1 ();
};

View file

@ -207,11 +207,16 @@ void() hknight_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
// regular death
sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
if (random() > 0.5)
hknight_die1 ();
else

View file

@ -220,11 +220,16 @@ void() knight_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
// regular death
sound (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
if (random() < 0.5)
knight_die1 ();
else

View file

@ -398,11 +398,15 @@ void() ogre_die =
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
sound (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
if (random() < 0.5)
ogre_die1 ();
else

View file

@ -108,10 +108,15 @@ void() shalrath_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
shal_death1 ();
self.solid = SOLID_NOT;
// insert death sounds here

View file

@ -313,11 +313,16 @@ void() sham_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
// regular death
sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
sham_death1 ();
};

View file

@ -230,11 +230,16 @@ void() army_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
return;
}
// regular death
sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
if (!respawn_enabled)
killed_monsters++;
if (random() < 0.5)
army_die1 ();
else

View file

@ -156,9 +156,9 @@ void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
void() tbaby_die1 =[ $exp, tbaby_die2 ] {
self.takedamage = DAMAGE_NO;
killed_monsters++;
};
void() tbaby_die2 =[ $exp, tbaby_run1 ]
{
void() tbaby_die2 =[ $exp, tbaby_run1 ] {
T_RadiusDamage (self, self, 120, world);
sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);

View file

@ -348,9 +348,13 @@ void() wiz_die =
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
killed_monsters++;
return;
}
if (!respawn_enabled)
killed_monsters++;
wiz_death1 ();
};

View file

@ -391,6 +391,7 @@ void() zombie_die =
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
killed_monsters++;
};
/*