//originally: trapdoor_use script by Kerico 7/5/02
//edited by: Trito for placeable doors 1/6/03
//place in door on-use scipt
//opens the door, plays animation, teleports player, closes door

void main()
{
    //Get PC
    object oPC = GetLastUsedBy();

    //Get Door
    object oDoor = GetObjectByTag("tri_dwarfdoor1");

    //have the PC act as if opening the door
    AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 0.7));
    //swing the door to open after a slight delay to allow for the PC's animation
    DelayCommand(1.0,ActionPlayAnimation(ANIMATION_PLACEABLE_OPEN));
    //get the target waypoint destination
    object oDrop = GetWaypointByTag("WP_tri_insidedwarf1");
    //clear all actions
    DelayCommand(1.3,AssignCommand (oPC,ClearAllActions()));
    //jump the PC to the destination
    DelayCommand(1.4,AssignCommand (oPC,JumpToObject(oDrop)));
    //close the door
    DelayCommand(1.5,ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE));

}