Announcement

Collapse
No announcement yet.

[in 3236 too] Script bug in ut2k4v3186 for health and shield points management!?!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    This is in public int ShieldAbsorb (int dam) of xPawn.uc

    Code extracted from 3223 patch

    Code:
    ShieldStrength = SmallShieldStrength;
    damage -= Interval;
    Remaining = 0.33 * Interval;
    if ( Remaining <= damage )
         return (int)damage;
    damage -= Remaining;

    Proposed code

    Code:
    damage -= Interval;
    Remaining = 0.33 * Interval;
    ShieldStrength = Math.Max(0, SmallShieldStrength - 1.33 * (damage - Remaining));
    if ( Remaining <= damage )	
         return (int)damage;
    damage -= Remaining;
    I've modified the first line and put it in 3rd position.

    The 1.33 controls the rate at which the remaining shield goes down (maybe another value would suit better here?). Replacing this value with 1 makes the shield graph go down the same way the health graph.

    I've used the Math.Max function in order to always have a shield value that is not negative. There was no need for this with the original v3223 code, shame on me

    Comment


      #17
      I'm using 3204 and the discontinuities (sp?) are certainly there, confirmed with a little mutator that applies damage to the player through a console command.
      If you have the 100 shield, and take 133 damage, you end up with 67 health as expected. If you have the 100 shield and take 134 damage, your health ends up 25 points lower than expected, at 41 health. You instantly die if you take 175 damage.

      Seems those C# programs are a proper simulation of the game. Epic had better fix that not going under the 50 too.

      Anyway, seems to me those functions are just too complicated. It would be way easier to control if there was one function to determine how much shield is removed, then call these functions in this order:

      ShieldAbsorbed=ShieldAbs(Damage);
      ShieldStrength-=ShieldAbsorbed;
      Health-=Damage-ShieldAbsorbed;

      That way, at least you're sure that the sum of armour lost and health lost is always the damage taken.

      Comment


        #18
        Thank you for making the mutator, I was about to do it, to prove whether I was wrong or not, but I have been too lazy
        Could you post a link so that I can test it on the v3227 (I finally installed it, after backing up my system folder)?

        Comment


          #19

          Please read 3236 where written 3336 :bulb:


          The problem is only partially corrected in 3236 (as it was in 3223).

          Here are the screenshots.

          The first one is correct, just to notice some values.
          Given two 100 shields, you die instantly when taking 250+ damage (if you have 100 health).




          Now, the problem. You have the 100 shield and the 50 shield.
          If you take more than 117 damage, your shield will not go further down than 50. You will die instantly with 200+ damage.




          My proposed correction, which makes the shield go down too.
          Notice the use of the little checkbox on the top right of the program




          Code in v3236 is
          Code:
          // ORIGINAL v3236 source
          //ShieldAbsorb function in xPawn
          ShieldStrength = SmallShieldStrength;
          damage -= Interval;
          Remaining = 0.33 * Interval;
          if ( Remaining <= damage )
          	return (int)damage;
          damage -= Remaining;
          Code:
          // khaRbon14's proposed correction
          damage -= Interval;
          Remaining = 0.33 * Interval;
          ShieldStrength = Math.Max(0, SmallShieldStrength - 1.33 * (damage - Remaining));
          if ( Remaining <= damage )
          	return (int)damage;
          damage -= Remaining;
          The 1.33 coefficient could be adjusted, I just put some random number there, which seems fine though (imo).

          (edit)
          See in post below why there is no value that can fit (the 1.33 line).
          (/edit)

          The proposed correction does not change the other graphs (they are all the same).

          You can download the project from here.

          The fact that with a same amount of shield you don't die with the same damage is explained by the fact the 100 shield absorbs more damage than the 50 shield.
          Stacking two 100 shields makes you live (a bit) longer.

          Comment


            #20
            I was a bit too lazy/unsuccessful to make a mutator to test this but tonight, one idea came to my mind.

            I did the following test on asbestos: I grabbed the big keg o health, the small shield, the big shield, the rocket launcher and finally the amp.
            Then, I shot one rocket right under me, and that brought me to 139 health and 50 shield (I had 199 health and 150 shield).

            This should result in a 2*90=180 damage. Maybe there is some attenuation to take into account, because it is not a direct hit, it is splash damage (my C# program indicates that 139/50 is the result of a 160 damage hit)..

            This is strange that the remaining shield is at 50.

            I don't know how to perform better tests (my mutators do not work ), I'll try again in one week.


            PS: there is no value that can give a good shield amount (1.33 is not right), because the health goes down too fast. For one damage point, the health goes down of 1 point too, so there's nothing to remove from the shield otherwise the damage are over powered.

            The health graph is not correct neither for damage values above 116 when having both shields.

            Comment

            Working...
            X