Need help with my HUD

Discuss any other topics here
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

The player.ini is in the install folder.

It's called horizontal now, not vertical, so you only set the indicatorwidth = 300, not any height.

In playersetup, just select attributeinfofile and type in player.ini.

[edit]You can make it verical. Just called the height = 40, and it will get smaller top to bottom, instead of right to left.[/edit]

I'm going to test.
Steve Dilworth - Resisting change since 1965!
MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames »

Well Im glad that someone can get my HUd to work, even though it isnt me. :wink: Ok, time to try this again...
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

In the PlayerSetup entity (which must be placed in every level) you can specify the name of the file that contains the player's attributes:
AttributeInfoFile - Name of the Attribute initialization file
It can be named player.ini or attribute.ini, but they would contain the same definitions.
In the basic level it is called attribute.ini, so if you rename your player.ini file to attribute.ini everything should work fine.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Hmm. I called it player.ini and it showed up. here it is as a vertical:

Image
Steve Dilworth - Resisting change since 1965!
MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames »

Well, I don't mean to be such a trouble but I still cant get it right. I copied the player.ini file and renamed it attribute.ini and it still wont work. I have the HUD as you made it QOD, and the player/attribute.ini's are inital 50 low 0 and high 100. The only thing I have is a black line on the left of the white frame. What am I missing? Did I overlook a BIG detail here?

EDIT: Ok, Im gonna reread all the posts here. I will post back later with my results. Thank you very much for the help everyone!
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames »

I GOT IT!!!! IT WORKS NOW!!! I reinstalled RF though, I must have messed up some other file when I was trying to get it to work. Thank you very much for the help!!!! :D :D :D :D
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

I'm so glad you got it working, MOG. :D

I am very sorry for having run you around in circles like that. It is what comes from being in too big of a hurry when doing things after being up all night. I promise to take my time and look things through thoroughly before stepping to try and help again.
Steve Dilworth - Resisting change since 1965!
MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames »

Its alright steven8, those things happen. Now I havent tried the vertical health test yet so I will go do that. Thanks for the help again everyone. With out it I'd still be banging my head off my desk cursing the lack of documentaion on HUDs and its connection to other files, or maybe that documentation is there and I should curse myself for being lazy and not reading thoughouly enough. Anyway, now to get the rest of my hud working.
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

I'm gonna read through this here in a bit, but look what is in the online help. A whole section on customizing a hud:

Heads Up Display


Compass + Radar + Player Position + Pictures + Clip & Magazine Display + Attributes + Hud Element Activation

The Heads Up Display (or HUD) is configured by using an ini file that is specified in the PlayerSetup entity as the HUDInfoFile entry. The default Reality Factory HUDInfoFile is called hud.ini, although you can change this to any file you wish. The HUDInfoFile is laid out similar to a standard Windows ini file with sections containing information about each element of the Hud. This ini file is a text file and can be edited by any text editor, such as NotePad.

Each section in the hud.ini file starts with a name enclosed in square brackets, such as [compass] or [mana]. All lines after this, up to the start of the next section define information about that Hud element. This information varies depending on the type of element being defined.

There are three built-in Hud elements in Reality Factory, a compass, radar and the player position. We will look at these first.

Compass
The compass requires its section to start with [compass]. The default compass section looks like this:

[compass]
frame = compassfrm.bmp
framealpha = a_compassfrm.bmp
indicator = compass.bmp
indicatoralpha = a_compass.bmp
framex = 0
framey = center
indicatoroffsetx = 13
indicatoroffsety = 7

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the compass. If these lines are missing then no frame will be shown. The lines indicator and indicatoralpha define the bitmap and alpha map used as the compass indicator. If these lines are missing then no indicator is shown. The compass indicator must be a specific size and layout and, if you wish to change the look, must follow the size and layout of compass.bmp.

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The lines indicatoroffsetx and indicatoroffsety define the x and y offset of the indicator from (framex, framey). This defines the screen location of the indicator bitmap's upper left corner, relative to the frame's location.

Radar
The radar requires its section to start with [radar]. The default radar section looks like this:

[radar]
frame = hudradar.bmp
framealpha = a_hudradar.bmp
indicator = indicator_red.bmp
indicatoralpha = a_indicator_red.bmp
npcindicator = indicator_green.bmp
npcindicatoralpha = a_indicator_red.bmp
framex = 0
framey = center
range = 500

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the radar. If these lines are missing then no frame will be shown. The lines indicator and indicatoralpha define the bitmap and alpha map used as the radar indicator for all non-npc actors. The lines npcindicator and npcindicatoralpha define the bitmap and alpha map used as the radar indicator for all npc actors

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The line range defines the number of texels away from the player that the radar will operate.

Player Position
The player position element requires its section to start with [position]. Instead of using an indicator bitmap, the position element displays numeric text to show the (x,y,z) location of the player. A sample section would look like:

