- Code: Select all
void() egg_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 found me. "); 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() egg_setsounds ={ if (world.worldtype == 0) { precache_sound ("misc/egg1.wav"); self.noise = "misc/egg2.wav"; } if (world.worldtype == 1) { precache_sound ("misc/egg3.wav"); self.noise = "misc/egg4.wav"; } if (world.worldtype == 2) { precache_sound2 ("misc/egg5.wav"); self.noise = "misc/egg6.wav"; }
};
//egg1
void() item_egg1 ={ if (world.worldtype == 0) { precache_model ("misc/egg.md3"); setmodel (self, "misc/egg.md3"); self.netname = "egg1"; } else if (world.worldtype == 1) { precache_model ("misc/egg.md3"); setmodel (self, "misc/egg.md3"); self.netname = "egg1"; } else if (world.worldtype == 2) { precache_model2 ("misc/egg.md3"); setmodel (self, "misc/egg.md3"); self.netname = "egg1"; } egg_setsounds(); self.touch = egg_touch; self.items = IT_EGG1; setsize (self, '-16 -16 -24', '16 16 32'); StartItem ();};