Loading Screen Text

From The DarkMod Wiki
Revision as of 20:53, 6 February 2010 by Springheel (talk | contribs) (New page: It's common to add flavour text to a loading screen to help set the mood and give the player something to read while the map is loading. Mappers can now add a random selection of text, ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

It's common to add flavour text to a loading screen to help set the mood and give the player something to read while the map is loading.

Mappers can now add a random selection of text, so players will see a different bit of text each time they load the map.

Use the following GUI event to read out the "gui::random_value" state variable. The event will be fired by the SDK code as soon as the random_value is set. [code] onNamedEvent OnRandomValueInitialised { if ("gui::random_value" < 0.1) { set "TextLoading::text" "Text1"; } else if ("gui::random_value" < 0.2) { set "TextLoading::text" "Text2"; } else if ("gui::random_value" < 0.3) { set "TextLoading::text" "Text3"; } else if ("gui::random_value" < 0.4) { set "TextLoading::text" "Text4"; } else if ("gui::random_value" < 0.5) { set "TextLoading::text" "Text5"; } else if ("gui::random_value" < 0.6) { set "TextLoading::text" "Text6"; } else if ("gui::random_value" < 0.7) { set "TextLoading::text" "Text7"; } else if ("gui::random_value" < 0.8) { set "TextLoading::text" "Text8"; } else if ("gui::random_value" < 0.9) { set "TextLoading::text" "Text9"; } else { set "TextLoading::text" "Text10"; } } [/code] (The indentation has been screwed by the forum code block). This is just an example supporting 10 different texts of roughly equal probability in a "TextLoading" windowDef. The "gui::random_value" will be in the range [0..1), so if you need more or less than 10 values as in the example, you need to adjust the if () clauses in the GUI code accordingly.