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
Lightning question
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Lightning question

I'm going off of the script at the beginning of TDD to make lightning flash through the windows, but I'm running into one little problem. I put some spotlights with gobo maps next to each window that are currently at 0.0 for all values. The lightning is the only thing that get them to show up brightly, and I want them to fade back out completely.

With this script though, after the first lightning flash the spotlights stay lit at a soft white color. I haven't quite figured out which part of the script determines what value the spotlights end at. Here's what I've got so far.

PHP Code: (Select All)
void TimerThunder(string &in asTimer)
{
    
AddLocalVarInt("ThunderStep"1);                //What step to play in the event
    
float fEventSpeed RandFloat(0.05f0.15f);    //The default time between steps in an event

    
switch(GetLocalVarInt("ThunderStep")) 
    {
        case 
1:
            
ThunderLights(2,0.05f);
        break;
        case 
2:
            
ThunderLights(1,0.05f);
        break;
        case 
3:
            
ThunderLights(3,0.05f);
        break;
        case 
4:
            
ThunderLights(1,0.05f);
        break;
        case 
5:
            
ThunderLights(2,0.05f);
        break;
        case 
6:
            
ThunderLights(3,0.05f);
        break;
        case 
7:
            
ThunderLights(1,0.3f);
            
PlaySoundAtEntity("Thunder""general_thunder.snt""AreaThunder_1"0.0ffalse);
            
PlaySoundAtEntity("Thunder""general_thunder.snt""AreaThunder_2"0.0ffalse);
        break;
    }
    
    if(
GetLocalVarInt("ThunderStep") < 8)  AddTimer("thunder"fEventSpeed"TimerThunder");
    else { 
        
SetLocalVarInt("ThunderStep"0); 
        
        
AddTimer("thunder"RandFloat(10.0f30.0f), "TimerThunder"); 
    }
}
void ThunderLights(int alIntensityfloat afFade)
{
    
/*Skip parts of a flash everynow and then but not the first strong light 
    **and not the last "back to normal" light
     */
    
if(RandFloat(13) == && (GetLocalVarInt("ThunderStep") != or GetLocalVarInt("ThunderStep") != 7)) return;
    
    
float fF 0.2f;
    
    switch(
alIntensity) {
        case 
1:
            for(
int i=0;i<=5;i++) FadeLightTo("spotthunder_"+i,0.52f,0.55f,0.6f,0.45f,-1,afFade-0.04f);
            for(
int i=0;i<=5;i++) FadeLightTo("ambthunder_"+i,0.2f,0.25f,0.35f,-1,-1,afFade);
        break;
        case 
2:
            for(
int i=0;i<=5;i++) FadeLightTo("spotthunder_"+i,0.82f+fF,0.85f+fF,0.9f+fF,0.9f+fF,-1,afFade-0.04f);
            for(
int i=0;i<=5;i++) FadeLightTo("ambthunder_"+i,0.25f+fF,0.3f+fF,0.4f+fF,-1,-1,afFade);
        break;
        case 
3:
            for(
int i=0;i<=5;i++) FadeLightTo("spotthunder_"+i,0.92f+fF,0.95f+fF,1+fF,1+fF,-1,afFade-0.04f);
            for(
int i=0;i<=5;i++) FadeLightTo("ambthunder_"+i,0.3f+fF,0.35f+fF,0.45f+fF,-1,-1,afFade);
        break;
    }


I changed all the values to 0.0f in the last case 3, thinking that was where the lights ended at, but that didn't work.

EDIT: Never mind, looks like it was case 1.

(This post was last modified: 04-24-2012, 06:12 AM by Damascus.)
04-24-2012, 05:55 AM
Find




Users browsing this thread: 1 Guest(s)