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 Events
Henriksen Offline
Senior Member

Posts: 308
Threads: 71
Joined: Dec 2010
Reputation: 2
#1
Random Events

Hi.

Im currently working a train in the hpl level editor and im wondering if anyone could tell me how to script random events so like that the screen shakes sometimes if you catch my drift Tongue
04-28-2011, 09:41 PM
Find
Dalroc Offline
Member

Posts: 57
Threads: 2
Joined: Mar 2011
Reputation: 0
#2
RE: Random Events

Some more specific info would be nice..
But to make a random screen shake at random intervals you could do something like this

PHP Code: (Select All)
void funcName(string &in asTimer)
{
    
int shakeTime RandInt(6090);
    
int shake RandInt(09);
    if(
shake == 0)
    {
        
StartScreenShake(float afAmountfloat afTimefloat afFadeInTimefloat afFadeOutTime); //decided too give no example values here as I have never tried it :P
    
}
    
AddTimer (""shakeTime"funcName");


This would make it so there's a 10 percent chance every 60-90 seconds that there will be a screen shake. Just make sure you call "funcName" in the OnStart as well.
You can use whatever values you want though.
04-28-2011, 10:09 PM
Find
Henriksen Offline
Senior Member

Posts: 308
Threads: 71
Joined: Dec 2010
Reputation: 2
#3
RE: Random Events

What do you mean?

Could you insert it so it will work in the game when i try to start it?

Script:

////////////////////////////
// Run first time starting map
void OnStart()
{

}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
04-28-2011, 10:11 PM
Find




Users browsing this thread: 1 Guest(s)