Announcement

Collapse
No announcement yet.

problem using bCrosshairShow in UTHUD

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

    problem using bCrosshairShow in UTHUD

    OK so I am doing some custom stuff, and at some point I want to turn off the stupid crosshairs. For some reason everyway I try to turn them off will not work >.>.. Everytime i log out the status for some reason is shows false, even though they are displaying...

    but anyways so I just wanted to make sure the place I was calling it wasn't doing anything funny so I changed it from:

    uthud(PC.myHUD).bCrosshairShow = false;

    to

    uthud(PC.myHUD).bShowHud= false;

    and as expected at the right time it turns off the hud... but in the exact same place if I reswitch those statements, the bCrosshairShow does nothing...

    Am I missing some UpdateHud() call or something? as far as I can tell from the function in UTPlayerController I am accessing it appropriately.

    Code:
    exec function ToggleScreenShotMode()
    {
    	if ( UTHUD(myHUD).bCrosshairShow )
    	{
    		UTHUD(myHUD).bCrosshairShow = false;
    		SetHand(HAND_Hidden);
    		myHUD.bShowHUD = false;
    		if ( UTPawn(Pawn) != None )
    			UTPawn(Pawn).TeamBeaconMaxDist = 0;
    	}
    	else
    	{
    		// return to normal
    		UTHUD(myHUD).bCrosshairShow = true;
    		SetHand(HAND_Right);
    		myHUD.bShowHUD = true;
    		if ( UTPawn(Pawn) != None )
    			UTPawn(Pawn).TeamBeaconMaxDist = UTPawn(Pawn).default.TeamBeaconMaxDist;
    	}
    }
    if anyone can gimme a point in the right direction to solve this, it would be nice.

    also on a side note, I just wanted to find the class that actually draws the crosshair icons... could not find a reference anywhere for it. the material reference I assumed they used was UI_HUD.CrossHair.M_UI_HUD_InvertingCrossHair_01 however no reference to that material was found so I am really at a loss to find a start point to where the hell this thing is drawn at.

    thanks for the help
    -Czar

    #2
    The is a very high chance this wont help you but perhaps UTPlayerController::LoadSettingsFromProfile is useful for you, or will at least help you looking in a different direction.

    I made a custom scoreboard for BattleMOD and to do that I needed custom UI Scenes and custom HUD's because of the way everything is connected.

    What I noticed while I did that was that somehow fooling around with the HUD has all kinds of side effects (e.g. a disappearing weapons bars). All those side effects disappeared when I added code to call UTPlayerController::LoadSettingsFromProfile after I changed the HUD.

    Your millage will probably vary.

    BTW perhaps the crosshair could be a UI Scene or part of a class embeded in a UI Scene. Could be somewhere else as well though.

    I also grepped around a bit and found this piece of code in UTPlayerController.uc that might or might not be useful:

    Code:
    exec function ToggleScreenShotMode()
    {
    	if ( UTHUD(myHUD).bCrosshairShow )
    	{
    		UTHUD(myHUD).bCrosshairShow = false;
    		SetHand(HAND_Hidden);
    		myHUD.bShowHUD = false;
    		if ( UTPawn(Pawn) != None )
    			UTPawn(Pawn).TeamBeaconMaxDist = 0;
    	}
    	else
    	{
    		// return to normal
    		UTHUD(myHUD).bCrosshairShow = true;
    		SetHand(HAND_Right);
    		myHUD.bShowHUD = true;
    		if ( UTPawn(Pawn) != None )
    			UTPawn(Pawn).TeamBeaconMaxDist = UTPawn(Pawn).default.TeamBeaconMaxDist;
    	}
    }
    (If you want to see what I did exactly in BattleMOD you can download it from http://www.onsrpg.com/ut3mods.php, all soucecode is included).

    Comment


      #3
      wow ok so after doing a little more research I feel a little dumb lol. I have no clue why I didn't notice this property before or what I grep'd for that didn't find it.

      So found out that the icons are drawn by the UTWeapon class using the texture file :

      CrosshairImage=Texture2D'UI_HUD.HUD.UTCrossHairs'


      After checking the references to what uses that, I see the stupid playercontroller has a boolean to turn off the crosshair as well, and omg, this one actually does turn it off!! lol.

      so basically just changed it from:
      uthud(PC.myHUD).bCrosshairShow = false;
      to
      pc.bNoCrosshair = true;

      and Voila!, no crosshair. hope this helps anyone else that may have been trying to use the boolean off the hud class

      -czar

      btw thnx for the reply battlemod thanks for telling me to check uiscenes, because that led me to relook at the material and actually find the texture reference it used, not the stupid material reference I was originally looking at.

      Comment


        #4
        Originally posted by czard View Post
        btw thnx for the reply battlemod thanks for telling me to check uiscenes, because that led me to relook at the material and actually find the texture reference it used, not the stupid material reference I was originally looking at.
        You're welcome. It's a huge puzzle we're all stumbling through. Zillions of things to figure out.

        Comment


          #5
          hey thanks for posting this...i've been trying to disable the **** vehicle crosshair for a couple of days.....can't believe i missed that var

          Comment


            #6
            np, I am glad someone else found this useful and I wasn't the only one lol

            Comment


              #7
              Better question:
              How to change the crosshairs? haha

              Comment


                #8
                Thank you guys for the answers.

                Comment

                Working...
                X