Biturbo, on 07 August 2012 - 05:25 AM, said:
gamevar thunder_count 0 0 gamevar runonce 0 2 gamevar default_cshade 0 2 // to store the original sector shade gamevar default_fshade 0 2 // to store the original sector shade gamevar new_cshade 0 2 gamevar new_fshade 0 2 useractor notenemy LIGHTING_ICON cstat 32768 ifvare runonce 0 // we only want to store the shade at its default value { getsector[THISACTOR].floorshade default_fshade getsector[THISACTOR].ceilingshade default_cshade setvar runonce 1 } ifvarg thunder_count 30 // if the counter is above a good value { setvarvar new_cshade default_cshade setvarvar new_fshade default_fshade subvar new_cshade 10 // subtract! lower numbers are brighter numbers subvar new_fshade 10 ifvarg thunder_count 35 // I made two stages of brightness for the heck of it { subvar new_cshade 10 subvar new_fshade 10 } setsector[sector_pos].floorshade new_fshade setsector[sector_pos].ceilingshade new_cshade } else // otherwise just keep the default/original sector shade { setsector[THISACTOR].floorshade default_fshade setsector[THISACTOR].ceilingshade default_cshade } enda actor APLAYER ifvare thunder_count 0 ifrnd 16 // we only start counting sometimes { setvar thunder_count 1 } else ifvarg thunder_count 0 // count as long as the var is more than 0 { addvar thunder_count 1 ifvarg thunder_count 40 // reset it when it goes over the max value we want setvar thunder_count 0 } // rest of player code enda