This will be a short, easy, and fun lesson. I will show you how to add a night mode for fighting monsters or bots in the dark.
You can use the QuakeC source if you want to battle creatures at night. But if you like bots, just download the code for the BGBots. It will work for them, too.
First step: open up the MISC.QC file. Okay, first I will give you the code which you will be adding:
if (cvar("temp1") == 1) { lightstyle(self.style, "a"); return; }This code says if the console variable "temp1" is set to one, then the light style will be "a", which means none.
void() light = { void() light_fluoro = { void() light_fluorospark = { void() light_globe = { void() light_torch_small_walltorch = { void() light_flame_large_yellow = { void() light_flame_small_yellow = { void() light_flame_small_white = {Remember, we want our new code to come after the braket and before any of id's code. We want to turn off each light when the map loads.
/* =========== PutClientInServer called each time a player is spawned ============ */ void() DecodeLevelParms; void() PlayerDie; void() PutClientInServer = { local entity spot; spot = SelectSpawnPoint ();At the *end* of that routine, before the bracket and semi-colon, add the following code:
if (cvar("temp1") == 1) self.effects = EF_DIMLIGHT;PutClientInServer() is where the player is "born." So, this code will make him glow in the dark. Now, open up MONSTERS.QC and slide down to this stuff:
//============================================================================ void() walkmonster_start_go = { local string stemp; local entity etemp;After this, paste in the same code. You also want to paste it into the subroutines flymonster_start_go() and swimmonster_start_go(). Now the monsters will glow in the dark.
//============================================================= // BotActivate - Activates the bot //============================================================= void (string name) BotCreate = { // sounds and models precached in the world.qc filePaste your glow-in-the-dark code at the end of this subroutine. Also, you must add it to the end of the next routine, called botrespawn().