1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

How does the shield work?

Discussion in 'Ask a Coder' started by Donator, Jun 29, 2003.

  1. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    Sounds simple enough. I am trying to code up a modifiction of the standard shield that briefly spawns a sphere like mesh around the target when hit to give the illusion of an actually invisible shielding field surrounding the player that only becomes visible when absorbing damage. You all know star trek, you know the clichee. I'm just not satisfied with that orange shader. Problem is, I'm at a complete loss where to start. Where is the function that actually generates that damage overlay and from where is it called?
     
  2. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    xPawn.ShieldAbsorb(), but to change that youll need to make a gametype... which probably isnt what youre going for. What you could do as a cheap alternative is make a new GameRules class and in its NetDamage function spawn your translucent sphere effect if xPawn(Injured).ShieldStrength > 0
     
  3. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    The 'cheap alternative' was very helpful, thanks a lot.

    I still don't understand where the damage overlay is generated, since ShieldAbsorb() only does 'return damage' as I see it, no actual texture change. I'm able to generate the sphere now, so my second question would be, how do I get rid of the orange damage overlay shader?
     
  4. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    Code:
    (in xPawn.ShieldAbsorb)
    if (ShieldStrength > damage)
    {
        ShieldStrength -= damage;
        [b]SetOverlayMaterial( ShieldHitMat, ShieldHitMatTime, false );[/b]
        PlaySound(sound'WeaponSounds.ArmorHit',SLOT_Pain,2*TransientSoundVolume,,400); 
        return 0;
    }
    
    the bold part might be the culprit behind that. SO, what you could try doing is something of this sort in your NetDamage() to get rid of it after the fact
    Code:
    injured.SetOverlayMaterial(none, 0.0, false);
    
     
    Last edited: Jun 29, 2003
  5. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    Going to try that now. Oddly enough, I've no idea where to find those lines you mention. The ShieldAbsorb() function in the xPawn class when viewed in UnrealED only contains the line 'return damage;' for me. And even odder, when trying to export xPawn, WOTGreal crashes, period, no questions asked. Anyway, thanks, you've been a big help. Off to experimenting now...
     
  6. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
  7. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    Great. Now I can also see it. I really wonder why the xPawn from the sourcecode zip differs from the one I see in UEd (?!).
     
  8. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    injured.SetOverlayMaterial(none, 0.0, false);

    does not work, by the way. Maybe the overlay's drawn before NetDamage is called.
     
  9. Donator

    Donator New Member

    Joined:
    Jun 26, 2003
    Messages:
    146
    Likes Received:
    0
    But it doesn't matter much as I see now, because the shield effect blocks your view anyway. Cool. Some more fiddling with materials and it's ready to rock...
     

    Attached Files:

Share This Page