Results 1 to 11 of 11
  1. #1
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default 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. #2
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    Germany
    Posts
    120

    Default

    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.

  3. #3
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default

    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.

  4. #4
    Boomshot

    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    2,162

    Default

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

    [0] Process Hit FX
    Last edited by 100GPing100; 07-27-2012 at 03:22 PM. Reason: Curse word inside function name.

  5. #5
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default

    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.

  6. #6
    Boomshot

    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    2,162

    Default

    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.

  7. #7
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default

    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.

  8. #8
    Boomshot

    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    2,162

    Default

    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.

  9. #9
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default

    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.

  10. #10
    MSgt. Shooter Person
    Join Date
    Mar 2009
    Location
    .no
    Posts
    155

    Default

    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()).
    "Those are tears, Jefferson!"
    @ModDB | @Twitter | @UnrealWiki

  11. #11
    Marrow Fiend
    Join Date
    Nov 2007
    Location
    Lithuania
    Posts
    4,385

    Default

    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.
    Last edited by GreatEmerald; 07-28-2012 at 09:56 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.