Ok, I suspect with regards to your script you are doing it the difficult way.
The easier way is to store an object reference to the door on the destination door, and have the destination door store a reference to the origin door.
Then onTransition/Click - have it port the player to the destination door.
Don't worry about tags at all.
This is my 'OnDoorOpen' script
Note - this will be when the area is generated and the door you use is linked to the destination door.
#include "areas_inc"
#include "nwnx_funcs"
#include "nos_area_gen_inc"
void main()
{
int iInitialized = GetLocalInt(OBJECT_SELF,"INIT");
if(iInitialized)
{
//Find the target door, and open
object oDoor = GetLocalObject(OBJECT_SELF,"TARGET_DOOR");
int iOpen = GetIsOpen(oDoor);
if(!iOpen)
{
AssignCommand(oDoor,ActionOpenDoor(oDoor));
DelayCommand(15.00,AssignCommand(oDoor,ActionCloseDoor(oDoor)));//Close Interior Door after 15 Seconds
}
DelayCommand(15.00,ActionCloseDoor(OBJECT_SELF));
return;
}
object oCurrentArea = GetArea(OBJECT_SELF);
string sResSpecific = GetLocalString(OBJECT_SELF,"AREA_TYPE_SPECIFIC");
string sResRef;
if(sResSpecific == ""){
sResRef = TypeToRes(GetLocalString(OBJECT_SELF,"AREA_TYPE"));
}else
{
sResRef = GetStringLowerCase(sResSpecific);
}
string sTagPrefix = GetResRef(oCurrentArea);
int iDoorProcessed = GetLocalInt(oCurrentArea,"DOORS_DONE");
string sNewTag = sTagPrefix+"_"+IntToString(iDoorProcessed);
string sDestTag = sNewTag+"_INT";
iDoorProcessed++;
SetLocalInt(oCurrentArea,"DOORS_DONE",iDoorProcessed); //Increments the Door Number, to ensure other doors get a tag of +1 than this one.
NWNXFuncs_SetTag(OBJECT_SELF,sNewTag); //Set our tag, to unique tag
string sScript = GetLocalString(OBJECT_SELF,"SCRIPT_TO_RUN_ON_AREA");
// _hallsofthedivin
object oArea;
//Create the New Area
while(oArea == OBJECT_INVALID)
{
oArea = CreateArea(sResRef);
}
RestoreAreaSettings(oArea);
SetLocalInt(oArea,"GENERATED_AREA",1);
//Set Music etc
//The Area Should be created
object oDoor = GetFirstObjectInArea(oArea);
while(oDoor != OBJECT_INVALID)
{
if(GetObjectType(oDoor) == OBJECT_TYPE_DOOR && GetLocalInt(oDoor,"EXIT")==1)
{
NWNXFuncs_SetTag(oDoor,sDestTag); // Give it the destination Tag
SetLocalObject(OBJECT_SELF,"TARGET_DOOR",oDoor);
SetLocalObject(oDoor,"TARGET_DOOR",OBJECT_SELF);
SetLocalInt(oDoor,"INIT",1);
}
oDoor = GetNextObjectInArea(oArea);
}
if(sScript != "")
{
ExecuteScript(sScript,oArea);
}
SetLocalInt(OBJECT_SELF,"INIT",1);
}
Note - The way I did this was to either put a waypoint 'near' to the destination door I wanted to link to (with a tag of DEST) or something like that.
Or you can give your intended destination door a tag or variable to mark it as the proper destination door.
If you are looping through all doors in the area, trying to find the door you want to link to - you just need to mark the door as the right door so the script can find it.
The onUsedScript
This is what ports the player to the destination
Notice the lack of tag use.
Unique tags are required on the door - which is why I do a little bit of tag changing in the onOpen script.
I think internally - if the area and door have duplicate tags as other doors and areas in the module, then even door transitions can get banjaxed.
void main()
{
object oPC = GetClickingObject();
object oDest = GetLocalObject(OBJECT_SELF,"TARGET_DOOR");
AssignCommand(oPC, JumpToObject(oDest));
if(GetObjectType(oDest)==OBJECT_TYPE_DOOR)
{
if(!GetIsOpen(oDest))
{
AssignCommand(oDest,ActionOpenDoor(oDest));
}
}
string sExtra = GetLocalString(OBJECT_SELF,"EXTRA_SCRIPT");
if(sExtra != "")
{
DelayCommand(2.00,ExecuteScript(GetStringLowerCase(sExtra),OBJECT_SELF));
}
}
The close door script.
This is so closing on door, will close the door it is linked to.
Simulating the internal behavior from nwn vanilla.
void main()
{
object oDest = GetLocalObject(OBJECT_SELF,"TARGET_DOOR");
if(GetObjectType(oDest)==OBJECT_TYPE_DOOR)
{
if(GetIsOpen(oDest))
{
AssignCommand(oDest,ActionCloseDoor(oDest));
}
}
}