From a061092d650a234c5dbb16857c12bd9221884cc0 Mon Sep 17 00:00:00 2001 From: Magnus Date: Mon, 9 Jan 2006 01:13:34 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1828 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- quakec/fallout2/client.qc | 14 +- quakec/fallout2/defs.qc | 1 + quakec/fallout2/shambler.qc | 358 ++++++++++++ quakec/fallout2/world.qc | 1030 +---------------------------------- 4 files changed, 393 insertions(+), 1010 deletions(-) create mode 100644 quakec/fallout2/shambler.qc diff --git a/quakec/fallout2/client.qc b/quakec/fallout2/client.qc index 5004d4be3..72ecc4683 100644 --- a/quakec/fallout2/client.qc +++ b/quakec/fallout2/client.qc @@ -863,6 +863,7 @@ void() PlayerDeathThink = { local float forward; + self.view_ofs = '0 0 -12'; self.modelindex = modelindex_dead; self.solid = SOLID_NOT; @@ -1206,6 +1207,11 @@ void() PlayerPreThink = makevectors (self.v_angle); // is this still used + if (self.deadflag >= DEAD_DEAD) + { + PlayerDeathThink (); + return; + } if (self.cycle1 < time) { @@ -1322,11 +1328,7 @@ void() PlayerPreThink = CheckRules (); WaterMove (); - if (self.deadflag >= DEAD_DEAD) - { - PlayerDeathThink (); - return; - } + if (self.deadflag == DEAD_DYING) return; // dying, so do nothing @@ -1604,7 +1606,7 @@ void() ClientConnect = stuffcmd(self, "alias info impulse 56\n"); stuffcmd(self, "alias equip impulse 57\n"); - stuffcmd(self, "alias stimpack \"cmd invuse stimpack\"\n"); + stuffcmd(self, "alias stimpack cmd invuse superstims+stimpack+bandages\n"); stuffcmd(self, "bind c equip\n"); stuffcmd(self, "bind g drop\n"); diff --git a/quakec/fallout2/defs.qc b/quakec/fallout2/defs.qc index ba3ee5dfa..129b3a608 100644 --- a/quakec/fallout2/defs.qc +++ b/quakec/fallout2/defs.qc @@ -501,6 +501,7 @@ float msgcount; float max_zombies; float gtimer; float total_players; +float endgame_timer; //================================================ diff --git a/quakec/fallout2/shambler.qc b/quakec/fallout2/shambler.qc new file mode 100644 index 000000000..5165ec436 --- /dev/null +++ b/quakec/fallout2/shambler.qc @@ -0,0 +1,358 @@ +/* +============================================================================== + +SHAMBLER + +============================================================================== +*/ + +$cd id1/models/shams +$origin 0 0 24 +$base base +$skin base + +$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9 +$frame stand10 stand11 stand12 stand13 stand14 stand15 stand16 stand17 + +$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 +$frame walk8 walk9 walk10 walk11 walk12 + +$frame run1 run2 run3 run4 run5 run6 + +$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7 +$frame smash8 smash9 smash10 smash11 smash12 + +$frame swingr1 swingr2 swingr3 swingr4 swingr5 +$frame swingr6 swingr7 swingr8 swingr9 + +$frame swingl1 swingl2 swingl3 swingl4 swingl5 +$frame swingl6 swingl7 swingl8 swingl9 + +$frame magic1 magic2 magic3 magic4 magic5 +$frame magic6 magic7 magic8 magic9 magic10 magic11 magic12 + +$frame pain1 pain2 pain3 pain4 pain5 pain6 + +$frame death1 death2 death3 death4 death5 death6 +$frame death7 death8 death9 death10 death11 + +void() sham_stand1 =[ $stand1, sham_stand2 ] {ai_stand();}; +void() sham_stand2 =[ $stand2, sham_stand3 ] {ai_stand();}; +void() sham_stand3 =[ $stand3, sham_stand4 ] {ai_stand();}; +void() sham_stand4 =[ $stand4, sham_stand5 ] {ai_stand();}; +void() sham_stand5 =[ $stand5, sham_stand6 ] {ai_stand();}; +void() sham_stand6 =[ $stand6, sham_stand7 ] {ai_stand();}; +void() sham_stand7 =[ $stand7, sham_stand8 ] {ai_stand();}; +void() sham_stand8 =[ $stand8, sham_stand9 ] {ai_stand();}; +void() sham_stand9 =[ $stand9, sham_stand10] {ai_stand();}; +void() sham_stand10 =[ $stand10, sham_stand11] {ai_stand();}; +void() sham_stand11 =[ $stand11, sham_stand12] {ai_stand();}; +void() sham_stand12 =[ $stand12, sham_stand13] {ai_stand();}; +void() sham_stand13 =[ $stand13, sham_stand14] {ai_stand();}; +void() sham_stand14 =[ $stand14, sham_stand15] {ai_stand();}; +void() sham_stand15 =[ $stand15, sham_stand16] {ai_stand();}; +void() sham_stand16 =[ $stand16, sham_stand17] {ai_stand();}; +void() sham_stand17 =[ $stand17, sham_stand1 ] {ai_stand();}; + +void() sham_walk1 =[ $walk1, sham_walk2 ] {ai_walk(10);}; +void() sham_walk2 =[ $walk2, sham_walk3 ] {ai_walk(9);}; +void() sham_walk3 =[ $walk3, sham_walk4 ] {ai_walk(9);}; +void() sham_walk4 =[ $walk4, sham_walk5 ] {ai_walk(5);}; +void() sham_walk5 =[ $walk5, sham_walk6 ] {ai_walk(6);}; +void() sham_walk6 =[ $walk6, sham_walk7 ] {ai_walk(12);}; +void() sham_walk7 =[ $walk7, sham_walk8 ] {ai_walk(8);}; +void() sham_walk8 =[ $walk8, sham_walk9 ] {ai_walk(3);}; +void() sham_walk9 =[ $walk9, sham_walk10] {ai_walk(13);}; +void() sham_walk10 =[ $walk10, sham_walk11] {ai_walk(9);}; +void() sham_walk11 =[ $walk11, sham_walk12] {ai_walk(7);}; +void() sham_walk12 =[ $walk12, sham_walk1 ] {ai_walk(7); +if (random() > 0.8) + sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);}; + +void() sham_run1 =[ $run1, sham_run2 ] {ai_run(20);}; +void() sham_run2 =[ $run2, sham_run3 ] {ai_run(24);}; +void() sham_run3 =[ $run3, sham_run4 ] {ai_run(20);}; +void() sham_run4 =[ $run4, sham_run5 ] {ai_run(20);}; +void() sham_run5 =[ $run5, sham_run6 ] {ai_run(24);}; +void() sham_run6 =[ $run6, sham_run1 ] {ai_run(20); +if (random() > 0.8) + sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE); +}; + +void() sham_smash1 =[ $smash1, sham_smash2 ] { +sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM); +ai_charge(2);}; +void() sham_smash2 =[ $smash2, sham_smash3 ] {ai_charge(6);}; +void() sham_smash3 =[ $smash3, sham_smash4 ] {ai_charge(6);}; +void() sham_smash4 =[ $smash4, sham_smash5 ] {ai_charge(5);}; +void() sham_smash5 =[ $smash5, sham_smash6 ] {ai_charge(4);}; +void() sham_smash6 =[ $smash6, sham_smash7 ] {ai_charge(1);}; +void() sham_smash7 =[ $smash7, sham_smash8 ] {ai_charge(0);}; +void() sham_smash8 =[ $smash8, sham_smash9 ] {ai_charge(0);}; +void() sham_smash9 =[ $smash9, sham_smash10 ] {ai_charge(0);}; +void() sham_smash10 =[ $smash10, sham_smash11 ] { +local vector delta; +local float ldmg; + + if (!self.enemy) + return; + ai_charge(0); + + delta = self.enemy.origin - self.origin; + + if (vlen(delta) > 100) + return; + if (!CanDamage (self.enemy, self)) + return; + + ldmg = (random() + random() + random()) * 40; + T_Damage (self.enemy, self, self, ldmg); + sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM); + + SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right); + SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right); +}; +void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);}; +void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);}; + +void() sham_swingr1; + +void(float side) ShamClaw = +{ +local vector delta; +local float ldmg; + + if (!self.enemy) + return; + ai_charge(10); + + delta = self.enemy.origin - self.origin; + + if (vlen(delta) > 100) + return; + + ldmg = (random() + random() + random()) * 20; + T_Damage (self.enemy, self, self, ldmg); + sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM); + + if (side) + { + makevectors (self.angles); + SpawnMeatSpray (self.origin + v_forward*16, side * v_right); + } +}; + +void() sham_swingl1 =[ $swingl1, sham_swingl2 ] { +sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM); +ai_charge(5);}; +void() sham_swingl2 =[ $swingl2, sham_swingl3 ] {ai_charge(3);}; +void() sham_swingl3 =[ $swingl3, sham_swingl4 ] {ai_charge(7);}; +void() sham_swingl4 =[ $swingl4, sham_swingl5 ] {ai_charge(3);}; +void() sham_swingl5 =[ $swingl5, sham_swingl6 ] {ai_charge(7);}; +void() sham_swingl6 =[ $swingl6, sham_swingl7 ] {ai_charge(9);}; +void() sham_swingl7 =[ $swingl7, sham_swingl8 ] {ai_charge(5); ShamClaw(250);}; +void() sham_swingl8 =[ $swingl8, sham_swingl9 ] {ai_charge(4);}; +void() sham_swingl9 =[ $swingl9, sham_run1 ] { +ai_charge(8); +if (random()<0.5) + self.think = sham_swingr1; +}; + +void() sham_swingr1 =[ $swingr1, sham_swingr2 ] { +sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM); +ai_charge(1);}; +void() sham_swingr2 =[ $swingr2, sham_swingr3 ] {ai_charge(8);}; +void() sham_swingr3 =[ $swingr3, sham_swingr4 ] {ai_charge(14);}; +void() sham_swingr4 =[ $swingr4, sham_swingr5 ] {ai_charge(7);}; +void() sham_swingr5 =[ $swingr5, sham_swingr6 ] {ai_charge(3);}; +void() sham_swingr6 =[ $swingr6, sham_swingr7 ] {ai_charge(6);}; +void() sham_swingr7 =[ $swingr7, sham_swingr8 ] {ai_charge(6); ShamClaw(-250);}; +void() sham_swingr8 =[ $swingr8, sham_swingr9 ] {ai_charge(3);}; +void() sham_swingr9 =[ $swingr9, sham_run1 ] {ai_charge(1); +ai_charge(10); +if (random()<0.5) + self.think = sham_swingl1; +}; + +void() sham_melee = +{ + local float chance; + + chance = random(); + if (chance > 0.6 || self.health == 600) + sham_smash1 (); + else if (chance > 0.3) + sham_swingr1 (); + else + sham_swingl1 (); +}; + + +//============================================================================ + +void() CastLightning = +{ + local vector org, dir; + + ai_face (); + + org = self.origin + '0 0 40'; + + dir = self.enemy.origin + '0 0 16' - org; + dir = normalize (dir); + + traceline (org, self.origin + dir*600, TRUE, self); + + WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); + WriteByte (MSG_BROADCAST, TE_LIGHTNING1); + WriteEntity (MSG_BROADCAST, self); + WriteCoord (MSG_BROADCAST, org_x); + WriteCoord (MSG_BROADCAST, org_y); + WriteCoord (MSG_BROADCAST, org_z); + WriteCoord (MSG_BROADCAST, trace_endpos_x); + WriteCoord (MSG_BROADCAST, trace_endpos_y); + WriteCoord (MSG_BROADCAST, trace_endpos_z); + + LightningDamage (org, trace_endpos, self, 10); +}; + +void() sham_magic1 =[ $magic1, sham_magic2 ] {ai_face(); + sound (self, CHAN_WEAPON, "shambler/sattck1.wav", 1, ATTN_NORM); +}; +void() sham_magic2 =[ $magic2, sham_magic3 ] {ai_face();}; +void() sham_magic3 =[ $magic3, sham_magic4 ] {ai_face();self.nextthink = self.nextthink + 0.2; +local entity o; + +ai_face(); +self.owner = spawn(); +o = self.owner; +setmodel (o, "progs/s_light.mdl"); +setorigin (o, self.origin); +o.angles = self.angles; +o.nextthink = time + 0.7; +o.think = SUB_Remove; +}; +void() sham_magic4 =[ $magic4, sham_magic5 ] +{ +self.owner.frame = 1; +}; +void() sham_magic5 =[ $magic5, sham_magic6 ] +{ +self.owner.frame = 2; +}; +void() sham_magic6 =[ $magic6, sham_magic9 ] +{ +remove (self.owner); +CastLightning(); +sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM); +}; +void() sham_magic9 =[ $magic9, sham_magic10 ] +{CastLightning();}; +void() sham_magic10 =[ $magic10, sham_magic11 ] +{CastLightning();}; +void() sham_magic11 =[ $magic11, sham_magic12 ] +{ + CastLightning(); +}; +void() sham_magic12 =[ $magic12, sham_run1 ] {}; + + + +void() sham_pain1 =[ $pain1, sham_pain2 ] {}; +void() sham_pain2 =[ $pain2, sham_pain3 ] {}; +void() sham_pain3 =[ $pain3, sham_pain4 ] {}; +void() sham_pain4 =[ $pain4, sham_pain5 ] {}; +void() sham_pain5 =[ $pain5, sham_pain6 ] {}; +void() sham_pain6 =[ $pain6, sham_run1 ] {}; + +void(entity attacker, float damage) sham_pain = +{ + sound (self, CHAN_VOICE, "shambler/shurt2.wav", 1, ATTN_NORM); + + if (self.health <= 0) + return; // allready dying, don't go into pain frame + + if (random()*400 > damage) + return; // didn't flinch + + if (self.pain_finished > time) + return; + self.pain_finished = time + 2; + + sham_pain1 (); +}; + + +//============================================================================ + +void() sham_death1 =[ $death1, sham_death2 ] {}; +void() sham_death2 =[ $death2, sham_death3 ] {}; +void() sham_death3 =[ $death3, sham_death4 ] {self.solid = SOLID_NOT;}; +void() sham_death4 =[ $death4, sham_death5 ] {}; +void() sham_death5 =[ $death5, sham_death6 ] {}; +void() sham_death6 =[ $death6, sham_death7 ] {}; +void() sham_death7 =[ $death7, sham_death8 ] {}; +void() sham_death8 =[ $death8, sham_death9 ] {}; +void() sham_death9 =[ $death9, sham_death10 ] {}; +void() sham_death10 =[ $death10, sham_death11 ] {}; +void() sham_death11 =[ $death11, sham_death11 ] {}; + +void() sham_die = +{ +// check for gib + if (self.health < -60) + { + sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); + ThrowHead ("progs/h_shams.mdl", self.health); + ThrowGib ("progs/gib1.mdl", self.health); + ThrowGib ("progs/gib2.mdl", self.health); + ThrowGib ("progs/gib3.mdl", self.health); + return; + } + +// regular death + sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM); + sham_death1 (); +}; + +//============================================================================ + +void() monster_shambler = +{ + if (deathmatch) + { + remove(self); + return; + } + precache_model ("progs/shambler.mdl"); + precache_model ("progs/s_light.mdl"); + precache_model ("progs/h_shams.mdl"); + precache_model ("progs/bolt.mdl"); + + precache_sound ("shambler/sattck1.wav"); + precache_sound ("shambler/sboom.wav"); + precache_sound ("shambler/sdeath.wav"); + precache_sound ("shambler/shurt2.wav"); + precache_sound ("shambler/sidle.wav"); + precache_sound ("shambler/ssight.wav"); + precache_sound ("shambler/melee1.wav"); + precache_sound ("shambler/melee2.wav"); + precache_sound ("shambler/smack.wav"); + + self.solid = SOLID_SLIDEBOX; + self.movetype = MOVETYPE_STEP; + setmodel (self, "progs/shambler.mdl"); + + setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX); + self.health = 600; + + self.th_stand = sham_stand1; + self.th_walk = sham_walk1; + self.th_run = sham_run1; + self.th_die = sham_die; + self.th_melee = sham_melee; + self.th_missile = sham_magic1; + self.th_pain = sham_pain; + + walkmonster_start(); +}; diff --git a/quakec/fallout2/world.qc b/quakec/fallout2/world.qc index a95bb0314..48721abdc 100644 --- a/quakec/fallout2/world.qc +++ b/quakec/fallout2/world.qc @@ -188,1025 +188,47 @@ void() main = precache_file2 ("maps/dm6.bsp"); }; -void () ResetHostages = -{ - local entity te; - - - te = find (world, classname, "hostage"); - while (te) - { - te.cnt = MULTICAST_ALL; - te.rescued = MULTICAST_ALL; - te.deathtype = ""; - setorigin (te, te.home); - traceline (te.origin, (te.origin - (v_up * IT_NAILS)), FALSE, te); - setorigin (te, (trace_endpos + '0 0 24')); - te.movetype = MOVETYPE_STEP; - te.velocity = VEC_ORIGIN; - te.touch = SUB_Null; - te.classname = "hostage"; - te.takedamage = DAMAGE_AIM; - setsize (te, VEC_HULL_MIN, VEC_HULL_MAX); - te.health = 70; - te.think = hostage_think; - te.nextthink = (time + WEAPON_SHOTGUN); - te.solid = SOLID_BBOX; - te.th_die = hostage_die; - te.th_pain = hostage_pain; - te.angles_y = floor ((random () * 360)); - te.netname = "citizen"; - te.angles_z = MULTICAST_ALL; - te.angles_x = MULTICAST_ALL; - te = find (te, classname, "hostage"); - } - te = find (world, classname, "scientist"); - while (te) - { - te.frame = 1; - te.movetype = MOVETYPE_STEP; - te.velocity = VEC_ORIGIN; - te.touch = SUB_Null; - te.classname = "scientist"; - te.takedamage = DAMAGE_AIM; - setsize (te, VEC_HULL_MIN, VEC_HULL_MAX); - setmodel (te, "progs/hosguy.mdl"); - te.health = 70; - te.think = hostage_think; - te.nextthink = (time + 3); - te.team = 3; - te.solid = SOLID_BBOX; - te.th_die = hostage_die; - te.th_pain = hostage_pain; - te.rescued = MULTICAST_ALL; - te.think = sci_think; - te.nextthink = (time + 1); - - te = find (te, classname, "scientist"); - } -}; - -void () ResetGhouls = -{ - local entity ze; - - ze = find (world, classname, "ighoul"); - while (ze) - { - remove (ze); - ze = find (ze, classname, "ighoul"); - } - ze = find (world, classname, "ghoul"); - while (ze) - { - spawn_zombie (self); - ze = find (ze, classname, "ghoul"); - } -}; - -void (float won) ReplacePlayers = -{ - local entity te; - local float qq; - - round_end = 1.9; - te = find (world, classname, "camera"); - while (te) - { - setmodel (te, "progs/camera.mdl"); - te = find (te, classname, "camera"); - } - te = find (world, classname, "player"); - while (te) - { - if ((te.team == WEAPON_SHOTGUN)) - { - qq = team1win; - } - if ((te.team == WEAPON_ROCKET)) - { - qq = team2win; - } - if ((te.team == won)) - { - te.ammo_shells = ((te.ammo_shells + TE_LIGHTNING3) + (qq / 1.25)); - } - else - { - te.ammo_shells = ((te.ammo_shells + TE_LIGHTNING2) + (qq / WEAPON_ROCKET)); - } - te.nextthink = time; - te.think = PutClientInServer; - te.maxspeed = 0; - te = find (te, classname, "player"); - } - gtimer = 180; -}; - -void () ObjectSweep = -{ - local entity te; - - te = find (world, classname, "doggy"); - while (te) - { - remove (te); - te = find (te, classname, "doggy"); - } - te = find (world, classname, "bot"); - while (te) - { - remove (te); - te = find (te, classname, "bot"); - } - te = find (world, classname, "dropped_weapon"); - while (te) - { - remove (te); - te = find (te, classname, "dropped_weapon"); - } - te = find (world, classname, "c4"); - while (te) - { - remove (te); - te = find (te, classname, "c4"); - } - te = find (world, classname, "active_c4"); - while (te) - { - remove (te); - te = find (te, classname, "active_c4"); - } -}; - -void () ResetTriggers = -{ - local entity te; - - te = find (world, classname, "trigger_once"); - while (te) - { - te.wait = 0.5; - te = find (te, classname, "trigger_once"); - } - te = find (world, classname, "func_button"); - while (te) - { - te.wait = 0.5; - te = find (te, classname, "func_button"); - } -}; - -void () RoundReset = -{ - round_end = WEAPON_ROCKET; - red_kill = MULTICAST_ALL; - blue_kill = MULTICAST_ALL; - teamthatwon = 0; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - bombed = MULTICAST_ALL; - ResetTriggers (); - ResetGhouls (); - ResetHostages (); - ObjectSweep (); - ReplacePlayers (0); -}; - -void () CountGhouls = -{ - local entity te; - - zombies = 0; - te = find (world, classname, "ighoul"); - while (te) - { - if ((te.health > 0)) - { - zombies = (zombies + 1); - } - te = find (te, classname, "ighoul"); - } -}; - -void () CountScientists = -{ - local entity te; - - hostages = MULTICAST_ALL; - te = find (world, classname, "scientist"); - while (te) - { - if ((te.health > MULTICAST_ALL)) - { - hostages = (hostages + WEAPON_SHOTGUN); - } - te = find (te, classname, "scientist"); - } -}; - -void () RemoveDeadGhouls = -{ - local entity te; - - te = find (world, classname, "ighoul"); - while (te) - { - if ((te.health < MULTICAST_ALL)) - { - te.nextthink = (time + WEAPON_SHOTGUN); - te.think = SUB_Remove; - } - te = find (te, classname, "ighoul"); - } -}; - -void () SpawnRandomGhouls = -{ - local entity te; - local float playercount; - local float zomcount; - - te = find (world, classname, "info"); - - CountGhouls (); - if (te.attack == 1) - { - te = find (world, classname, "player"); - while (te) - { - if (((te.ghost == 0) && (te.health > 0))) - { - playercount = (playercount + 1); - } - te = find (te, classname, "player"); - } - zomcount = (15 * playercount); - if ((zomcount > 55)) - { - zomcount = 55; - } - } - if (te.attack == 2) - { - te = find (world, classname, "player"); - while (te) - { - if (((te.ghost == 0) && (te.health > 0))) - { - playercount = (playercount + 1); - } - te = find (te, classname, "player"); - } - zomcount = (30 * playercount); - if ((zomcount > 200)) - { - zomcount = 200; - } - } - te = find (world, classname, "ghoul"); - while (te) - { - if ((zombies < zomcount)) - { - spawn_zombie (te); - zombies = (zombies + 1); - } - te = find (te, classname, "ghoul"); - } -}; - -void () DisplayGhoulsLeft = -{ - local string ghoulsleft; - - bprint (WEAPON_ROCKET, "rangers: "); - ghoulsleft = ftos (blue_kill); - bprint (WEAPON_ROCKET, ghoulsleft); - bprint (WEAPON_ROCKET, " raiders: "); - ghoulsleft = ftos (red_kill); - bprint (WEAPON_ROCKET, ghoulsleft); - bprint (WEAPON_ROCKET, " "); - bprint (WEAPON_ROCKET, "left: "); - ghoulsleft = ftos (zombies); - bprint (WEAPON_ROCKET, ghoulsleft); - bprint (WEAPON_ROCKET, "\n"); -}; - -void () CountHostages = -{ - local entity te; - - hostages = MULTICAST_ALL; - dead_hostage = MULTICAST_ALL; - te = find (world, classname, "hostage"); - while (te) - { - if (((te.health > MULTICAST_ALL) && (te.rescued == MULTICAST_ALL))) - { - hostages = (hostages + WEAPON_SHOTGUN); - } - if ((te.health < MULTICAST_ALL)) - { - dead_hostage = (dead_hostage + WEAPON_SHOTGUN); - } - te = find (te, classname, "hostage"); - } -}; - -void () CheckZombie1 = -{ - CountGhouls (); - if ((msgcount == MULTICAST_ALL)) - { - DisplayGhoulsLeft (); - RemoveDeadGhouls (); - SpawnRandomGhouls (); - msgcount = TE_LAVASPLASH; - } - CountHostages (); - msgcount = (msgcount - WEAPON_SHOTGUN); - if ((dead_hostage >= WEAPON_ROCKET)) - { - max_zombies = 400; - sound (self, CHAN_BODY, "misc/zombies.wav", WEAPON_SHOTGUN, ATTN_NONE); - bprint (PRINT_MEDIUM, "*** THE ZOMBIES WIN! ***\n"); - bprint (PRINT_MEDIUM, "*** HOSTAGES HAVE BEEN KILLED ***\n"); - RoundReset (); - return; - } - if ((hostages == MULTICAST_ALL)) - { - max_zombies = 400; - sound (self, CHAN_BODY, "misc/zombies.wav", WEAPON_SHOTGUN, ATTN_NONE); - bprint (PRINT_MEDIUM, "*** THE PLAYERS WIN! ***\n"); - bprint (PRINT_MEDIUM, "*** HOSTAGES HAVE BEEN SAVED! ***\n"); - team1win = (team1win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - if ((gtimer <= WEAPON_SHOTGUN)) - { - max_zombies = 400; - sound (self, CHAN_BODY, "misc/zombies.wav", WEAPON_SHOTGUN, ATTN_NONE); - bprint (PRINT_MEDIUM, "*** THE ZOMBIES WIN! ***\n"); - bprint (PRINT_MEDIUM, "*** HOSTAGES HAVE NOT BEEN SAVED! ***\n"); - RoundReset (); - return; - } -}; - -void () CheckZombie2 = -{ - local entity te; - local float team1; - - CountGhouls (); - if ((msgcount == 0)) - { - DisplayGhoulsLeft (); - RemoveDeadGhouls (); - SpawnRandomGhouls (); - msgcount = TE_LAVASPLASH; - } - msgcount = (msgcount - WEAPON_SHOTGUN); - CountScientists (); - if ((hostages <= 2)) - { - max_zombies = 400; - bprint (PRINT_MEDIUM, ">>> THE ZOMBIES WIN! <<<\n"); - bprint (PRINT_MEDIUM, ">>> A SCIENTIST HAS BEEN KILLED <<<\n"); - RoundReset (); - return; - } - if ((zombies <= 0)) - { - max_zombies = 400; - bprint (PRINT_MEDIUM, ">>> THE PLAYERS WIN! <<<\n"); - bprint (PRINT_MEDIUM, ">>> ZOMBIES HAVE BEEN SLAUGHTERED <<<\n"); - team1win = (team1win + 1); - RoundReset (); - return; - } - if ((gtimer <= 1)) - { - max_zombies = 400; - bprint (PRINT_MEDIUM, "*** THE PLAYERS WIN! ***\n"); - bprint (PRINT_MEDIUM, "*** SCIENTISTS WERE PROTECTED!! ***\n"); - team1win = (team1win + 1); - RoundReset (); - return; - } - - te = find (world, classname, "player"); - while (te) - { - if (te.classname == "player" && te.team == 1 && te.ghost == 0) - team1 = team1 + 1; - - te = find (te, classname, "player"); - } - - if (team1 == 0 && team_blue != 0) - { - max_zombies = 400; - bprint (PRINT_MEDIUM, "*** THE PLAYERS WIN! ***\n"); - bprint (PRINT_MEDIUM, "*** YOUR TEAM WAS SLAUGHTERED!! ***\n"); - RoundReset (); - return; - } -}; - -void () CheckHostage = -{ - local entity te; - - hostages = 0; - dead_hostage = 0; - te = find (world, classname, "hostage"); - while (te) - { - if (((te.health > 0) && (te.rescued == 0))) - { - hostages = (hostages + WEAPON_SHOTGUN); - } - if ((te.health < 0)) - { - dead_hostage = (dead_hostage + 1); - } - te = find (te, classname, "hostage"); - } - if (((dead_hostage >= 2) && (blue_kill >= 2))) - { - bprint (PRINT_MEDIUM, ">>> RANGERS KILLED HOSTAGES <<<\n"); - bprint (PRINT_MEDIUM, ">>> RANGERS LOSE!! <<<\n"); - team2win = (team2win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - if (((dead_hostage >= 2) && (red_kill >= 2))) - { - bprint (PRINT_MEDIUM, ">>> RAIDERS KILLED HOSTAGES <<<\n"); - bprint (PRINT_MEDIUM, ">>> RAIDERS LOSE!! <<<\n"); - team1win = (team1win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - if ((hostages == 0)) - { - bprint (PRINT_MEDIUM, ">>> THE HOSTAGES WERE SAVED <<<\n"); - bprint (PRINT_MEDIUM, ">>> RANGERS WIN THE ROUND!! <<<\n"); - team1win = (team1win + WEAPON_SHOTGUN); - RoundReset (); - return; - } -}; - -void () CheckDefuse = -{ - if ((bombed == 1)) - { - bprint (PRINT_MEDIUM, ">>> RAIDERS WIN THE ROUND! <<<\n"); - team2win = (team2win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - if ((bombed == 2)) - { - bprint (PRINT_MEDIUM, ">>> RANGERS WIN THE ROUND! <<<\n"); - team1win = (team1win + WEAPON_SHOTGUN); - RoundReset (); - return; - } -}; void () GameControl = { + local float pcount, pdead; local entity te; - local float team1; - local float team2; - local float red; - local float blue; - local float x, y; - local float randy; - local float end; - if (world.model == "maps/sv_town.bsp") - respawnvar = 1; - - gtimer = (gtimer - WEAPON_SHOTGUN); - self.nextthink = (time + WEAPON_SHOTGUN); - self.think = GameControl; - red = MULTICAST_ALL; - blue = MULTICAST_ALL; - team1 = MULTICAST_ALL; - team2 = MULTICAST_ALL; - - - if (((random () * IDLE8A) < WEAPON_SHOTGUN)) + te = find(world, classname, "player"); + while (te) { - randy = (random () * TE_WIZSPIKE); - if ((randy < WEAPON_SHOTGUN)) - { - sound (self, CHAN_AUTO, "ambience/gunfire1.wav", 0.75, ATTN_NONE); - } - else - { - if ((randy < WEAPON_ROCKET)) - { - sound (self, CHAN_AUTO, "ambience/gunfire2.wav", 0.75, ATTN_NONE); - } - else - { - if ((randy < AS_MELEE)) - { - sound (self, CHAN_AUTO, "ambience/gunfire3.wav", 0.75, ATTN_NONE); - } - else - { - if ((randy < WEAPON_SPIKES)) - { - sound (self, CHAN_AUTO, "ambience/gunfire4.wav", 0.75, ATTN_NONE); - } - else - { - if ((randy < MULTICAST_PVS_R)) - { - sound (self, CHAN_AUTO, "ambience/gunfire5.wav", 0.75, ATTN_NONE); - } - else - { - if ((randy < TE_LIGHTNING2)) - { - sound (self, CHAN_AUTO, "ambience/gunfire6.wav", 0.75, ATTN_NONE); - } - else - { - sound (self, CHAN_AUTO, "ambience/gunfire7.wav", 0.75, ATTN_NONE); - } - } - } - } - } - } + if (te.health > 0) + pcount = pcount + 1; + if (te.health <= 0) + pdead = pdead + 1; + + te = find(te, classname, "player"); } - if (coop == 1) + if (pcount == 0 && pdead > 0) //everyone died { - x = 0; - y = 0; - te = find (world, classname, "player"); - - while (te) - { - if (te.health > 0 && te.ghost == 0) - x = x + 1; - - if (te.health < 0) - y = y + 1; - - te = find (te, classname, "player"); - } - - if (x == 0 && y > 0) - { - bprint (PRINT_MEDIUM, "*** PLAYERS SLAIN ***\n*** ROUND RESET ***"); + if (endgame_timer == 0) + bprint(2, "^4** ^bTHE PLAYERS WERE SLAIN^b **\n"); + if (endgame_timer == 1) + bprint(2, "^4** ^bTHIS AREA WILL RESTART^b **\n"); + if (endgame_timer == 7) + bprint(2, "^4** 3 **\n"); + if (endgame_timer == 8) + bprint(2, "^4** 2 **\n"); + if (endgame_timer == 9) + bprint(2, "^4** 1 **\n"); + if (endgame_timer == 10) localcmd("restart\n"); - return; - } - return; + sound (world, CHAN_BODY, "misc/menu3.wav", 1, ATTN_NONE); } - te = find (world, classname, "ighoul"); -/* - while (te) - { - if (te.enemy) - te.enemy = world; + if (pcount == 0 && pdead > 0) + endgame_timer = endgame_timer + 1; - te = find (te, classname, "ighoul"); - }*/ - - te = find (world, classname, "info"); - if ((te.attack == 1)) - { - CheckZombie1 (); - } - else - { - if ((te.attack == 2)) - { - CheckZombie2 (); - } - else - { - if ((te.hostage == 1)) - { - CheckHostage (); - } - else - { - if ((bombed >= 1)) - { - CheckDefuse (); - } - } - } - } - if (round_end == 2) - { - ReplacePlayers (0); - round_end = 1.9; - teamthatwon = MULTICAST_ALL; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - return; - } - if (((round_end <= 1.9) && (round_end >= 1.1))) - { - round_end = (round_end - 0.15); - te = find (world, classname, "player"); - while (te) - { - if ((te.currentmenu == "none")) - { - centerprint (te, "** press your b key to buy items **\n"); - } - te = find (te, classname, "player"); - } - if ((round_end < 1.1)) - { - round_end = WEAPON_SHOTGUN; - } - return; - } - if ((round_end == 1)) - { - te = find (world, classname, "player"); - - bprint (PRINT_MEDIUM, "** The next round has now started **\n"); - sound (self, CHAN_BODY, "radio/3_letsgo.wav", 0.6, ATTN_NONE); - gtimer = 180; - round_end = MULTICAST_ALL; - teamthatwon = MULTICAST_ALL; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - return; - } - if ((respawnvar == WEAPON_SHOTGUN)) - { - round_end = MULTICAST_ALL; - teamthatwon = MULTICAST_ALL; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - return; - } - - team1 = 0; - - te = find (world, classname, "player"); - while (te) - { - if (te.classname == "player" && te.team == 1 && te.ghost == 0) - team1 = (team1 + 1); - if (te.classname == "player" && te.team == 2 && te.ghost == 0) - team2 = (team2 + 1); - - te = find (te, classname, "player"); - } - - if (((((team1 == 0) && (team2 == 0)) && (team_red == 0)) && (team_blue == 0))) - { - gtimer = 180; - self.nextthink = (time + WEAPON_SPIKES); - self.think = GameControl; - round_end = 0; - teamthatwon = 0; - team_blue = 0; - team_red = 0; - return; - } - te = find (world, classname, "info"); - - if ((((team1 >= 1) && (team2 == 0)) && (team_red == 0)))//Only Rangers - { - gtimer = 180; - self.nextthink = (time + WEAPON_BIG); - self.think = GameControl; - round_end = MULTICAST_ALL; - teamthatwon = MULTICAST_ALL; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - return; - } - if ((((team1 == 0) && (team2 >= 1)) && (team_blue == 0)))//Only Raiders - { - gtimer = 180; - self.nextthink = (time + WEAPON_BIG); - self.think = GameControl; - round_end = MULTICAST_ALL; - teamthatwon = MULTICAST_ALL; - team_blue = MULTICAST_ALL; - team_red = MULTICAST_ALL; - return; - } - - if (((team1 >= 1) && (team2 >= 1))) - { - return; - } - if (((((team2 == 0) && (team1 >= 1)) && (team_red > 0)) && (bombed != 3))) - { - bprint (PRINT_MEDIUM, ">>> RANGERS WIN THE ROUND! <<<\n"); - team1win = (team1win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - - if (team1 == 0 && team2 >= 1) - { - bprint (PRINT_MEDIUM, ">>> RAIDERS WIN THE ROUND! <<<\n"); - team2win = (team2win + 1); - RoundReset (); - return; - } - end = 0; - if (((team_red == 0) && (team1 != 0))) - { - te = find (world, classname, "bot"); - while (te) - { - if (((te.team == WEAPON_ROCKET) && (te.health > 0))) - { - end = WEAPON_SHOTGUN; - } - te = find (te, classname, "bot"); - } - if (((end == 0) && (world.model != "maps/ag_wastes.bsp"))) - { - bprint (PRINT_MEDIUM, ">>> RANGERS WIN THE ROUND! <<<\n"); - team2win = (team2win + WEAPON_SHOTGUN); - RoundReset (); - return; - } - round_end = 0; - teamthatwon = 0; - return; - } - if (((team_blue == 0) && (team2 != 0))) - { - te = find (world, classname, "bot"); - while (te) - { - if (((te.team == WEAPON_SHOTGUN) && (te.health > 0))) - { - end = WEAPON_SHOTGUN; - } - te = find (te, classname, "bot"); - } - if (((end == 0) && (world.model != "maps/ag_wastes.bsp"))) - { - if (coop == 1) - { - bprint (PRINT_MEDIUM, ">>> RAIDERS WIN THE ROUND! <<<\n"); - team2win = (team2win + 1); - RoundReset (); - return; - } - if (coop == 1) - { - bprint (PRINT_MEDIUM, "*** PLAYERS SLAIN ***\n*** ROUND RESET ***"); - localcmd("restart\n"); - return; - } - } - round_end = 0; - teamthatwon = 0; - return; - } - if (((team1 == 0) && (team2 == 0))) - { - bprint (PRINT_MEDIUM, ">>> TEAM DRAW <<<\n"); - RoundReset (); - return; - } -}; - -void () VoteBoy = -{ - local entity te; - - self.nextthink = (time + DRAW2); - self.think = VoteBoy; - if ((mode == 0)) - { - mode = AS_MELEE; - } - if ((ff == 0)) - { - ff = 0; - } - if ((self.vote_time > time)) - { - return; - } - if ((self.vote_on == 0)) - { - return; - } - if ((self.vote_on == WEAPON_ROCKET)) - { - self.vote_on = 0; - return; - } - te = find (world, classname, "player"); - self.vote_num = 0; - while (te) - { - if (((te.classname == "player") && (te.ghost == 0))) - { - self.vote_num = (self.vote_num + WEAPON_SHOTGUN); - } - te = find (te, classname, "player"); - } - bprint (PRINT_MEDIUM, "** VOTE COMPLETED **\n"); - if ((self.vote_type == WEAPON_ROCKET)) - { - if ((self.vote1 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** HEADSHOTS ARE IN! **\n"); - headshot = 0; - } - else - { - if ((self.vote2 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** HEADSHOTS ARE OUT! **\n"); - headshot = WEAPON_SHOTGUN; - } - else - { - bprint (PRINT_MEDIUM, "** Not enough votes to switch **\n"); - } - } - } - if ((self.vote_type == WEAPON_SPIKES)) - { - if ((self.vote1 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** QUAKE MODE **\n"); - ReplacePlayers (0); - respawnvar = 1; - } - else - { - if ((self.vote2 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** CS MODE **\n"); - ReplacePlayers (0); - respawnvar = 0; - } - else - { - bprint (PRINT_MEDIUM, "** Not enough votes to switch **\n"); - } - } - } - if ((self.vote_type == WEAPON_SHOTGUN)) - { - if ((self.vote1 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** FF IS NOW OFF **\n"); - ff = 0; - } - else - { - if ((self.vote2 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** FF IS NOW ON **\n"); - ff = WEAPON_SHOTGUN; - } - else - { - bprint (PRINT_MEDIUM, "** Not enough votes to switch **\n"); - } - } - } - if ((self.vote_type == AS_MELEE)) - { - if ((self.vote6 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** CURRENT MAP WILL STAY **\n"); - } - else - { - if ((self.vote1 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("speedrun"); - } - else - { - if ((self.vote2 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("ag_town"); - } - else - { - if ((self.vote3 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("ag_kahn"); - } - else - { - if ((self.vote4 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("tanker"); - } - else - { - if ((self.vote5 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("ag_wastes"); - } - else - { - if ((self.vote6 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("ag_vault"); - } - else - { - if ((self.vote7 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** MAP WILL NOW SWITCH **\n"); - changelevel ("de_dust2"); - } - else - { - bprint (PRINT_MEDIUM, "** Not enough votes to switch **\n"); - } - } - } - } - } - } - } - } - } - if ((self.vote_type == MULTICAST_PVS_R)) - { - if ((self.vote1 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** WIMPY MODE **\n"); - z_skill = 0; - } - else - { - if ((self.vote2 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** AVERAGE MODE **\n"); - z_skill = WEAPON_SHOTGUN; - } - else - { - if ((self.vote3 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** SUPER ZOMBIE MODE **\n"); - z_skill = WEAPON_ROCKET; - } - else - { - if ((self.vote4 >= (self.vote_num * 0.5))) - { - bprint (PRINT_MEDIUM, "** NIGHT OF TEH FRIGG'N LIVING DEAD, RUN FER UR LIVES U FOOLS **\n"); - z_skill = AS_MELEE; - } - else - { - bprint (PRINT_MEDIUM, "** Not enough votes to switch **\n"); - } - } - } - } - } - self.vote_on = WEAPON_ROCKET; - self.vote_num = 0; - self.vote1 = 0; - self.vote2 = 0; - self.vote3 = 0; - self.vote4 = 0; - self.vote5 = 0; - self.vote6 = 0; - self.vote7 = 0; - self.vote8 = 0; + self.think = GameControl; + self.nextthink = time + 1; }; void () GameTimer =