I'm excited.
I'm excited because these tutorials are getting really cool. This time we're going to add a new deathmatch mode to the Tutor Bot, which I call Predator Mode. You can rename it, if you like
In this mode, everyone is invisible. Well, more specifically, you and the bots play as eyeballs, which are quite hard to see and more than a little spooky.
You really have to creep around slowly, keeping your, eh, eyes open, making sure those bots don't prey on you before you prey on them. That's Predator Mode.
This lesson is very simple. All we'll be doing is setting everyone's model to the eyes, and then making the bot's aiming a little worse, since he won't see you as well.
First, scroll down to respawn_bot() until you see this:
// making him normal again setmodel(self, "progs/player.mdl");Then, replace that little bit with this:
// making him normal again if (cvar("deathmatch") == 3) setmodel(self, "progs/eyes.mdl"); else setmodel(self, "progs/player.mdl");Next, go down a bit further to create_bot(), where this will appear:
// defining his animation setmodel(bot, "progs/player.mdl");Just like before, we'll replace that bit with this:
// defining his animation if (cvar("deathmatch") == 3) setmodel(bot, "progs/eyes.mdl"); else setmodel(bot, "progs/player.mdl");Okay, very simple stuff. Now, if you bring the Quake console down, type "deathmatch 3" and then restart, the bot will appear as those cute and creepy eyeballs.
// ------------------------------------- vector() bot_aim_at_enemy = // ------------------------------------- { local float chance; if (cvar("deathmatch") == 3) chance = floor(random() * 10); else chance = floor(random() * 4); if (chance < 2) return normalize(self.enemy.origin - self.origin); else if (chance == 2) return normalize((self.enemy.origin - '50 0 0') - self.origin); else if (chance == 9) return normalize((self.enemy.origin - '75 0 0') - self.origin); else return normalize((self.enemy.origin + '50 0 0') - self.origin); };Now, in Predator Mode, he only has a two in ten chance of aiming perfectly, and sometime he will shoot *way off* to your side.
if (cvar("deathmatch") == 3) setmodel(self, "progs/eyes.mdl"); else setmodel(self, "progs/player.mdl");Good work. We only have one change left. Find the subroutine called PlayerPostThink(). At the very end of that, we'll paste this in:
if (time < 5 && cvar("deathmatch") == 3) centerprint(self, "Now playing Predator Mode\n");Basically, this is similar to a "message of the day." If you have deathmatch set to three, this message will be printed on your screen for the first five seconds of the game. Kewl, huh?