Announcement

Collapse
No announcement yet.

Custom HUD message (solved)

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

    #16
    The mssages automaticly center themselves, the line is what place form top to bottom they are displayed. Not sure if there is a way to adjust where it is (short of maybe filling the string with blanks???)

    Comment


      #17
      Originally posted by Hsoolien
      The mssages automaticly center themselves, the line is what place form top to bottom they are displayed.
      They're always displayed over the crosshair, no matter what line I try to use, is that right?

      Originally posted by Hsoolien
      maybe filling the string with blanks???
      Now there's an idea... though I'd have to take screen resolution into account (blanks per line) and I still wouldn't be able to display messages at the top of the screen. Don't think I'd want that anyway, though.

      Comment


        #18
        I think you have to populate all the lines if you wante them to be off the corsshairs (fil them with blanks)

        Comment


          #19
          wrong!!

          Code:
          defaultproperties
          {
          PosY=0.40
          }
          between 0 and 1, with zero meaning at the top of the screen, and 1 at the bottom


          Need to change properties of the local message while your game is running (so not specified in defaultproperties)? Check this out: http://forums.beyondunreal.com/showp...9&postcount=88

          Remember guys, Jailbreak Rox

          Comment


            #20
            Hey, that's an interesting way to go about it, too! Will give that a try.

            Comment


              #21
              That stuff was awesome! Exactly what I need!

              I worked on it some more. I found that, contrary to what the guy on Planet Jailbreak said, there is no need to instantiate the class at all.

              In the interest of sharing, here's the end product:
              Code:
              //-----------------------------------------------------------
              // Generic localized message.
              //-----------------------------------------------------------
              class XS_Message extends LocalMessage;
              
              var(Message)    string          Message;
              
              var(Color)      color           ColorNone;
              var(Color)      color           ColorCream;
              var(Color)      color           ColorSky;
              var(Color)      color           ColorGold;
              var(Color)      color           ColorTan;
              var(Color)      color           ColorPistache;
              var(Color)      color           ColorSilver;
              
              /** Interface: Generic HUD message wrapper. */
              static function HUDMessage(Controller C, string NewMessage, optional float NewPosY, optional float NewLifeTime, optional color NewDrawColor)
              {
                  if(C != none
                  && PlayerController(C) != none)
                  {
                      Setup(NewMessage, NewPosY, NewLifeTime, NewDrawColor);
              
                      // Send the message.
                      PlayerController(C).ReceiveLocalizedMessage(default.class);
                  }
              }
              
              /** Setup: Initialize the class' defaults for the next time it'll be used...
                         which will be immediately. */
              static function Setup(string NewMessage, optional float NewPosY, optional float NewLifeTime, optional color NewDrawColor)
              {
                  default.Message = NewMessage;
              
                  if(NewPosY > 0)
                  {
                      default.PosY = NewPosY;
                  }
              
                  if(NewLifeTime > 0)
                  {
                      default.LifeTime = NewLifeTime;
                  }
                  
                  if(NewDrawColor != default.ColorNone)
                  {
                      default.DrawColor = NewDrawColor;
                  }
              }
              
              /** Setup: Don't mess around with switches and objects and stuff, just use
                         whatever message was given. */
              static function string GetString(optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
              {
                  return default.Message;
              }
              
              defaultproperties
              {
                  // Default must be overridden... if not, display the error message.
                  Message="Oops... message error.  Contact the coder!"
              
                  // Default: Gold.
                  DrawColor=(R=255,G=215,B=90)
              
                  ColorCream=(R=255,G=250,B=175)
                  ColorGold=(R=255,G=215,B=90)
                  ColorSky=(R=190,G=230,B=240)
                  ColorTan=(R=255,G=190,B=140)
                  ColorPistache=(R=220,G=230,B=135)
                  ColorSilver=(R=245,G=240,B=240)
              
                  bIsConsoleMessage=false
              
                  //Lifetime=3
                  bFadeMessage=true
              
                  StackMode=SM_Down
                  PosY=0.9
              
                  FontSize=1
              }
              It is used as follows:
              Code:
              class SomeVehicle extends SomeVehicleType;
              
              /** Message: Generic HUD message wrapper. */
              function HUDMessage(string Message, optional float NewPosY, optional float NewLifeTime, optional color NewDrawColor)
              {
                  class'XS_Message'.static.HUDMessage(Controller, Message);
              }
              
              function SomeFunction()
              {
                  DoSomeStuff();
              
                  HUDMessage("Hello World!");
              }
              Jailbreak rocks indeed.

              Comment


                #22
                YEah my way is if you don't have the freedom of a messaage class on the player side (I use it alot for ServerActors)

                Comment


                  #23
                  AHAH! so you xould have done it with the LocalMessage!

                  Comment


                    #24
                    Well, it's not really localized anymore.

                    Comment


                      #25
                      lol guess ur right, still its a class! XD

                      Comment

                      Working...
                      X