Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Checking if dying pawn should be gibbed

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

  • Checking if dying pawn should be gibbed

    I'm trying to find if the pawn that is dying (in GameRules' PreventDeath() ) is supposed to get gibbed (if its death is not prevented) or not. Is there a relatively reliable way of knowing that? I looked at xPawn, and it uses some crazy method with HitFX and HitFXTickers and SimHitFXTickers to set bGibbed, but that happens after PreventDeath() is called...

  • #2
    I don't know exactly how the whole gibbing-process works, but some values are defined in class'DamageType', the boolean "bAlwaysGibs" may be interesting here.

    Comment


    • #3
      Well, I guess it will work for some cases, but most of the times when things are gibbed, it's because of excessive damage. Though I'm not sure if there is some form of "gibbing threshold" for that or not.

      Comment


      • #4
        Check Proces****FX[0] (xPawn line 545) and SpawnGibs (xPawn line 1504).

        [0] Process Hit FX

        Comment


        • #5
          I already did. And, like I said, the mechanism they use for that seems mystical to me. The heck are HitFX, HitFXTicker, SimHitFXTicker? And it sounds that it relies on the Tick function, something that I can't reliably use in PreventDeath() as the response to whether or not the pawn should be dead has to come back immediately.

          Comment


          • #6
            TickFX seems to handle the update of some effects.
            Process%HitEffects seems to be what creates the gibs when the pawn gets hit. This would mean that:
            Code:
            SimHitFxTicker != HitFxTicker
            means the pawn the got hit.


            Code:
            HitFxTicker = HitFxTicker + 1;
            if (HitFxTicker > ArrayCount(HitFX) - 1)
                 HitFxTicker = 0;
            Interesting...

            DoDamageFX (xPawn line 672), this is what causes the value change of HitFxTicker in line 759.

            DoDamageFX is called in PlayHit (xPawn line 959) which gets called by TakeDamage (Pawn line 2029) on line 2075:
            Code:
            PlayHit(actualDamage,InstigatedBy, hitLocation, damageType, Momentum);
            DoDamageFX is also called on line 2358 of the function TakeDamage in the state Dying of Pawn (state Dying on line 2196).

            SO basically if you want to prevent Process%HitFX from being called, then you should block the change of HitFxTicker.

            You could either do this by overriding the function TakeDamage and after calling super.TakeDamage setting HitFxTicker to a constant value or by overriding the Tick from xPawn and make it look like this:
            Code:
            simulated function Tick(float DeltaTime)
            {
                if (Level.NetMode == NM_DedicatedServer)
                    return;
                if (Controller != None)
                    OldController = Controller;
                
                HitFxTicker = 0;
                TickFX(DeltaTime);
                
                if (bDeRes)
                    TickDeRes(DeltaTime);
            }
            If you want to gib, then you could do something like:
            Code:
            if (!bGib)
                HitFxTicker = Buffer; // Buffer would be a global variable to store the constant value for HitFxTicker
            TickFX(DeltaTime);
            if (bGib) Buffer = HitFxTicker; // Since HitFxTicker increases in DoDamageFX, I think we might need it to increase.
            Hope this works out, good luck.

            Comment


            • #7
              Well, that's not really the issue here. I can't change the xPawn anyway. I'm limited to working with a Mutator and a GameRules actor. And the reason why I want to know whether the pawn would get gibbed if the death is because I'm using the PreventDeath() function as a hook for playing the death sounds (manually, as opposed to letting the xPawn handle it, since Epic removed some code that I need in it - yet I don't want to replace the pawn itself). And, well, there should be no death sounds if the pawn gets gibbed (or is underwater, or get turned into a skeleton - all of these conditions makes it impossible to speak).
              So, to put it simply, I just need to figure out if the pawn is about to get gibbed, while working with what I can access from PreventDeath(), without altering anything in the pawn itself.

              Comment


              • #8
                Code:
                if (killed.SimHitFxTicker != killed.HitFxTicker)
                If that evaluation is true and:
                Code:
                killed.HitFX[killed.SimHitFxTicker].bone == 'none'
                Then the pawn will be gibbed (bGibbed = true).

                Hope that works.

                Comment


                • #9
                  I had already tried it with checking for the bone, but it ended up returning true most of the time. Same thing with checking for the difference between HitFXTicker and SimHitFXTicker. It just returns true even if the pawn didn't get gibbed, except for rare circumstances.

                  Comment


                  • #10
                    PreventSever should indicate that the xPawn is about to be severed.

                    xPawn.DoDamageFX (...) -> <bool> GameInfo.PreventSever (...) -> <bool> GameRules.PreventSever (...)

                    IIRC, it must be used in conjunction with PreventDeath. So, if PreventDeath returns true, and the damage type the pawn was exposed to severs it, PreventSever also has to return true, or the game spawns the severed bits and pieces.

                    Not called if (DamageType.default.bNeverSevers || class'GameInfo'.static.UseLowGore()).

                    Comment


                    • #11
                      Oh, right, there's also a PreventSever hook! I totally missed that!

                      Though it still poses a bit of a problem. PreventSever() is not called on every death, but only on demand. Which means it's not reliable enough to put the whole sound playing logic in it, or else the sounds will only play when the pawn is about to be severed. And PreventSever() gets called after PreventDeath(), so I can't get that information on PreventDeath() alone. Now, I could work around that by adding something like a SetTimer(0.1, false) and doing the checking there, but it would be nice to have something cleaner...

                      EDIT: Actually, no, PreventSever() gets called only before PreventDeath(), which is kind of silly, but it makes this a lot easier! Though it appears that PreventSever() doesn't have a good way of telling whether the sever was supposed to gib the whole player, or an unknown bone. But it's reliable enough for me, anyway.

                      Comment

                      Working...
                      X