Frictional Games Forum (read-only)

Full Version: Random Events
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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:
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.
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()
{

}