/* trigger quickc program by jim dose' 12/2/96 copyright (c)1996 hipnotic interactive, inc. all rights reserved. do not distribute. */ float use_gold_key = 1; void() keytrigger_use = { if (activator.classname != "player") return; if (self.attack_finished > time) return; self.attack_finished = time + 2; // fixme: blink key on player's status bar if ( (self.items & activator.items) != self.items ) { if (self.message != "") { centerprint (activator, self.message); } else { if (self.owner.items == it_key1) { if (world.worldtype == 2) { centerprint (activator, "you need the silver keycard"); } else if (world.worldtype == 1) { centerprint (activator, "you need the silver runekey"); } else if (world.worldtype == 0) { centerprint (activator, "you need the silver key"); } } else { if (world.worldtype == 2) { centerprint (activator, "you need the gold keycard"); } else if (world.worldtype == 1) { centerprint (activator, "you need the gold runekey"); } else if (world.worldtype == 0) { centerprint (activator, "you need the gold key"); } } } sound (self, chan_voice, self.noise3, 1, attn_norm); return; } activator.items = activator.items - self.items; // we can't just remove (self) here, because this is a touch function // called while c code is looping through area links... self.touch = sub_null; self.use = sub_null; self.nextthink = time + 0.1; self.think = sub_remove; self.message = ""; sound (self, chan_voice, self.noise4, 1, attn_norm); sub_usetargets(); }; void() keytrigger_touch = { activator = other; keytrigger_use(); }; /*quaked trigger_usekey (0 .5 0) ? use_gold_key variable sized single use trigger that requires a key to trigger targets. must be targeted at one or more entities. "message" is printed when the trigger is touched without having the right key. */ void() trigger_usekey = { if (world.worldtype == 0) { precache_sound ("doors/medtry.wav"); precache_sound ("doors/meduse.wav"); self.noise3 = "doors/medtry.wav"; self.noise4 = "doors/meduse.wav"; } else if (world.worldtype == 1) { precache_sound ("doors/runetry.wav"); precache_sound ("doors/runeuse.wav"); self.noise3 = "doors/runetry.wav"; self.noise4 = "doors/runeuse.wav"; } else if (world.worldtype == 2) { precache_sound ("doors/basetry.wav"); precache_sound ("doors/baseuse.wav"); self.noise3 = "doors/basetry.wav"; self.noise4 = "doors/baseuse.wav"; } else { dprint ("no worldtype set!\n"); } if (self.spawnflags & use_gold_key) self.items = it_key2; else self.items = it_key1; self.use = keytrigger_use; self.touch = keytrigger_touch; inittrigger (); }; void() remove_touch = { if (other.flags & self.cnt) return; other.touch = sub_null; other.model = ""; remove(self); // other.nextthink = time + 0.1; // other.think = sub_remove; }; /*quaked trigger_remove (.5 .5 .5) ? ignoremonsters ignoreplayers variable sized trigger that removes the thing that touches it. does not affect monsters or players. */ void() trigger_remove = { self.cnt = fl_client|fl_monster; if (self.spawnflags & 1) self.cnt = self.cnt - fl_monster; if (self.spawnflags & 2) self.cnt = self.cnt - fl_client; inittrigger (); self.touch = remove_touch; }; /* ============================================================================== trigger_setgravity ============================================================================== */ void() trigger_gravity_touch = { if (other.classname != "player") return; if (self.gravity == -1) other.gravity = 1.0; else other.gravity = self.gravity; }; /*quaked trigger_setgravity (.5 .5 .5) ? set the gravity of a player "gravity" what to set the players gravity to - 0 (default) normal gravity - 1 no gravity - 2 almost no gravity - ... - 101 normal gravity - 102 slightly higher gravity - ... - 1000 very high gravity */ void() trigger_setgravity = { inittrigger (); self.touch = trigger_gravity_touch; if (!self.gravity) { self.gravity = -1; } else { self.gravity = ((self.gravity - 1) / 100); } }; void() trigger_command_use = { if ( self.message ) localcmd( self.message ); }; /*quaked trigger_command (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) when triggered, stuffs a command into the console to allow map designers to set server variables. "message" is the command to send to the console. */ void() trigger_command = { self.use = oncount_use; self.think = sub_null; }; void() trigger_decoy_touch = { if (other.classname != "monster_decoy") return; self.touch = sub_null; self.nextthink = time + 0.1; self.think = sub_remove; sub_usetargets(); }; /*quaked trigger_decoy_use (.5 .5 .5) ? only the decoy player can trigger this once triggers, all targets are used */ void() trigger_decoy_use = { if (deathmatch) { remove(self); return; } inittrigger (); self.touch = trigger_decoy_touch; }; void() trigger_waterfall_touch = { // only affect players if (!(other.flags & fl_client)) { return; } other.velocity = other.velocity + self.movedir; other.velocity_x = other.velocity_x + self.count * ( random() - 0.5 ); other.velocity_y = other.velocity_y + self.count * ( random() - 0.5 ); }; /*quaked trigger_waterfall (.2 .5 .2) ? pushes the player in the direction specified by angles. "speed" is the strength of the push (default 50). "count" amount of random xy movement to add to velocity (default 100). */ void() trigger_waterfall = { inittrigger (); self.touch = trigger_waterfall_touch; if ( self.count == 0 ) { self.count = 100; } if ( self.speed == 0 ) { self.movedir = self.movedir * 50; } else { self.movedir = self.movedir * self.speed; } };