One Shot Kills Quake
Created By: | Marius |
eMail: | lordshoel@yahoo.com |
Difficulty Scale: | Medium |
//=============================================================== //ONE HIT KILLS //=============================================================== //========= One Hit Kills Deathmatch connection message .float ohkd_count; .float ohkd_time; void() OneHitKillsMessage = { if ((self.ohkd_count < 6) && (self.ohkd_time < time)) // 6 == seconds MOTD will display { self.ohkd_time = time + 1; self.ohkd_count = self.ohkd_count + 1; centerprint(self, " === ONE HIT KILLS ===\n Version 1\n\n\nWelcome to One Hit Kills.\nAs the name suggests one shot your dead.\nNow stay alive...\n\nOriginal code by Marius"); return; } };The above is our message of the day. It lasts for 6 seconds. By the way, this uses centerprint, as does our next function. Below the function OneHitKillsMessage paste our second function.
//========= One Hit Kills Deathmatch timer void() OneHitKillsTimer = { local float timelim; local float remaining; local float x; local float y; if (!deathmatch)return; if (gameover) return; timelim = cvar("timelimit") * 60; if (!timelim) return; remaining = ceil(timelim - time); x = floor(remaining / 60); y = remaining - (x * 60); if ((x == 60) && (y == 0)) centerprint (self,"An Hour Left\n"); if ((x == 30) && (y == 0)) centerprint (self, "30 Minutes left\n"); else if ((x == 20) && (y == 0)) centerprint (self, "20 Minutes left\n"); else if ((x == 10) && (y == 0)) centerprint (self, "10 Minutes left\n"); else if ((x == 5) && (y == 0)) centerprint (self, "5 Minutes Left\n"); else if ((x == 4) && (y == 0)) centerprint (self, "4 Minutes Left\n"); else if ((x == 3) && (y == 0)) centerprint (self, "3 Minutes Left\n"); else if ((x == 2) && (y == 0)) centerprint (self, "2 Minutes Left\n"); else if ((x == 1) && (y == 0)) centerprint (self, "1 Minute Left\n"); else if ((y == 30) && (x == 0)) centerprint (self, "30 Seconds Left\n"); else if ((y == 20) && (x == 0)) centerprint (self, "20 Seconds Left\n"); else if ((y == 10) && (x == 0)) centerprint (self, "10 Seconds Left\n"); else if ((y == 5) && (x == 0)) centerprint (self, "5 Seconds Left\n"); };This is our timer. What it does is count down from the set time for the deathmatch game. Note that you do not need to include this function. Save and close OneHitKills.qc, this is all that needs to be done with this file.
if (!targ.takedamage) return;Paste these lines:
//========= One Hit Kills Deathmatch if (deathmatch == 66) { if (inflictor != world) { dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5; dir = normalize(dir); targ.velocity = targ.velocity + dir*damage*8; Killed (targ, attacker); return; } } //========= One Hit Kills DeathmatchAnd thats it for Combat.qc, save and close.
//========= One Hit Kills Deathmatch if (deathmatch == 66) OneHitKillsTimer(); //========= One Hit Kills DeathmatchWhat these lines do is make use of the deathmatch timer. When you've finished there scroll down a little further to the function CheckPowerups. Now to turn the power ups off. Add these three lines at the top of this function:
//========= One Hit Kills Deathmatch if (deathmatch == 66) return; //========= One Hit Kills DeathmatchOnce again this is very simple. You may wish to code it so you can use the Ring of Shadows and Biosuit only, but for now well just ignore all of them. Finished? If you have find the PlayerPostThink function. What we are going to do now is put the message of the day to use. At the end of this function paste these three lines:
//========= One Hit Kills Deathmatch if (deathmatch == 66) OneHitKillsMessage(); //========= One Hit Kills DeathmatchOk thats it for Client.qc, you can save and exit. The next setp is a little lengthy.
//========= One Hit Kills Deathmatch if (deathmatch == 66) { if (self.classname == "item_health") { remove(self); } } //========= One Hit Kills DeathmatchNow scroll down to Item_Armor1 and replace all the Item_Armor code with the block below:
void() item_armor1 = { //========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills Deathmatch self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 0; setsize (self, '-16 -16 0', '16 16 56'); StartItem (); }; void() item_armor2 = { //========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills Deathmatch self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 1; setsize (self, '-16 -16 0', '16 16 56'); StartItem (); }; void() item_armorInv = { //========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills Deathmatch self.touch = armor_touch; precache_model ("progs/armor.mdl"); setmodel (self, "progs/armor.mdl"); self.skin = 2; setsize (self, '-16 -16 0', '16 16 56'); StartItem (); };When you have finished there scroll down to the function Weapon_Touch and within that find the line:
if (leave) return;Below that line paste this small section which follows. This section leaves the weapons in our new Deathmatch mode.
//========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills DeathmatchWhen you finish there scroll down to the power-up section and find the folowing Item functions:
item_artifact_invulnerability, item_artifact_envirosuit, item_artifact_invisibility, item_artifact_super_damageAt the top of each of the above functions add these lines of code:
//========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills DeathmatchOne last modification to Items.qc, scroll to the function DropBackpack, at the top of this function add these three lines of code:
//========= One Hit Kills Deathmatch if(deathmatch == 66) return; //========= One Hit Kills DeathmatchWell thats it for Items.qc. After all that you only have one more simple step...
//========= One Hit Kills Deathmatch if (self.impulse == 66) deathmatch = 66; //========= One Hit Kills DeathmatchNow save and exit Weapons.qc.