// Random Rotations & Light Flicker script for triggers. Much better than continuously changing trigger model's angles. // The trigger's three-color flicker numbers change how much rapid color-shifting occurs (flickers like a candle light). // Recommended flicker amount is 15 or 20. Remember to keep RGB colors 0.8 or below if using a flicker amount of 20, since the maximum color value is 1. // Flicker amounts are divided by 100 in script, since "randomfloat" cannot randomize decimals, so 20 is actually randomizing between 0.00 and 0.20. // Example: exec global/flickerrotate.scr bomb ( 0.9 0.5 0 ) 150 10 20 0 main local.name local.color local.radius local.redflicker local.greenflicker local.blueflicker local.dontspawntrig: if(local.dontspawntrig != 1) { local.trig_shot = spawn trigger_multiple spawnflags 128 // only respond to being shot by bullets or explosions. local.trig_shot.origin = $(local.name).origin local.trig_shot setsize ( -50 -50 -20 ) ( 50 50 50 ) local.trig_shot.name = local.name local.trig_shot setthread shot } local.r = local.color[0] local.g = local.color[1] local.b = local.color[2] level waittill spawn local.i[0] = 0 local.i[1] = 0 local.i[2] = 0 local.v[0] = 3 local.v[1] = 4 local.v[2] = 5 while(1) { if(local.minues!=1) { local.v[0] ++ local.v[1] ++ local.v[2] ++ } if(local.v[2]==10) { local.minues=1 } if(local.v[2]==3) { local.minues=0 } if(local.minues==1) { local.v[0] -- local.v[1] -- local.v[2] -- } for(local.p=0;local.p<=10;local.p++) { waitframe local.i[0] += local.v[0] local.i[1] += local.v[1] local.i[2] += local.v[2] if($(local.name).shot==1) // if trigger is shot at, make angle rotations spin faster. { local.i[0] += local.v[0] local.i[1] += local.v[1] local.i[2] += local.v[2] local.i[0] += local.v[0] local.i[1] += local.v[1] local.i[2] += local.v[2] if($(local.name).shot2 == 1) { $(local.name) light 1 1 1 local.radius } } if(local.dontspawntrig != 1) { local.trig_shot.origin = $(local.name).origin } $(local.name).angles = ( local.i[0] local.i[1] local.i[2] ) if($(local.name).shot2 != 1) { $(local.name) light (randomfloat local.redflicker / 100.00 + local.r) (randomfloat local.greenflicker / 100.00 + local.g) (randomfloat local.blueflicker / 100.00 + local.b) local.radius } if($(local.name) == NULL) { local.trig_shot remove; end } } } end shot: // 2nd model doesn't run this thread, since only one spawnflags 128 trigger was spawned in. self nottriggerable if($(self.name + "_2") != NULL) { $(self.name + "_2") thread model2_shot } if($(self.name).shot != 1) { $(self.name) thread shotwait } $(self.name).shot = 1 $(self.name).shot2 = 1 waitframe $(self.name).shot2 = 0 // make the light return to normal sooner than angle rotations slowing back down. self triggerable end model2_shot: // if the trigger has 2 spinning models, then make ".shot" variable = 1 for the 2nd model. if(self.shot != 1) { self thread shotwait } self.shot = 1 self.shot2 = 1 waitframe self.shot2 = 0 // make the light return to normal sooner than angle rotations slowing back down. end shotwait: wait 0.4 self.shot = 0 end