PDA

View Full Version : How does the shield work?


Donator
29th Jun 2003, 10:31 AM
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?

EvilDrWong
29th Jun 2003, 10:57 AM
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

Donator
29th Jun 2003, 12:11 PM
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?

EvilDrWong
29th Jun 2003, 12:49 PM
(in xPawn.ShieldAbsorb)
if (ShieldStrength > damage)
{
ShieldStrength -= damage;
SetOverlayMaterial( ShieldHitMat, ShieldHitMatTime, false );
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

injured.SetOverlayMaterial(none, 0.0, false);

Donator
29th Jun 2003, 02:41 PM
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...

EvilDrWong
29th Jun 2003, 09:15 PM
oh! here, try downloading the source straight from epic:
http://unreal.epicgames.com/Files/UT2003-2225-Source.zip

Donator
30th Jun 2003, 03:18 AM
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 (?!).

Donator
30th Jun 2003, 03:49 AM
injured.SetOverlayMaterial(none, 0.0, false);

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

Donator
30th Jun 2003, 05:15 AM
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...