Author Sticky: Post Working Scripts Here
Zinderin Posted: Monday, 08 July 07:39PM
Script Name: sc_multi_in_dr & sc_multi_out_dr

What it does: Allows you to create a single area with multiple doors leading in, and only one door out...but that door sends you back to the door you came in through. Purpose...you have 40+ houses in your exterior map...you don't want to create 40+ homes...this script allows you to create one home and all the doors will lead to that home. You can then add the needed code to create objects or destroy objects so that the area looks different. Up to you.

Notes: Each exterior door needs a unique tag...all can have the same tag, but their tag must be different from the generic doors.

The interior door needs to have a unique tag at well.

Now to keep things simple (and to make the script visually believable) and generic. You outside doors need to do a transition to the interior door (multiple doors can tranisition to a single door). (i)IMPORTANT: When setting up your transition, do it from the exterior door and make sure you check it so it transitions "from current to target" ... DO NOT TRANSITION BOTH WAYS.(/i)

Then on the OnUsed event of the exterior doors, place this script:

NWScript:
void main()

{

  object oPC = GetLastUsedBy();

  SetLocalObject(oPC,"oLastUsedDoor",OBJECT_SELF);

  DelayCommand(5.0,ActionCloseDoor(OBJECT_SELF));

}



On the single interior door's OnUsed event, place this script:

NWScript:
{

  object oPC = GetLastUsedBy();

  object oDestination = GetLocalObject(oPC,"oLastUsedDoor");

  AssignCommand(oPC,JumpToObject(oDestination,FALSE));

  DelayCommand(2.0,ActionCloseDoor(OBJECT_SELF));

}



You're done.

You can use these two scripts in multiple scenarios without conflict...in other words, you could have multiple doors leading to a single home, and then you could have multiple warehouse doors that lead to a single warehouse, etc. What door goes to what area is set up in the transition...just make sure you have unique tags for the sets.

Enjoy.

Brett