void() w_setcurrentammo; /* all lights should be 0 1 0 in color all other items should be .8 .3 .4 in color */ void() sub_regen = { self.model = self.mdl; // restore original model self.solid = solid_trigger; // allow it to be touched again sound (self, chan_voice, "items/itembk2.wav", 1, attn_norm); // play respawn sound setorigin (self, self.origin); }; /*quaked noclass (0 0 0) (-8 -8 -8) (8 8 8) prints a warning message when spawned */ void() noclass = { dprint ("noclass spawned at"); dprint (vtos(self.origin)); dprint ("\n"); remove (self); }; /* ============ placeitem plants the object on the floor ============ */ void() placeitem = { local float oldz; self.mdl = self.model; // so it can be restored on respawn self.flags = fl_item; // make extra wide self.solid = solid_trigger; self.movetype = movetype_toss; self.velocity = '0 0 0'; self.origin_z = self.origin_z + 6; oldz = self.origin_z; if (!droptofloor()) { dprint ("bonus item fell out of level at "); dprint (vtos(self.origin)); dprint ("\n"); remove(self); return; } }; /* ============ startitem sets the clipping size and plants the object on the floor ============ */ void() startitem = { self.nextthink = time + 0.2; // items start after other solids self.think = placeitem; }; /* ========================================================================= health box ========================================================================= */ // // t_heal: add health to an entity, limiting health to max_health // "ignore" will ignore max_health limit // float (entity e, float healamount, float ignore) t_heal = { if (e.health <= 0) return 0; if ((!ignore) && (e.health >= other.max_health)) return 0; healamount = ceil(healamount); e.health = e.health + healamount; if ((!ignore) && (e.health >= other.max_health)) e.health = other.max_health; if (e.health > 250) e.health = 250; return 1; }; /*quaked item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth health box. normally gives 25 points. rotten box heals 5-10 points, megahealth will add 100 health, then rot you down to your maximum health limit, one point per second. */ float h_rotten = 1; float h_mega = 2; .float healamount, healtype; void() health_touch; void() item_megahealth_rot; void() item_health = { self.touch = health_touch; if (self.spawnflags & h_rotten) { precache_model("maps/b_bh10.bsp"); precache_sound("items/r_item1.wav"); setmodel(self, "maps/b_bh10.bsp"); self.noise = "items/r_item1.wav"; self.healamount = 15; self.healtype = 0; } else if (self.spawnflags & h_mega) { precache_model("maps/b_bh100.bsp"); precache_sound("items/r_item2.wav"); setmodel(self, "maps/b_bh100.bsp"); self.noise = "items/r_item2.wav"; self.healamount = 100; self.healtype = 2; } else { precache_model("maps/b_bh25.bsp"); precache_sound("items/health1.wav"); setmodel(self, "maps/b_bh25.bsp"); self.noise = "items/health1.wav"; self.healamount = 25; self.healtype = 1; } setsize (self, '0 0 0', '32 32 56'); startitem (); }; void() health_touch = { local float amount; local string s; if (other.classname != "player") return; if (self.healtype == 2) // megahealth? ignore max_health... { if (other.health >= 250) return; if (!t_heal(other, self.healamount, 1)) return; } else { if (!t_heal(other, self.healamount, 0)) return; } sprint(other, "you receive "); s = ftos(self.healamount); sprint(other, s); sprint(other, " health\n"); // health touch sound sound(other, chan_item, self.noise, 1, attn_norm); stuffcmd (other, "bf\n"); self.model = string_null; self.solid = solid_not; // megahealth = rot down the player's super health if (self.healtype == 2) { // 11/02/96 removed superhealth from defs.qc // other.items = other.items | it_superhealth; self.nextthink = time + 5; self.think = item_megahealth_rot; self.owner = other; } else { if (deathmatch != 2) // deathmatch 2 is the silly old rules { if (deathmatch) self.nextthink = time + 20; self.think = sub_regen; } } activator = other; sub_usetargets(); // fire all targets / killtargets }; void() item_megahealth_rot = { other = self.owner; if (other.health > other.max_health) { other.health = other.health - 1; self.nextthink = time + 1; return; } // it is possible for a player to die and respawn between rots, so don't // just blindly subtract the flag off // med 11/02/96 removed superhealth // other.items = other.items - (other.items & it_superhealth); if (deathmatch == 1) // deathmatch 2 is silly old rules { self.nextthink = time + 20; self.think = sub_regen; } }; /* =============================================================================== armor =============================================================================== */ void() armor_touch; void() armor_touch = { local float type, value, bit; if (other.health <= 0) return; if (other.classname != "player") return; if (self.classname == "item_armor1") { type = 0.3; value = 100; bit = it_armor1; } if (self.classname == "item_armor2") { type = 0.6; value = 150; bit = it_armor2; } if (self.classname == "item_armorinv") { type = 0.8; value = 200; bit = it_armor3; } if (other.armortype*other.armorvalue >= type*value) return; other.armortype = type; other.armorvalue = value; other.items = other.items - (other.items & (it_armor1 | it_armor2 | it_armor3)) + bit; self.solid = solid_not; self.model = string_null; if (deathmatch == 1) self.nextthink = time + 20; self.think = sub_regen; sprint(other, "you got armor\n"); // armor touch sound sound(other, chan_item, "items/armor1.wav", 1, attn_norm); stuffcmd (other, "bf\n"); activator = other; sub_usetargets(); // fire all targets / killtargets }; /*quaked item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32) */ void() item_armor1 = { self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 0; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32) */ void() item_armor2 = { self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 1; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked item_armorinv (0 .5 .8) (-16 -16 0) (16 16 32) */ void() item_armorinv = { self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 2; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /* =============================================================================== weapons =============================================================================== */ void() bound_other_ammo = { if (other.ammo_shells > 100) other.ammo_shells = 100; if (other.ammo_nails > 200) other.ammo_nails = 200; if (other.ammo_rockets > 100) other.ammo_rockets = 100; if (other.ammo_cells > 100) other.ammo_cells = 100; }; //med 01/06/97 added hipnotic weapons into rankings float(float w) rankforweapon = { if (w == it_lightning) return 1; if (w == it_rocket_launcher) return 2; if (w == it_laser_cannon) return 3; if (w == it_super_nailgun) return 4; if (w == it_proximity_gun) return 5; if (w == it_grenade_launcher) return 6; if (w == it_super_shotgun) return 7; if (w == it_nailgun) return 8; if (w == it_mjolnir) return 9; return 10; }; /* ============= deathmatch_weapon deathmatch weapon change rules for picking up a weapon .float ammo_shells, ammo_nails, ammo_rockets, ammo_cells; ============= */ void(float old, float new) deathmatch_weapon = { local float or, nr; // change self.weapon if desired or = rankforweapon (self.weapon); nr = rankforweapon (new); if ( nr < or ) self.weapon = new; }; /* ============= weapon_touch ============= */ float() w_bestweapon; void() weapon_touch = { local float hadammo, best, new, old; local entity stemp; local float leave; if (!(other.flags & fl_client)) return; // if the player was using his best weapon, change up to the new one if better stemp = self; self = other; best = w_bestweapon(); self = stemp; if (deathmatch == 2 || coop) leave = 1; else leave = 0; if (self.classname == "weapon_nailgun") { if (leave && (other.items & it_nailgun) ) return; hadammo = other.ammo_nails; new = it_nailgun; other.ammo_nails = other.ammo_nails + 30; } else if (self.classname == "weapon_supernailgun") { if (leave && (other.items & it_super_nailgun) ) return; hadammo = other.ammo_rockets; new = it_super_nailgun; other.ammo_nails = other.ammo_nails + 30; } else if (self.classname == "weapon_supershotgun") { if (leave && (other.items & it_super_shotgun) ) return; hadammo = other.ammo_rockets; new = it_super_shotgun; other.ammo_shells = other.ammo_shells + 5; } else if (self.classname == "weapon_rocketlauncher") { if (leave && (other.items & it_rocket_launcher) ) return; hadammo = other.ammo_rockets; new = it_rocket_launcher; other.ammo_rockets = other.ammo_rockets + 5; } else if (self.classname == "weapon_grenadelauncher") { if (leave && (other.items & it_grenade_launcher) ) return; hadammo = other.ammo_rockets; new = it_grenade_launcher; other.ammo_rockets = other.ammo_rockets + 5; } else if (self.classname == "weapon_lightning") { if (leave && (other.items & it_lightning) ) return; hadammo = other.ammo_rockets; new = it_lightning; other.ammo_cells = other.ammo_cells + 15; } //med else if (self.classname == "weapon_laser_gun") { if (leave && (other.items & it_laser_cannon) ) return; hadammo = other.ammo_rockets; new = it_laser_cannon; other.ammo_cells = other.ammo_cells + 30; } //med else if (self.classname == "weapon_mjolnir") { if (leave && (other.items & it_mjolnir) ) return; hadammo = other.ammo_rockets; new = it_mjolnir; other.ammo_cells = other.ammo_cells + 30; } //med else if (self.classname == "weapon_proximity_gun") { if (leave && (other.items & it_proximity_gun) ) return; hadammo = other.ammo_rockets; new = it_proximity_gun; other.ammo_rockets = other.ammo_rockets + 6; } else objerror ("weapon_touch: unknown classname"); sprint (other, "you got the "); sprint (other, self.netname); sprint (other, "\n"); // weapon touch sound sound (other, chan_item, "weapons/pkup.wav", 1, attn_norm); stuffcmd (other, "bf\n"); bound_other_ammo (); // change to the weapon old = other.items; other.items = other.items | new; stemp = self; self = other; if (!deathmatch) self.weapon = new; else deathmatch_weapon (old, new); w_setcurrentammo(); self = stemp; if (leave) return; // remove it in single player, or setup for respawning in deathmatch self.model = string_null; self.solid = solid_not; if (deathmatch == 1) self.nextthink = time + 30; self.think = sub_regen; activator = other; sub_usetargets(); // fire all targets / killtargets }; /*quaked weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_supershotgun = { precache_model ("progs/g_shot.mdl"); setmodel (self, "progs/g_shot.mdl"); self.weapon = it_super_shotgun; self.netname = "double-barrelled shotgun"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_nailgun = { precache_model ("progs/g_nail.mdl"); setmodel (self, "progs/g_nail.mdl"); self.weapon = it_nailgun; self.netname = "nailgun"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_supernailgun = { precache_model ("progs/g_nail2.mdl"); setmodel (self, "progs/g_nail2.mdl"); self.weapon = it_super_nailgun; self.netname = "super nailgun"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_grenadelauncher = { precache_model ("progs/g_rock.mdl"); setmodel (self, "progs/g_rock.mdl"); self.weapon = 3; self.netname = "grenade launcher"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_rocketlauncher = { precache_model ("progs/g_rock2.mdl"); setmodel (self, "progs/g_rock2.mdl"); self.weapon = 3; self.netname = "rocket launcher"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /*quaked weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) */ void() weapon_lightning = { precache_model ("progs/g_light.mdl"); setmodel (self, "progs/g_light.mdl"); self.weapon = 3; self.netname = "thunderbolt"; self.touch = weapon_touch; setsize (self, '-16 -16 0', '16 16 56'); startitem (); }; /* =============================================================================== ammo =============================================================================== */ void() ammo_touch = { local entity stemp; local float best; if (other.classname != "player") return; if (other.health <= 0) return; // if the player was using his best weapon, change up to the new one if better stemp = self; self = other; best = w_bestweapon(); self = stemp; // shotgun if (self.weapon == 1) { if (other.ammo_shells >= 100) return; other.ammo_shells = other.ammo_shells + self.aflag; } // spikes if (self.weapon == 2) { if (other.ammo_nails >= 200) return; other.ammo_nails = other.ammo_nails + self.aflag; } // rockets if (self.weapon == 3) { if (other.ammo_rockets >= 100) return; other.ammo_rockets = other.ammo_rockets + self.aflag; } // cells if (self.weapon == 4) { if (other.ammo_cells >= 100) return; other.ammo_cells = other.ammo_cells + self.aflag; } bound_other_ammo (); sprint (other, "you got the "); sprint (other, self.netname); sprint (other, "\n"); // ammo touch sound sound (other, chan_item, "weapons/lock4.wav", 1, attn_norm); stuffcmd (other, "bf\n"); // change to a better weapon if appropriate if ( other.weapon == best ) { stemp = self; self = other; self.weapon = w_bestweapon(); w_setcurrentammo (); self = stemp; } // if changed current ammo, update it stemp = self; self = other; w_setcurrentammo(); self = stemp; // remove it in single player, or setup for respawning in deathmatch self.model = string_null; self.solid = solid_not; if (deathmatch == 1) self.nextthink = time + 30; self.think = sub_regen; activator = other; sub_usetargets(); // fire all targets / killtargets }; float weapon_big2 = 1; /*quaked item_shells (0 .5 .8) (0 0 0) (32 32 32) big */ void() item_shells = { self.touch = ammo_touch; if (self.spawnflags & weapon_big2) { precache_model ("maps/b_shell1.bsp"); setmodel (self, "maps/b_shell1.bsp"); self.aflag = 40; } else { precache_model ("maps/b_shell0.bsp"); setmodel (self, "maps/b_shell0.bsp"); self.aflag = 20; } self.weapon = 1; self.netname = "shells"; setsize (self, '0 0 0', '32 32 56'); startitem (); }; /*quaked item_spikes (0 .5 .8) (0 0 0) (32 32 32) big */ void() item_spikes = { self.touch = ammo_touch; if (self.spawnflags & weapon_big2) { precache_model ("maps/b_nail1.bsp"); setmodel (self, "maps/b_nail1.bsp"); self.aflag = 50; } else { precache_model ("maps/b_nail0.bsp"); setmodel (self, "maps/b_nail0.bsp"); self.aflag = 25; } self.weapon = 2; self.netname = "nails"; setsize (self, '0 0 0', '32 32 56'); startitem (); }; /*quaked item_rockets (0 .5 .8) (0 0 0) (32 32 32) big */ void() item_rockets = { self.touch = ammo_touch; if (self.spawnflags & weapon_big2) { precache_model ("maps/b_rock1.bsp"); setmodel (self, "maps/b_rock1.bsp"); self.aflag = 10; } else { precache_model ("maps/b_rock0.bsp"); setmodel (self, "maps/b_rock0.bsp"); self.aflag = 5; } self.weapon = 3; self.netname = "rockets"; setsize (self, '0 0 0', '32 32 56'); startitem (); }; /*quaked item_cells (0 .5 .8) (0 0 0) (32 32 32) big */ void() item_cells = { self.touch = ammo_touch; if (self.spawnflags & weapon_big2) { precache_model ("maps/b_batt1.bsp"); setmodel (self, "maps/b_batt1.bsp"); self.aflag = 12; } else { precache_model ("maps/b_batt0.bsp"); setmodel (self, "maps/b_batt0.bsp"); self.aflag = 6; } self.weapon = 4; self.netname = "cells"; setsize (self, '0 0 0', '32 32 56'); startitem (); }; /*quaked item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big do not use this!!!! it will be removed! */ float weapon_shotgun = 1; float weapon_rocket = 2; float weapon_spikes = 4; float weapon_big = 8; void() item_weapon = { self.touch = ammo_touch; if (self.spawnflags & weapon_shotgun) { if (self.spawnflags & weapon_big) { precache_model ("maps/b_shell1.bsp"); setmodel (self, "maps/b_shell1.bsp"); self.aflag = 40; } else { precache_model ("maps/b_shell0.bsp"); setmodel (self, "maps/b_shell0.bsp"); self.aflag = 20; } self.weapon = 1; self.netname = "shells"; } if (self.spawnflags & weapon_spikes) { if (self.spawnflags & weapon_big) { precache_model ("maps/b_nail1.bsp"); setmodel (self, "maps/b_nail1.bsp"); self.aflag = 40; } else { precache_model ("maps/b_nail0.bsp"); setmodel (self, "maps/b_nail0.bsp"); self.aflag = 20; } self.weapon = 2; self.netname = "spikes"; } if (self.spawnflags & weapon_rocket) { if (self.spawnflags & weapon_big) { precache_model ("maps/b_rock1.bsp"); setmodel (self, "maps/b_rock1.bsp"); self.aflag = 10; } else { precache_model ("maps/b_rock0.bsp"); setmodel (self, "maps/b_rock0.bsp"); self.aflag = 5; } self.weapon = 3; self.netname = "rockets"; } setsize (self, '0 0 0', '32 32 56'); startitem (); }; /* =============================================================================== keys =============================================================================== */ void() key_touch = { local entity stemp; local float best; if (other.classname != "player") return; if (other.health <= 0) return; if (other.items & self.items) return; sprint (other, "you got the "); sprint (other, self.netname); sprint (other,"\n"); sound (other, chan_item, self.noise, 1, attn_norm); stuffcmd (other, "bf\n"); other.items = other.items | self.items; if (!coop) { self.solid = solid_not; self.model = string_null; } activator = other; sub_usetargets(); // fire all targets / killtargets }; void() key_setsounds = { if (world.worldtype == 0) { precache_sound ("misc/medkey.wav"); self.noise = "misc/medkey.wav"; } if (world.worldtype == 1) { precache_sound ("misc/runekey.wav"); self.noise = "misc/runekey.wav"; } if (world.worldtype == 2) { precache_sound2 ("misc/basekey.wav"); self.noise = "misc/basekey.wav"; } }; /*quaked item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) silver key in order for keys to work you must set your maps worldtype to one of the following: 0: medieval 1: metal 2: base */ void() item_key1 = { if (world.worldtype == 0) { precache_model ("progs/w_s_key.mdl"); setmodel (self, "progs/w_s_key.mdl"); self.netname = "silver key"; } else if (world.worldtype == 1) { precache_model ("progs/m_s_key.mdl"); setmodel (self, "progs/m_s_key.mdl"); self.netname = "silver runekey"; } else if (world.worldtype == 2) { precache_model2 ("progs/b_s_key.mdl"); setmodel (self, "progs/b_s_key.mdl"); self.netname = "silver keycard"; } key_setsounds(); self.touch = key_touch; self.items = it_key1; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /*quaked item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) gold key in order for keys to work you must set your maps worldtype to one of the following: 0: medieval 1: metal 2: base */ void() item_key2 = { if (world.worldtype == 0) { precache_model ("progs/w_g_key.mdl"); setmodel (self, "progs/w_g_key.mdl"); self.netname = "gold key"; } if (world.worldtype == 1) { precache_model ("progs/m_g_key.mdl"); setmodel (self, "progs/m_g_key.mdl"); self.netname = "gold runekey"; } if (world.worldtype == 2) { precache_model2 ("progs/b_g_key.mdl"); setmodel (self, "progs/b_g_key.mdl"); self.netname = "gold keycard"; } key_setsounds(); self.touch = key_touch; self.items = it_key2; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /* =============================================================================== end of level runes =============================================================================== */ void() sigil_touch = { local entity stemp; local float best; if (other.classname != "player") return; if (other.health <= 0) return; centerprint (other, "you got the rune!"); sound (other, chan_item, self.noise, 1, attn_norm); stuffcmd (other, "bf\n"); self.solid = solid_not; self.model = string_null; serverflags = serverflags | (self.spawnflags & 15); self.classname = ""; // so rune doors won't find it activator = other; sub_usetargets(); // fire all targets / killtargets }; /*quaked item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) e1 e2 e3 e4 end of level sigil, pick up to end episode and return to jrstart. */ void() item_sigil = { if (!self.spawnflags) objerror ("no spawnflags"); precache_sound ("misc/runekey.wav"); self.noise = "misc/runekey.wav"; if (self.spawnflags & 1) { precache_model ("progs/end1.mdl"); setmodel (self, "progs/end1.mdl"); } if (self.spawnflags & 2) { precache_model2 ("progs/end2.mdl"); setmodel (self, "progs/end2.mdl"); } if (self.spawnflags & 4) { precache_model2 ("progs/end3.mdl"); setmodel (self, "progs/end3.mdl"); } if (self.spawnflags & 8) { precache_model2 ("progs/end4.mdl"); setmodel (self, "progs/end4.mdl"); } self.touch = sigil_touch; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /* =============================================================================== powerups =============================================================================== */ void() powerup_touch; void() powerup_touch = { local entity stemp; local float best; if (other.classname != "player") return; if (other.health <= 0) return; sprint (other, "you got the "); sprint (other, self.netname); sprint (other,"\n"); if (deathmatch) { self.mdl = self.model; if ((self.classname == "item_artifact_invulnerability") || (self.classname == "item_artifact_invisibility")) self.nextthink = time + 60*5; else self.nextthink = time + 60; self.think = sub_regen; } sound (other, chan_voice, self.noise, 1, attn_norm); stuffcmd (other, "bf\n"); self.solid = solid_not; other.items = other.items | self.items; self.model = string_null; // do the apropriate action if (self.classname == "item_artifact_envirosuit") { other.rad_time = 1; other.radsuit_finished = time + 30; } if (self.classname == "item_artifact_invulnerability") { other.invincible_time = 1; other.invincible_finished = time + 30; } if (self.classname == "item_artifact_invisibility") { other.invisible_time = 1; other.invisible_finished = time + 30; } if (self.classname == "item_artifact_super_damage") { other.super_time = 1; other.super_damage_finished = time + 30; } activator = other; sub_usetargets(); // fire all targets / killtargets }; /*quaked item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) player is invulnerable for 30 seconds */ void() item_artifact_invulnerability = { self.touch = powerup_touch; precache_model ("progs/invulner.mdl"); precache_sound ("items/protect.wav"); precache_sound ("items/protect2.wav"); precache_sound ("items/protect3.wav"); self.noise = "items/protect.wav"; setmodel (self, "progs/invulner.mdl"); self.netname = "pentagram of protection"; self.items = it_invulnerability; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /*quaked item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32) player takes no damage from water or slime for 30 seconds */ void() item_artifact_envirosuit = { self.touch = powerup_touch; precache_model ("progs/suit.mdl"); precache_sound ("items/suit.wav"); precache_sound ("items/suit2.wav"); self.noise = "items/suit.wav"; setmodel (self, "progs/suit.mdl"); self.netname = "biosuit"; self.items = it_suit; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /*quaked item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) player is invisible for 30 seconds */ void() item_artifact_invisibility = { self.touch = powerup_touch; precache_model ("progs/invisibl.mdl"); precache_sound ("items/inv1.wav"); precache_sound ("items/inv2.wav"); precache_sound ("items/inv3.wav"); self.noise = "items/inv1.wav"; setmodel (self, "progs/invisibl.mdl"); self.netname = "ring of shadows"; self.items = it_invisibility; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /*quaked item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32) the next attack from the player will do 4x damage */ void() item_artifact_super_damage = { self.touch = powerup_touch; precache_model ("progs/quaddama.mdl"); precache_sound ("items/damage.wav"); precache_sound ("items/damage2.wav"); precache_sound ("items/damage3.wav"); self.noise = "items/damage.wav"; setmodel (self, "progs/quaddama.mdl"); self.netname = "quad damage"; self.items = it_quad; setsize (self, '-16 -16 -24', '16 16 32'); startitem (); }; /* =============================================================================== player backpacks =============================================================================== */ void() backpacktouch = { local string s; local float best, old, new; local entity stemp; local float acount; if (other.classname != "player") return; if (other.health <= 0) return; acount = 0; sprint (other, "you get "); if (self.items) { if ((other.items & self.items) == 0) { acount = 1; sprint (other, "the "); sprint (other, self.netname); } } // if the player was using his best weapon, change up to the new one if better stemp = self; self = other; best = w_bestweapon(); self = stemp; // change weapons other.ammo_shells = other.ammo_shells + self.ammo_shells; other.ammo_nails = other.ammo_nails + self.ammo_nails; other.ammo_rockets = other.ammo_rockets + self.ammo_rockets; other.ammo_cells = other.ammo_cells + self.ammo_cells; new = self.items; if (!new) new = other.weapon; old = other.items; other.items = other.items | new; bound_other_ammo (); if (self.ammo_shells) { if (acount) sprint(other, ", "); acount = 1; s = ftos(self.ammo_shells); sprint (other, s); sprint (other, " shells"); } if (self.ammo_nails) { if (acount) sprint(other, ", "); acount = 1; s = ftos(self.ammo_nails); sprint (other, s); sprint (other, " nails"); } if (self.ammo_rockets) { if (acount) sprint(other, ", "); acount = 1; s = ftos(self.ammo_rockets); sprint (other, s); sprint (other, " rockets"); } if (self.ammo_cells) { if (acount) sprint(other, ", "); acount = 1; s = ftos(self.ammo_cells); sprint (other, s); sprint (other, " cells"); } sprint (other, "\n"); // backpack touch sound sound (other, chan_item, "weapons/lock4.wav", 1, attn_norm); stuffcmd (other, "bf\n"); // remove the backpack, change self to the player remove(self); self = other; // change to the weapon if (!deathmatch) self.weapon = new; else deathmatch_weapon (old, new); w_setcurrentammo (); }; /* =============== dropbackpack =============== */ void() dropbackpack = { local entity item; if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells)) return; // nothing in it item = spawn(); item.origin = self.origin - '0 0 24'; item.items = self.weapon; if (item.items == it_axe) item.netname = "axe"; else if (item.items == it_shotgun) item.netname = "shotgun"; else if (item.items == it_super_shotgun) item.netname = "double-barrelled shotgun"; else if (item.items == it_nailgun) item.netname = "nailgun"; else if (item.items == it_super_nailgun) item.netname = "super nailgun"; else if (item.items == it_grenade_launcher) item.netname = "grenade launcher"; else if (item.items == it_rocket_launcher) item.netname = "rocket launcher"; else if (item.items == it_lightning) item.netname = "thunderbolt"; else if (item.items == it_laser_cannon) item.netname = "laser cannon"; else if (item.items == it_proximity_gun) item.netname = "proximity gun"; else if (item.items == it_mjolnir) item.netname = "mjolnir"; else item.netname = ""; item.ammo_shells = self.ammo_shells; item.ammo_nails = self.ammo_nails; item.ammo_rockets = self.ammo_rockets; item.ammo_cells = self.ammo_cells; item.velocity_z = 300; item.velocity_x = -100 + (random() * 200); item.velocity_y = -100 + (random() * 200); item.flags = fl_item; item.solid = solid_trigger; item.movetype = movetype_toss; setmodel (item, "progs/backpack.mdl"); setsize (item, '-16 -16 0', '16 16 56'); item.touch = backpacktouch; item.nextthink = time + 120; // remove after 2 minutes item.think = sub_remove; };