Loading Screen Text: Difference between revisions
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, ... |
Springheel (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
Mappers can now add a random selection of text, so players will see a different bit of text each time they load the map. | Mappers can now add a random selection of text, so players will see a different bit of text each time they load the map. | ||
< | <math>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. | ||
onNamedEvent OnRandomValueInitialised | onNamedEvent OnRandomValueInitialised | ||
{ | { | ||
Line 49: | Line 49: | ||
} | } | ||
} | } | ||
(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.</ | (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. | ||
</math> |
Revision as of 20:53, 6 February 2010
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.
<math>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.
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"; } }
(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. </math>