Author Sticky: Post Working Scripts Here
Katsuia Posted: Monday, 08 July 02:17PM
This script is for:

The player may only leave the town through a "DOOR"-Object (which is attached to a waypoint), if he's got
a spec. item (in this case a map) his inventory.

Put the script into the Door-Properties/Scripts -> OnAreaTransitionClick

NWScript:
void main ()

{

 object oClicker = GetClickingObject();

 object oTarget = GetTransitionTarget(OBJECT_SELF);

 object oMap = GetItemPossessedBy(oClicker, "Map");

 if (oMap == OBJECT_INVALID)

 {

   // Here you can put in something like

   // "Hey I won't leave without a map. I don't 

   //  want to get lost"

 }

 else

 {

   location lLoc = GetLocation(oTarget);

   AssignCommand(oClicker,JumpToLocation(lLoc));

 }

}