I really like this tutorial. The idea just came to me, and I knew I had to make a tutorial out of it. Basically, we're gonna add a new game mode to the bot, which I call 'Radioactive Mode'. Rename it if you like.
The great thing about this mode is that it's pretty simple to code, and great fun to play. Ok then, this is how the game will work:
The first player into the server is radioactive. He/she is surrounded by a field of glowing, swirling particles to indicate that he is radioactive, which will help other players to spot him. However, as he is radioactive, a mutation allows him to jump twice as high as a normal player or bot. If he is killed, the player or bot who kills him becomes radioactive, and the killed guy becomes normal.
Cool idea, huh?
Ok then, let's begin coding. Open up client.qc, and slide down to PutClientInServer. Directly above the routine, paste this:
entity radioactive;This global entity will hold the currently radioactive player or bot. Next, scroll down to the very bottom of PutClientInServer, and put this.
if (cvar("deathmatch") == 7 && radioactive == world) radioactive = self; if (radioactive == self) self.effects = EF_BRIGHTFIELD;This does a couple of things. Firstly, if the player is the first into the server, it sets him as the radioactive guy. Secondly, it spawns the field of particles. This is an inbuilt function in quake, which was never used by id. It looks great, trust me.
if (radioactive == self) self.velocity_z = self.velocity_z * 2;Easy, isn't it. If the player is radioactive, double his jump height.
void(entity targ, entity attacker) ClientObituary = { local float rnum; local string deathstring, deathstring2; rnum = random();Immediately after that, stick this piece of code:
if (cvar("deathmatch") == 7) { if ((radioactive == targ) && (attacker != targ) && ((attacker.classname == "player") || (attacker.classname == "bot"))) { radioactive = attacker; targ.effects = targ.effects - (targ.effects & EF_BRIGHTFIELD); attacker.effects = attacker.effects + EF_BRIGHTFIELD; } }This is all just too easy! If the radioactive guy has just been killed, make the other guy radioactive instead. Simple. Save and close client.qc.
if (radioactive == self) self.velocity_z = self.velocity_z * 2;Now, scroll down to respawn_bot, and at the end of it, stick this.
if (radioactive == self) self.effects = EF_BRIGHTFIELD;That's all there is to it! Now, as a challenge, I'll leave you three ideas for improving this game mode. One is easy, one moderate and one difficult.
1. Add a new ability to the radioactive guy, instead of high jumpingThat last one is VERY hard. Try the other two first.
2. Make the bots choose the radioactive guy as a prefered target
3. Make the bots be able to spot the radioactive guy if they can see the particles