# Jedi Knight Cog Script Generated by CogWriter ver 0.1 beta 1/20/98 10:13:16 AM # # jed_door_sw.cog [ver 1.0a] # # Generic basic door activated by one or two switches # This cog will open the door and close it again after the WaitTime specified times out.. # Controls 1 door. # # ......Thing Settings # # Set Door ThingFlags to 0x408 # Set NumFrames to 2 # Two frames are used # # Switches Set Surface Flags to "6" use a two cell mat such as 00_T_up.mat # # [DL] Jan/98 # # This cog script is Not supported by LucasArts Entertainment Company symbols message activated message arrived message blocked message startup message timer flex Light=0.5 local flex Wait=2.0 flex Speed=8.0 int DSector local sound locksound=df_door2-3.wav local sound offSound=lgclick1.wav local sound onSound=set_hi2.wav local surface switch0 linkid=2 # enter as (sector space surface number) in Jed surface switch1 linkid=2 # optional second switch thing door linkid=1 # Door Thing number end # ======================================================================================== code startup: DSector = GetThingSector(door); SetSectorAdjoins(DSector, 0); SetSectorLight(DSector, Light, 0.0); // add some light to door sector Return; # ........................................................................................ activated: if(GetSenderId() == 1) { PlaySoundLocal(locksound, 1, 0, 0); // play locked sound } else if(GetSenderId() == 2) { if(IsThingMoving(door)) Return; if(GetCurFrame(door) != 0) Return; MoveToFrame(door, 1, Speed); SetSectorAdjoins(DSector, 1); PlaySoundThing(onSound, door, 0.6, -1, -1, 0); // play activate sound SetWallCel(switch0, 1); if (switch1 >= 0) SetWallCel(switch1, 1); } Return; # ........................................................................................ arrived: if(IsThingMoving(door)) Return; if(GetCurFrame(door) == 1) { SetTimer(Wait); Return; } else { SetSectorAdjoins(DSector, 0); PlaySoundThing(offSound, door, 0.6, -1, -1, 0); // play deactivate sound SetWallCel(switch0, 0); if (switch1 >= 0) SetWallCel(switch1, 0); Return; } # ........................................................................................ blocked: MoveToFrame(door, 1 - GetGoalFrame(door), Speed); Return; # ........................................................................................ timer: MoveToFrame(door, 0, Speed); Return; end