# Jedi Knight Cog Script # # Lightning simulator # # Generates Lightning from one of several ghost positions. # WARNING: Only use the ghost things in a closed row, don't skip single ghost things! # # Written by LKOH_Sniperwolf, modified by zagibu@gmx.ch symbols message startup message pulse message exited thing ghost0=-1 thing ghost1=-1 thing ghost2=-1 thing ghost3=-1 thing ghost4=-1 thing ghost5=-1 thing ghost6=-1 thing ghost7=-1 thing ghost8=-1 thing ghost9=-1 thing ghost10=-1 thing ghost11=-1 thing ghost12=-1 thing ghost13=-1 thing ghost14=-1 thing ghost15=-1 material animmat desc=animating_material int rvar=0 local int fireChannel0 local int fireChannel1 local int fireChannel2 local int fireChannel3 local int fireChannel4 local int fireChannel5 local int fireChannel6 local int fireChannel7 local int fireChannel8 local int fireChannel9 local int fireChannel10 local int fireChannel11 local int fireChannel12 local int fireChannel13 local int fireChannel14 local int fireChannel15 local int maxGhosts=0 local int i local flex autoAimXFOV=60 local flex autoAimZFOV=60 local flex minDelay=2 desc=Minimum lightning delay flex maxDelay=20 desc=Maximum lightning delay flex minVolume=0.5 desc=Minimum thunder volume flex maxVolume=2 desc=Maximum thunder volume flex volume local template lightning=+lightning desc=Lightning template sound fireSound=THUNDER.wav desc=Thunder sound end # Code Section code //------------------------------------------------------------------------------------------------- startup: SetPulse(minDelay + (rand() * maxDelay - minDelay)); for(i = 0; i < 16; i = i + 1) { if(ghost0[i] != -1) maxGhosts = maxGhosts + 1; } return; //------------------------------------------------------------------------------------------------- pulse: rvar = rand() * (maxGhosts - 1); volume = minVolume + (rand() * maxVolume - minVolume); fireChannel0[rvar] = PlaySoundThing(fireSound, ghost0[rvar], volume, -1, 35, 0x00); CreateThing(lightning, ghost0[rvar]); MaterialAnim(animmat, 48, 1); SetPulse(minDelay + (rand() * maxDelay - minDelay)); Return; end