Hey guys,
Having a hell of a time getting a script to work.. I can get the delays for the speak line and sound files to work right but when it comes to delaying the teleport to the top of the elevator it NEVER works when I try to delay it. I've tried using jump to object and teleport and neither work with a delay. It will always teleport if I have no delay but then I miss out on the sound file and text appearing.
Here is what I'm working with.
//Put this script OnUsed
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("me_sound_elevator");
DelayCommand(1.0, SoundObjectPlay(oTarget));
DelayCommand(1.0, SendMessageToPC(oPC, "**The rusty gears scream in protest as the elevator ascends.**"));
location lTarget;
oTarget = GetWaypointByTag("me_wp_elevatorup001");
lTarget = GetLocation(oTarget);
//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
DelayCommand(4.0, AssignCommand(oPC, ClearAllActions()));
DelayCommand(4.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
}