Announcement

Collapse
No announcement yet.

How to blind players?

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

    How to blind players?

    I'm interested in creating a flash grenade that will blind players within a certain radius for 5-10 seconds. I've been looking around for for examples of screen-flashing, but I haven't turned up much, apart from the ClientFlash function, and I'm not sure how to tie that to a TakeDamage function. Anybody have a good tip?

    #2
    If the two are unrelated events, you'll have to set some global flag to bridge the gap. For example, in TakeDamage you set bBlind = true, and in ViewFlash you check whether bBlind == true, and if so, set bBlind = false and do you magic.

    Comment


      #3
      I had thought about trying to make a flash grenade also and here is what I think you might want to try doing:
      Create a "flash effect" class that is temporarily "attached" (ie: reference the pawn) to the players who have been hit within the radius of the flash bang. So when you have the flashbang explode, do a foreach radiusactors and create a list of the affected pawns in the flasheffect class. Then set a looping timer. If the pawn is a bot, randomly add a rotation to their view so that they don't shoot straight every second or so. If the pawn is a player, gradually fade their view back to normal from a blinding white. The effect only needs to last what.... 10 - 30 seconds, so simply set the lifespan of the class to however long you want it to last.

      Comment


        #4
        That makes a good amount of sense. I found a bit of code that flashes a fake bluescreen of death (http://dl.damnclan.com/CriticalE-2k3.zip), and it looks like he is using the Canvas command to set the screen to blue (with some custom text later, but I'm not so interested in that). Here's an edited sample:

        simulated event RenderOverlays( Canvas Canvas )
        {
        local PlayerController PCtrl;

        PCtrl = PlayerController(Instigator.Controller);

        Super.RenderOverlays(Canvas);

        PCtrl.MyHud.bCrosshairShow = false;

        PCtrl.MyHud.bHideHUD = true;

        Canvas.DrawColor.R = 228;
        Canvas.DrawColor.G = 228;
        Canvas.DrawColor.B = 228;
        Canvas.DrawColor.A = 255;

        Scale = PCtrl.DefaultFOV/PCtrl.DesiredFOV;
        Canvas.Style = ERenderStyle.STY_Normal;
        Canvas.bNoSmooth = false;

        Canvas.SetPos(0,0);
        Canvas.DrawTile(Texture'BlueScreen', Canvas.SizeX, Canvas.SizeY, 0.0, 0.0, 512, 512 );
        }

        OK, so he's actually using a texture map, but I imagine I could just use the DrawColor values. Would this be a better way to go instead of ClientFlash? Seems like it has more control. I haven't been able to get ClientFlash to do anything yet...

        Comment


          #5
          BTW credit for that code and link goes to 3v1£jesú§, and his post on this thread:

          http://www.ataricommunity.com/forums...hreadid=382247

          Comment


            #6
            OK, I've been playing around with this for awhile, but being the idiot I am, I'm still having trouble. My skill level is basically that I can edit other people's code, but I have a really hard time making my own. So here's what I've been doing:

            I grabbed that Critical Error gun code I mentioned above and modified it so that 1) it doesn't crash , and 2) it gives the player a fake bluescreen whenever he is hit by a shot from the error gun.

            (Ultimately, I want this to be a white flash rather than a bluescreen, but that part is a piece of cake)

            The problem is that the client will only experience the bluescreen if he is ALSO holding the error gun. If he switches to another gun, he just takes the regular damage with no bluscreen effect.

            I expect that the reason it only affects people if they are holding the gun is because there is a variable declared within the ErrorGun class that is used to tell if the player should be blinded.

            I guess my question is: How can I move this variable outside the weapon class so that its accessible no matter what the player is carrying. I thought about adding a variable to the PlayerController class, but I've heard that's bad.

            Or, should I just look at a different method? Again, sorry for being stupid...

            Comment


              #7
              Anyone know if America's Army can be decompiled using UEd? That's an Unreal Engine 2 game like UT2004, and it has some pretty good flah 'nades.

              Comment

              Working...
              X