Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random loading screen texts
LankySpankey103 Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2013
Reputation: 0
#1
Random loading screen texts

Hey guys.

I have this custom story, where whenever the player enters a level door, I want the loading messeage to appear randomly between my 5 loading texts I have written in the .lang file. But the thing is, I have no clue how the random function works :-\ I'm thinking something like, everytime the player enters the map, there should be generated a random number, which then is attached to a certain loading screen? But will that work?

I have done something like this, but it doesn't seem to work.

void OnEnter()
{
    int RandInt(1, 6);
    
    if(RandInt == 1)
    {
        SetupLoadScreen("LoadingScreen", "Loading01", 1, "");
    }
    
        if(RandInt == 2)
    {
        SetupLoadScreen("LoadingScreen", "Loading02", 1, "");
    }
    
        if(RandInt == 3)
    {
        SetupLoadScreen("LoadingScreen", "Loading03", 1, "");
    }
    
        if(RandInt == 4)
    {
        SetupLoadScreen("LoadingScreen", "Loading04", 1, "");
    }
    
        if(RandInt == 5)
    {
        SetupLoadScreen("LoadingScreen", "Loading05", 1, "");
    }
    
        if(RandInt == 6)
    {
        SetupLoadScreen("LoadingScreen", "Loading06", 1, "");
    }
}

Thanks in advance.
(This post was last modified: 03-21-2013, 11:45 PM by LankySpankey103.)
03-21-2013, 11:03 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Random loading screen texts

All you should need is

void OnLeave()
{
    SetupLoadScreen("LoadingScreen", "Loading", 6, "");
}

Tutorials: From Noob to Pro
03-21-2013, 11:51 PM
Website Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#3
RE: Random loading screen texts

You need to use SetupLoadScreen in your OnLeave function. Then in your .lang file, make sure you name the entries something like "LoadingText01", "LoadingText02", "LoadingText03", etc., so that the names are the same except the last number.

For example, if you named the entries like above, the category as "LoadingText", and you had 5 loading texts:

Script:
PHP Code: (Select All)
void OnLeave()
{
    
SetupLoadScreen("LoadingText""LoadingText"5"imagefile.jpg");


lang:
<LANGUAGE>
    <CATEGORY Name="LoadingText">
        <Entry Name="LoadingText01">loading text 1</Entry>
        <Entry Name="LoadingText02">loading text 2</Entry>
        <Entry Name="LoadingText03">loading text 3</Entry>
        <Entry Name="LoadingText04">loading text 4</Entry>
        <Entry Name="LoadingText05">loading text 5</Entry>
    </CATEGORY>
</LANGUAGE>

In Ruins [WIP]
03-21-2013, 11:51 PM
Find
LankySpankey103 Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2013
Reputation: 0
#4
RE: Random loading screen texts

Wow, it was that simple! Thanks guys! It works perfectly :-)
03-22-2013, 12:00 AM
Website Find




Users browsing this thread: 1 Guest(s)