Page 1 of 1

Another glitch

PostPosted: Sat May 05, 12 9:23 pm
by Poor
This has been driving me and other cagematch players crazy. When you set an animal on fire, they seem to become invincible for as long as the flames last. After some investigating, it turns out the DX programmers are at fault.

To see the glitch, use targeting and injure a karkian until it has around 20% health. Then set it on fire. It's health will jump back to 100%. Any damage dealt by the player will become undone every second the animal is on fire.

PostPosted: Sat May 05, 12 10:01 pm
by RedDynasty
well i forgot to mention but dunno if this is true but i think greasels and gray( not confirmed) dont have this effect.
Where do you think the code is badly written\needs editing?

PostPosted: Sun May 06, 12 12:35 am
by Poor
I can confirm greasels and grays do have this effect. It's more noticable in animals with higher healths. The only way to kill an animal on fire is to deplete all of it's health within a 1 second window.

Human pawns have an overall health and 6 different healths for each body part:

Health, HealthHead, HealthTorso, HealthArmRight, HealthArmLeft, HealthLegRight, HealthLegLeft

When a human pawn is damaged it lowers the health of the body part hit. It then uses a function called GenerateTotalHealth() to look at the health of the body parts and sets Health to the overall health of the body.

But animals don't use healths for each body part. They only use Health. When an animal takes damage it lowers Health directly, without lowering the healths of the body parts and using GenerateTotalHealth(). What the programmers forgot to do is change the burning function for animals.

In the UpdateFire() function it calls GenerateTotalHealth(). But because the health of an animal's individual body parts is never lowered, they will have full health for each body part and GenerateTotalHealth() will set Health to the full amount. (the "HealthTorso -= 5;" in UpdateFire() is the only thing will hurt an individual body part of an animal)

Code: Select all
function UpdateFire()
{
   // continually burn and do damage
   HealthTorso -= 5;
   GenerateTotalHealth();
   if (Health <= 0)
   {
      TakeDamage(10, None, Location, vect(0,0,0), 'Burned');
      ExtinguishFire();
   }
}


To fix this you just have to put this in the Animal class:

Code: Select all
function UpdateFire()
{
   // continually burn and do damage
   Health -= 5;
   if (Health <= 0)
   {
      TakeDamage(10, None, Location, vect(0,0,0), 'Burned');
      ExtinguishFire();
   }
}

PostPosted: Sun May 06, 12 1:56 am
by RedDynasty
and u can simply do that in the cmbanimal.uc right?

PostPosted: Sun May 06, 12 2:40 am
by Poor
Yup. Already updated it. Though my version is slightly different. When a player is on fire, it remembers who set them on fire. It doesn't do this for NPC but I changed it so it would. That way if the bot dies from the flames you caused, it will award the kill to you.

PostPosted: Sun May 06, 12 4:34 am
by atrey65789
In UpdateFire, to be safe, I would put bInvincible to false, other than that, and after looking at the modified code you put up, that's all I can think of at the moment.