Experience Systems
Created By: | Marius |
eMail: | lordshoel@yahoo.com |
Difficulty Scale: | Medium |
//Variable for Exp Total .float has_exp;This is the variable that stores our total experience points. You may wish to change the name but if you do remember to do it in all the steps. Go on to the next step.
/* ============================================================================== EXPERIENCE SYSTEM A - POINTS PER KILL ============================================================================== */ void(entity person, float expamt) AddExp = { local string tally; if (person.classname != "player") return; person.has_exp = person.has_exp + expamt; tally = ftos(person.has_exp); if (person.classname == "player") { sprint(person, "You now have "); sprint(person, tally); sprint(person, " Experience Points\n"); } };This function tallys up the experience and prints the amount the person has.
if (self.flags & FL_MONSTER) { killed_monsters = killed_monsters + 1; WriteByte (MSG_ALL, SVC_KILLEDMONSTER); }This is where well the Exp System comes in to use. Replace the above block of code with the below:
if (self.flags & FL_MONSTER) { killed_monsters = killed_monsters + 1; if (self.classname == "monster_dog") AddExp (attacker, 30); if (self.classname == "monster_knight") AddExp (attacker, 50); if (self.classname == "monster_zombie") AddExp (attacker, 55); if (self.classname == "monster_demon1") AddExp (attacker, 70); if (self.classname == "monster_fish") AddExp (attacker, 20); if (self.classname == "monster_enforcer") AddExp (attacker, 40); if (self.classname == "monster_hell_knight") AddExp (attacker, 75); if (self.classname == "monster_ogre") AddExp (attacker, 65); if (self.classname == "monster_ogre_marksman") AddExp (attacker, 65); if (self.classname == "monster_shalrath") AddExp (attacker, 60); if (self.classname == "monster_shambler") AddExp (attacker, 80); if (self.classname == "monster_army") AddExp (attacker, 35); if (self.classname == "monster_tarbaby") AddExp (attacker, 25); if (self.classname == "monster_wizard") AddExp (attacker, 45); WriteByte (MSG_ALL, SVC_KILLEDMONSTER); }Done that? If so continue to the next step.
void() PrintExp = { local string tally; tally = ftos(self.has_exp); if (person.classname == "player") { sprint(self, "You now have "); sprint(self, tally); sprint(self, " Experience Points\n"); } };Now open up Weapons.qc and find ImpulseCommands. In this function above the impulse for QuadCheat add the following impulse:
if (self.impulse = 15) PrintExp ();All you have to do is bind the impulse, in this case 15 to a key in quake or edit the config file.
//Variable for Exp Total .float has_exp;This is the variable that stores our total experience points. You may wish to change the name but if you do remember to do it in all the steps. Go on to the next step.
/* ============================================================================== EXPERIENCE SYSTEM B - POINTS PER BLOW ============================================================================== */ void(entity person, float expamt) AddExp = { local string tally; if (person.classname != "player") return; if (self.weapon == IT_AXE)expamt = expamt * 2; else if (self.weapon == IT_SHOTGUN)expamt = expamt * 1.7; else if (self.weapon == IT_SUPER_SHOTGUN)expamt = expamt * 1; else if (self.weapon == IT_NAILGUN)expamt = expamt * 1.2; else if (self.weapon == IT_SUPER_NAILGUN)expamt = expamt * 1; else if (self.weapon == IT_GRENADE_LAUNCHER)expamt = expamt * 0.8; else if (self.weapon == IT_ROCKET_LAUNCHER)expamt = expamt * 0.7; else if (self.weapon == IT_LIGHTNING)expamt = expamt * 0.5; person.has_exp = person.has_exp + expamt; }; void(entity person) PrintExp = { local string tally; tally = ftos(person.has_exp); if (person.classname == "player") { sprint(person, "You now have "); sprint(person, tally); sprint(person, " Experience Points\n"); } };This function tallys up the experience and prints the amount the person has.
// check for godmode or invincibility if (targ.flags & FL_GODMODE)Add the following block of code:
if (self.classname == "monster_dog") AddExp (attacker, 3); if (self.classname == "monster_knight") AddExp (attacker, 5); if (self.classname == "monster_zombie") AddExp (attacker, 5); if (self.classname == "monster_demon1") AddExp (attacker, 7); if (self.classname == "monster_fish") AddExp (attacker, 2); if (self.classname == "monster_enforcer") AddExp (attacker, 4); if (self.classname == "monster_hell_knight") AddExp (attacker, 7); if (self.classname == "monster_ogre") AddExp (attacker, 6); if (self.classname == "monster_ogre_marksman") AddExp (attacker, 6); if (self.classname == "monster_shalrath") AddExp (attacker, 6); if (self.classname == "monster_shambler") AddExp (attacker, 80); if (self.classname == "monster_army") AddExp (attacker, 3); if (self.classname == "monster_tarbaby") AddExp (attacker, 2); if (self.classname == "monster_wizard") AddExp (attacker, 4);Now above the in the Killed function within the block of code:
if (self.flags & FL_MONSTER) { killed_monsters = killed_monsters + 1; WriteByte (MSG_ALL, SVC_KILLEDMONSTER); }Add the line above or below killed_monsters:
PrintExp(attacker);No thats all for Combat.qc. What we have done is set the base amount of Exp for each monster. Also we have made it so when you kill a monster it prints the Experience Points total rather than at each blow.
if (self.impulse = 15) PrintExp (self);All you have to do is bind the impulse, in this case 15 to a key in quake or edit the config file.