# Jedi Knight Missions Cog Script
#
# prl_thing_move1.cog
# Sylvicolus [PRL] 14 February 2002
#
# Thing_to_move can be an elevator, platform, or any thing
# (if a door then adjoins, light not affected).
# Thing is started from frame 0, moved to frame 1,
# and returned to frame 0.
# Only supply values for the type of trigger you want to use.
#
# This cog is not supported by LucasArts Entertainment Co.
symbols
message activated
message entered
thing thing_to_move nolink
surface surface_trigger1 linkid=1
sector sector_trigger1 linkid=1
thing thing_trigger1 linkid=1
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 triggertype local
end
# ========================================================
code
activated:
entered:
if (active) return;
active=1;
triggertype = GetSenderType();
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:
sleep(start_wait);
MoveToFrame(thing_to_move,1,speed);
WaitForStop(thing_to_move);
sleep(sleeptime);
MoveToFrame(thing_to_move,0,speed);
WaitForStop(thing_to_move);
return;
end
|