# Jedi Knight Missions Cog Script # # prl_thing_move4.cog # Sylvicolus [PRL] 23 March 2002 # http://www.lactarius.com/sylvicolus/jk/ # # Thing_to_move can be an elevator, platform, or any thing # (if a door then adjoins, light not affected). # **Thing is set up to have 6 frames (0-5). # **Thing is started from and returned to frame 1. # **Frame 1 and frame 4 must be identical. # All frames should be in the same sector (but not required). # Thing is called/sent to frame 0 or frame 2 from frame 1. # Thing is called/sent to frame 3 or frame 5 from frame 4. # # Only supply values for the types of triggers you want to use. # Trigger number sends thing to that frame, for example: # surface_trigger0 (linkid=0) sends thing to frame 0 # thing_trigger5 (linkid=5) sends thing to frame 5 # GetSenderId(); is used to determine which frame to move to. # # If you need more triggers for a particular frame # just add them to the symbols section. # # This cog is not supported by LucasArts Entertainment Co. symbols message startup message activated message entered thing thing_to_move nolink surface surface_trigger0 linkid=0 sector sector_trigger0 linkid=0 thing thing_trigger0 linkid=0 surface surface_trigger2 linkid=2 sector sector_trigger2 linkid=2 thing thing_trigger2 linkid=2 surface surface_trigger3 linkid=3 sector sector_trigger3 linkid=3 thing thing_trigger3 linkid=3 surface surface_trigger5 linkid=5 sector sector_trigger5 linkid=5 thing thing_trigger5 linkid=5 flex start_wait=0.5 desc=pause_before_moving flex sleeptime=2.0 flex speed=4.0 sound trigger_sound=Activate02.wav sound return_sound=beep2.wav int active=0 local int trigger=0 local int triggerid local int triggertype local sector thingSector local end # ======================================================== code startup: sleep(1.0); MoveToFrame(thing_to_move,1,speed); thingSector = GetThingSector(thing_to_move); return; activated: entered: if (active) return; active=1; triggertype = GetSenderType(); triggerid = GetSenderId(); trigger = GetSenderRef(); sleep(0.2); if (triggertype==3) //trigger is a thing { PlaySoundThing(trigger_sound, GetThingPos(trigger), 1, -1, -1, 0 ); call movething; PlaySoundThing(return_sound, GetThingPos(trigger), 1, -1, -1, 0 ); } else if (triggertype==5) //trigger is a sector { PlaySoundThing(trigger_sound, GetThingPos(thing_to_move), 1, -1, -1, 0 ); call movething; PlaySoundThing(return_sound, GetThingPos(thing_to_move), 1, -1, -1, 0 ); } else if (triggertype==6) //trigger is a surface { PlaySoundPos(trigger_sound, SurfaceCenter(trigger), 1, -1, -1, 0 ); SetWallCel(trigger,1); call movething; PlaySoundPos(return_sound, SurfaceCenter(trigger), 1, -1, -1, 0 ); SetWallCel(trigger,0); } active=0; return; movething: if (triggerid >= 3) JumptoFrame(thing_to_move,4,thingSector); sleep(start_wait); MoveToFrame(thing_to_move,triggerid,speed); WaitForStop(thing_to_move); sleep(sleeptime); if (triggerid <= 2) MoveToFrame(thing_to_move,1,speed); if (triggerid >= 3) MoveToFrame(thing_to_move,4,speed); WaitForStop(thing_to_move); if (getcurframe(thing_to_move) == 4) JumptoFrame(thing_to_move,1,thingSector); return; end