# Jedi Knight Cog Script # # GLASSALRT.COG # # Breaking glass cog,that when glass breaks,starts alert... # # # Note: the template used is shard00, NOT shard0 ! # # [Cave_Demon] # # This cog is NOT supported by LucasArts symbols surface glass mask=0x448 desc=glass surface glass2 mask=0x448 desc=glass_adjoin int spawnpoints=2 desc=spawn_points int density=5 desc=density thing alert=-1 vector surface_center local int surface_sector local int surface_vertices local vector vertex local vector where local int i local int j local int k local int a_shard local int dummy local template shard_tpl=shard00 local sound glass_break=GlassBreak1.WAV local sound alarm=scalarm.wav message damaged end code damaged: // Add 10 cm along the normal to solve some rounding error or non planar face... surface_center = VectorAdd(SurfaceCenter(GetSenderRef()), VectorScale(GetSurfaceNormal(GetSenderRef()), 0.01)); surface_sector = GetSurfaceSector(GetSenderRef()); surface_vertices = GetNumSurfaceVertices(GetSenderRef()); dummy = PlaySoundPos(glass_break, surface_center, 1.0, 10.0, 20.0, 0); PlaySoundThing(alarm,alert,15,15,20,0x1001); // First spawn 'density' shards with random velocities at the center of the face. for(k=0; k