# Jedi Knight Cog Script # # 00_turrettrap.cog # # Multiplayer turrets activated by switch. # # This will generate a series of 3 laser bursts per 'round' when # the switch is activated. # The trap resets in 'delay' seconds afterwards. # # [YB] # # (C) 1997 LucasArts Entertainment Co. All Rights Reserved # ======================================================================================== symbols message activate surface switch desc=switch thing turret1 nolink,desc=turret1 thing turret2 nolink,desc=turret2 thing turret3 nolink,desc=turret3 thing turret4 nolink,desc=turret4 thing ghost1 nolink,desc=ghost1 thing ghost2 nolink,desc=ghost2 thing ghost3 nolink,desc=ghost3 thing ghost4 nolink,desc=ghost4 int rounds=5 desc=rounds float rate=0.33 desc=rate float delay=2.0 desc=delay float movespeed=2.0 float autoAimXFOV=90 float autoAimZFOV=180 int firing=0 local int cur_round=0 local template projectile=+stlaser local sound fireSound=turret-1.wav local sound on_snd=set_hi2.wav local sound off_snd=lgclick1.wav local end # ======================================================================================== code activate: if(firing == 1) Return; firing = 1; SetWallCel(switch, 1); PlaySoundPos(on_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0); MoveToFrame(turret1, 1, movespeed); MoveToFrame(turret2, 1, movespeed); MoveToFrame(turret3, 1, movespeed); MoveToFrame(turret4, 1, movespeed); cur_round = 0; while(cur_round < rounds) { FireProjectile(ghost1, projectile, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV); Sleep(rate); FireProjectile(ghost2, projectile, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV); Sleep(rate); FireProjectile(ghost3, projectile, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV); Sleep(rate); FireProjectile(ghost4, projectile, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV); Sleep(rate); cur_round = cur_round + 1; } Sleep(delay); dummy = SetWallCel(switch, 0); dummy = PlaySoundPos(off_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0); firing = 0; MoveToFrame(turret1, 0, movespeed); MoveToFrame(turret2, 0, movespeed); MoveToFrame(turret3, 0, movespeed); MoveToFrame(turret4, 0, movespeed); Stop; end