Megahealth rotting - rot 1 hp/second w/o fixed respawn delay
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
Megahealth rotting - rot 1 hp/second w/o fixed respawn delay
Guys, I figured out a new way to rot down megahealth in just 1 hp per second and maintain the originality of respawning only if your health is 100 or less.
There are many other ways to do it, but sadly they don't keep the originality of the player rotting down to 100 health and only respawn 20 seconds AFTER the player's megahealth is fully rotten.
I tested the QIP method, but the respawn delay was fixed (always 125 seconds). The megahealth may respawn much earlier if you take damage and your health rapidly goes to 100 or less, then it may be a loooong wait.
I made it think every frame to make it more precise, but it works the same as original, takes 5 seconds to rot down if you pick up the 1st megahealth, and rots 1 hp/second without rotting twice or more as fast if you pick up 2 or more megahealths.
Originally, you pick up a megahealth, then it rots down, when your health is 100 or less, it takes 20 seconds to respawn. BUT, if you pick up two megahealths, it'll rot down twice as fast. I think a certain number of players don't like that behavior.
So as you can see above, I added two different checks for the same healtype, if you don't have the megahealth (health <= 100), it'll wait 5 seconds and will rot down normally. If you already have a megahealth and picked up another one, it'll keep rotting down, but won't rot down twice as fast. The new function item_megahelth_check() checks every frame if the player's health is more than 100, if that's true, it'll keep thinking and checking over and over again until your health is 100 or less, then it waits 20 seconds and then respawn. I made both megahealth_rot() and megahealth_check() to think every frame to make it more precise.
Changed item_megahealth_rot(), and the new item_megahealth_check():
I did a test on dm3, I picked up both megahealths from the center and the pent area. I waited it rot down without damaging myself, and when my health hit 100, both megahealths respawned at the same time. Pretty much like the original stuff, but without rotting twice as fast.
Hope you like it, if you want to use just replace the old codes with the new ones.
There are many other ways to do it, but sadly they don't keep the originality of the player rotting down to 100 health and only respawn 20 seconds AFTER the player's megahealth is fully rotten.
I tested the QIP method, but the respawn delay was fixed (always 125 seconds). The megahealth may respawn much earlier if you take damage and your health rapidly goes to 100 or less, then it may be a loooong wait.
- Code: Select all
// Megahealth = rot down the player's super health
if (self.healtype == 2 && !(other.items & IT_SUPERHEALTH))
{ // if the player health is 100 or less, act normally
other.items = other.items | IT_SUPERHEALTH;
self.nextthink = time; // think every frame to make it more precise
self.frags = time + 5; // rot down after 5 seconds
self.think = item_megahealth_rot;
self.owner = other;
}
else if (self.healtype == 2 && other.items & IT_SUPERHEALTH)
{ // if the player health is more than 100, don't rot twice as fast but always check respawn delay
self.nextthink = time;
self.think = item_megahealth_check;
self.owner = other;
}
else
{
if (deathmatch != 2) // deathmatch 2 is the silly old rules
{
if (deathmatch)
self.nextthink = time + 20;
self.think = SUB_regen;
}
}
I made it think every frame to make it more precise, but it works the same as original, takes 5 seconds to rot down if you pick up the 1st megahealth, and rots 1 hp/second without rotting twice or more as fast if you pick up 2 or more megahealths.
Originally, you pick up a megahealth, then it rots down, when your health is 100 or less, it takes 20 seconds to respawn. BUT, if you pick up two megahealths, it'll rot down twice as fast. I think a certain number of players don't like that behavior.
So as you can see above, I added two different checks for the same healtype, if you don't have the megahealth (health <= 100), it'll wait 5 seconds and will rot down normally. If you already have a megahealth and picked up another one, it'll keep rotting down, but won't rot down twice as fast. The new function item_megahelth_check() checks every frame if the player's health is more than 100, if that's true, it'll keep thinking and checking over and over again until your health is 100 or less, then it waits 20 seconds and then respawn. I made both megahealth_rot() and megahealth_check() to think every frame to make it more precise.
Changed item_megahealth_rot(), and the new item_megahealth_check():
- Code: Select all
void() item_megahealth_rot =
{
other = self.owner;
if (other.health > other.max_health)
{
if (self.frags < time)
{
if (self.t_width < time)
{
other.health = other.health - 1;
self.t_width = time + 1;
}
}
self.nextthink = time;
return;
}
// it is possible for a player to die and respawn between rots, so don't
// just blindly subtract the flag off
other.items = other.items - (other.items & IT_SUPERHEALTH);
if (deathmatch != 2) // deathmatch 2 is the silly old rules
{
if (deathmatch)
self.nextthink = time + 20;
self.think = SUB_regen;
}
};
void() item_megahealth_check =
{
other = self.owner;
if (other.health > other.max_health)
{ // act similarly to the function above, but don't rot down twice as fast, just check the player's health
self.nextthink = time;
return;
}
if (deathmatch != 2) // deathmatch 2 is the silly old rules
{
if (deathmatch)
self.nextthink = time + 20;
self.think = SUB_regen;
}
};
I did a test on dm3, I picked up both megahealths from the center and the pent area. I waited it rot down without damaging myself, and when my health hit 100, both megahealths respawned at the same time. Pretty much like the original stuff, but without rotting twice as fast.
Hope you like it, if you want to use just replace the old codes with the new ones.
Last edited by Orion on Mon Nov 17, 2008 3:10 pm, edited 1 time in total.
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
Hope you like it, if you want to use just replace the new codes with the old ones.
It might work better though if you replaced the OLD codes with the NEW ones!
Keep up the good work!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