[position]
frame = position.bmp
framealpha = a_position.bmp
framex = -150
framey = 0
indicatoroffsetx = 15
indicatoroffsety = 5
font = 8
width = 4

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the position element. If these lines are missing then no frame will be shown.

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The lines indicatoroffsetx and indicatoroffsety define the x and y offset of the text from (framex, framey). This defines the screen location of the indicator text's upper left corner, relative to the frame's location.

The line font defines the size and color of the font used to display the numeric text. See Bitmapped Fonts for information on this value.

The line width defines the number of characters shown for each of the x,y and z values. The default is 4. Each value is displayed with 1 space between it and the next value.

Pictures
Pictures can be displayed with the low level Pawn command ShowHudPicture. To to make use of this feature the pictures must be defined in the following way:

[picture#]
bitmap =
bitmapalpha =
active =

or

[picture#]
giffile =
active =

where # is the ID of the picture. Examples:

[picture0]
bitmap = hud\black.bmp
bitmapalpha = hud\white.bmp
active = false

[picture1]
giffile = menu\animcursor.gif
active = false

Clip & Magazine Display
In conjunction with weapon reloading it is possible to make the HUD display the amounts left in the clip and the number of clips left, rather than just the amount of ammunition. This change only applies if the currently selected weapon supports clips. If it doesn't, then just the amount of ammunition will be shown.

To make the HUD entry show the amount left in the clip add the line:

style = magazine

to the HUD definition. To make it show the number of clips left add this line:

style = clip

To show both clips and magazine contents at the same time you must use the ~ extension to the HUD entry name and define two different entries. For example, to show magazines and clips for bullets you would make the definitions like this:

[bullet]
type = numeric
style = magazine
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 138
font = 9
width = 3
active = false

[~bullet]
type = numeric
style = clip
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 158
font = 9
width = 3
active = false

Please note : if the weapon does not support magazines then the section that displays the magazines will not be displayed. Only the section that shows the clips will be used to display the amount of ammunition.

Attributes
To display an attribute as a Hud element place its name inside square brackets to start a section. In order to allow the display of an attribute in two different ways [name] and [~name] both refer to the same attribute. There are 3 different types of attribute display that can be used, verticle, horizontal and numeric. First, a sample of a verticle display.

[mana]
type = verticle
frame = rhud.bmp
framealpha = a_rhud.bmp
indicator = hbar.bmp
indicatoralpha = a_hbar.bmp
framex = -100
framey = 0
indicatoroffsetx = 10
indicatoroffsety = 50
indicatorheight = 32

The attribute being displayed is mana. This must be defined in the AttributeInfoFile in the PlayerSetup entity. If the attribute name is LightValue then the amount of time left in the player's light is shown. This name does not need to be defined in the AttributeInfoFile.

The line type defines which display type is to be used, in this case verticle.

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the attribute element. If these lines are missing then no frame will be shown. The lines indicator and indicatoralpha define the bitmap and alpha map used as the attribute indicator. If these lines are missing then no indicator is shown.

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The lines indicatoroffsetx and indicatoroffsety define the x and y offset of the indicator from (framex, framey). This defines the screen location of the indicator bitmap's upper left corner, relative to the frame's location.

The line indicatorheight defines the number of pixels from the top of the indicator bitmap that will be used as the indicator graphic. This is due to the fact that bitmap sizes must be even and a combination of powers of 2. Therefore, the indicator graphic may not be the entire height of the bitmap.

Next, a sample of a horizontal display.

[dart]
type = horizontal
frame = rockhud.bmp
framealpha = a_darthud.bmp
indicator = sindic.bmp
indicatoralpha = a_sindic.bmp
framex = -64
framey = 96
indicatoroffsetx = 4
indicatoroffsety = 33
indicatorwidth = 27

The attribute being displayed is dart. This must be defined in the AttributeInfoFile in the PlayerSetup entity. If the attribute name is LightValue then the amount of time left in the player's light is shown. This name does not need to be defined in the AttributeInfoFile.

The line type defines which display type is to be used, in this case horizontal.

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the attribute element. If these lines are missing then no frame will be shown. The lines indicator and indicatoralpha define the bitmap and alpha map used as the attribute indicator. If these lines are missing then no indicator is shown.

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The lines indicatoroffsetx and indicatoroffsety define the x and y offset of the indicator from (framex, framey). This defines the screen location of the indicator bitmap's upper left corner, relative to the frame's location.

The line indicatorwidth defines the number of pixels from the right of the indicator bitmap that will be used as the indicator graphic. This is due to the fact that bitmap sizes must be even and a combination of powers of 2. Therefore, the indicator graphic may not be the entire width of the bitmap.

Finally, a sample of a numeric display.

[health]
type = numeric
frame = rhud.bmp
framealpha = a_rhud.bmp
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 38
font = 9
width = 3

The attribute being displayed is health. This must be defined in the AttributeInfoFile in the PlayerSetup entity. If the attribute name is LightValue then the amount of time left in the player's light is shown. This name does not need to be defined in the AttributeInfoFile.

The line type defines which display type is to be used, in this case numeric.

The lines starting with frame and framealpha define the bitmap and alpha map used as the frame (or identifier) part of the attribute element. If these lines are missing then no frame will be shown. The lines indicator and indicatoralpha define the bitmap and alpha map used as the attribute indicator. If these lines are missing then no indicator is shown.

The lines framex and framey define where the identifier is placed on the screen. If framex is greater than 0 then the x location of the bitmap is that many pixels from the left side of the screen. If framey is greater than 0 then the y location is that many pixels from the top of the screen. If framex is less than 0 then the x location is that many pixels from the right side of the screen. If framey is less than 0 then the y location is that many pixels from the bottom of the screen. The (x,y) location defines the upper left corner of the identifier bitmap in these cases. If framex equals center then the center of the identifier bitmap is placed at the center of the screen width. If framey is equal to center then the center of the identifier bitmap is placed at the center of the screen height.

The lines indicatoroffsetx and indicatoroffsety define the x and y offset of the text from (framex, framey). This defines the screen location of the indicator text's upper left corner, relative to the frame's location.

The line font defines the size and color of the font used to display the numeric text. See Bitmapped Fonts for information on this value.

The line width defines the number of characters shown for the attribute value. The default is 3.

Hud Element Activation
The default setting for all Hud elements is active, which means they will be displayed when the Hud is displayed. To stop an element from being displayed add the line active = false to the definition section. It will then be necessary for the program to activate the element so it can be displayed. At the moment only weapons activate and deactive their ammunition Hud elements. Therefore, it is necessary to add the active = false line to the Hud elements of all ammunition. When you switch to a weapon it will deactivate all other ammunition Hud elements and active its ammunition display.

If the line is set to active = modify then the Hud element will be displayed only when the value is being changed. A modifydirection line tells which way the change must take place in order for the Hud element to be displayed. The choices are up, down, or both. A displaytime line is used to specify the amount of time the Hud element will continue to be displayed after the last time its value changed
Steve Dilworth - Resisting change since 1965!
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Ok, I'm not sure whether to post this here or in the bug reports... It may be a little bug but it doesn't really matter since it is so easy to get rid of.

I think I MAY have found out why your hud didn't work. After the last hud element definition in hud.ini you need to have at least ONE empty line. If that isn't there the indicator won't appear, only the frame. This also happens with other .ini files. At least material.ini, the last section won't work at all if there's not an empty line in the end of the file.
Pain is only psychological.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Wow. I know compilers sometimes need things like that so they can properly read things.

QOD could verify that, I'm sure. But I never knew that.
Steve Dilworth - Resisting change since 1965!
hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 »

http://terrymorgan.net/download.htm

Demo055.zip -(2.2MB)-This demos Turrets, View and World weapons from 3ds Max, keys and locks, alpha Hud bitmaps, rising lava pillars. Mirrored here

demo063a.zip-(630k) You need the Office Key, Liquids, Timers, Fire Enemies, Jump Pads, Moving Electric Bolts, adding a HUD element.
MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames »

Wow, that no line thing might have been the problem. Of course I noticed when I was typing it in after the clean install that I tried to spell horizontal and vertical wrong. So my spelling could have also been the culprit. Its a good thing to know about that blank line thing because otherwise I'm sure I would run into that later on. Thanks for the help everyone!
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 »

Line 1776 RF FAQ

http://terrymorgan.net/rffaq.zip


Q. My lockpick icon shows up in the upper right hand corner even though
I don't have the lockpick selected for use or even possess it.

A. A problem with all ini files that has existed since I started using
them is this : you need to have a couple of blank lines at the end in
order for the last line to get read properly. This is 'feature' of the C
file reader routines and is also present in games like Half-Life. Hike1
was having a problem with something from an ini a little while ago and
it turned out that there were no extra lines at the end and the last
line was ignored. This can cause weird errors as some variable won't be
initialized and then things go boom. Check your problem Hud.ini file to
see if there are extra lines at the end. You may have added them when
adding the numeric element and that really solved the problem. I the
lockpick case, it was the last item listed in the inventory.ini, and
there weren't any blank lines (hit return a couple of times and save)
inserted after it.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

You see!! Line 1776 of the FAQ!! How could I have been so blind! :wink:

That makes sense. I know that the Leopard basic language compiler requires blank lines between commands or it'll get mixed up.

I also got bit by the spelling of veritcal, although the way it is spelled in the ini (verticle) is incorrect according to my dictionary at home.

Oh NO!! Not the dictionary thing again!!! :shock:
Steve Dilworth - Resisting change since 1965!
Post Reply