4,061
edits
No edit summary |
mNo edit summary |
||
| (12 intermediate revisions by 8 users not shown) | |||
|
{{warning|Creating HUDs with [[ACS]] should be considered [[Deprecation|deprecated]]. Authors are highly recommended to use [[ZScript]] HUD classes, such as '''{{class|BaseStatusBar}}'''.}}
{{TOCright}}
== Assumed Knowledge ==
== Scripting a Custom Hud ==
You can
*3-9: There is a border around the player's view, and the status bar is displayed
'''1)''' If you use [[Doom Builder]], open MAP01 of your wad and select "Edit" from the "Scripts" menu. To display the new HUD bar, you use something like this:
Script 1
{
[[SetHudSize]] (800, 600,
[[SetFont]]("HUDLUMP");
[[HudMessage]] (s: "a";{{const|HUDMSG_PLAIN}},1000,{{const|CR_UNTRANSLATED}},400.1,550.1,0.0);
}
In this script, SetFont tells Doom that the font to use is actually the lump name of your custom stat-bar graphic ("HUDLUMP"), and printing "a" in the HudMessage, as above, will display that graphic. Notice that it is also an "ENTER" script, because it needs to be activated by the player so that you can easily access their inventory and health information.<sup id="ref_cyrez">[[Custom Hud#endnote_cyrez|[2]]]</sup>
'''2)''' Next comes displaying the player information. We'll start with health:
[[SetHudSize]] (320, 200,
[[SetFont]]("BIGFONT");
[[HudMessage]] (i: [[GetActorProperty]](0,{{const|APROP_HEALTH}});
{{const|HUDMSG_PLAIN}},999,{{const|CR_UNTRANSLATED}},90.1,175.1,0.0);
Notice I've changed the sethudsize to accomodate the font "BIGFONT", and the HudMessage coordinates will vary as a result. Finally, notice that the HudMessage ID is ''lower'' than that of the stat-bar HudMessage ID so that the health count will display ''infront'' of the stat-bar.
Using other HudMessages such as:
HudMessage (i: CheckInventory("Armor");▼
HUDMSG_PLAIN,999,CR_UNTRANSLATED,175.1,175.1,0.0);▼
[[HudMessage]] (i: [[CheckInventory]]("
{{const|HUDMSG_PLAIN}},999,{{const|CR_UNTRANSLATED}},175.1,175.1,0.0);
▲ {{const|HUDMSG_PLAIN}},999,{{const|CR_UNTRANSLATED}},175.1,175.1,0.0);
...you will also be able to figure out how to display the armor and ammo counts.
'''3)''' And finally, while this may sound tricky, it's actually very straightforward - turning your custom stat-bar on and off according to how the player has their HUD displayed, as discussed earlier.
if (
{ /*Do your Custom Hud Stuff here*/}
else
{ /*Turn it off with HudMessages that print nothing*/}
These are obviously the very basic concepts you need to be familiar with in order to script your own custom hud. Use what you've learnt here, and have a look through the example scripts posted below to try and understand more about it.
== Example
* [[Barista]]'s [http://
* [
==References==
== See Also ==
[[Tutorials]]
[[category:ACS guides]]
| |||