Secret door problem

I have a secret cave door (fully visible) (using the placeable {Cave Secret Door 2 (X1)} ) that I have set to “Locked”. When clicking upon this door I want a script to fire a conversation. When this failed I tried a bunch of SendMessageToPC to find out what the problem was, but whatever I do nothing happens ingame except that the door is locked. I tried putting the script on OnFailedToOpen, OnClick and on OnUsed. Still nothing happens. Then I took away most of the code and just had this:

#include "ginc_companion"

void main()
{

object oPC = GetClickingObject();
object oPC1 = GetFirstPC();
object oCavedoor = GetObjectByTag("i3caveds");

SendMessageToPC(oPC1,"The script is now running");

}

And still nothing happens. There must be something I’m missing since I get no message ingame whatever I do.

Is the character that’s clicking on the secret door the main PC or a companion?

Suggestion. As you are getting no screen output test that all the objects are valid and write the results of the test to the log file using the Function - WriteTimestampedLogEntry() -

void WriteTimestampedLogEntry(string sLogEntry);

TR

1 Like

@travus - It’s the main PC.

@Tarot_Redhand - I’m afraid I have no clue what you’re talking about here.

EDIT: I finally got something to happen. I tested with a normal Cave Entrance. Same thing there. Then I removed the Set To Plot, and when I then I had the script on FailedToOpen (not on OnClick) finally I got the message. So I will go from there and see if I can now figure this out.

I was about to say I tested this, and everything worked fine from the OnFailToOpen event:

void main()
{
	object oPC = GetClickingObject();

	ActionStartConversation(oPC, "talk_door");	
}

It made no difference if the door was plot TRUE or FALSE.

Well, somehow it did for me. I had a conversation I wanted to start and now finally after fiddling around with the script (and a few failed attempts) I got the conversation going.

I just use the ‘gp_talk_door’ script in the ‘On Fail To Open Script’ slot.

1 Like

I usually use the gp_talk_door too when I want to converse with placeables, but I tend to put it on the OnUsed slot instead. This situation with a door is a bit different though. You have to make sure you aren’t teleported anywhere by mistake.

EDIT: One thing I noticed with further testing was that if I controlled a companion who’s a rogue and that one tried to unlock the door, and then failed, the conversation wouldn’t start. I haven’t tried with a PC who’s rogue so that makes me wonder if that would be a problem…

EDIT2: Tested it, and it’s indeed a problem. I think I did something like this in my second module. I’ll have to look at that and see how I went about things there…

EDIT3: I hate this. Apparently I used gp_talk_object on the OnFailedToOpen. I was hoping to not have to use that. I have my own script that doesn’t use the GetLastUsedBy. Do you really have to use that? OK, I think I’ll have to (reluctantly) post my script here again then. Maybe you have some insight into what I’m doing wrong, and how I must do things to make it work:

#include "ginc_companion"

void DamnDelays(object oCompanion)
{

object oPC = GetFirstPC(FALSE);
object oPC1 = GetFirstPC();
object oCavedoor = GetObjectByTag("i3caveds");


	if(!GetGlobalInt("AnswerRunes") && !GetLocalInt(OBJECT_SELF,"TalkCaveEntrance"))
	{

		
		object oFM = GetFirstFactionMember(oPC1);
		
		
		while(GetIsObjectValid(oFM))
		{
	
		AssignCommand(oFM, ClearAllActions());
		AssignCommand(oFM, ActionJumpToObject(oPC));
		
		oFM = GetNextFactionMember(oPC1, FALSE);
		}
	
		
		SetLocalInt(OBJECT_SELF,"TalkCaveEntrance",1);
		DelayCommand(0.2,AssignCommand(oCompanion, ActionStartConversation(oPC1, "c_i3_cavedoor", FALSE, FALSE, TRUE, FALSE)));
		
	}

	else if(GetGlobalInt("AnswerRunes")&& !GetLocalInt(OBJECT_SELF,"TalkCaveEntranceAgain"))
	{
	
		object oFM = GetFirstFactionMember(oPC1);
		
		
		while(GetIsObjectValid(oFM))
		{
	
		AssignCommand(oFM, ClearAllActions());
		AssignCommand(oFM, ActionJumpToObject(oPC1));
		
		oFM = GetNextFactionMember(oPC1, FALSE);
		}
	
		
	
		SetLocalInt(OBJECT_SELF,"TalkCaveEntranceAgain",1);
		DelayCommand(0.2,AssignCommand(oCompanion, ActionStartConversation(oPC1, "c_i3_cavedoor", FALSE, FALSE, TRUE, FALSE)));
	
	}
	
	else if(GetGlobalInt("AnswerRunes")&& GetLocalInt(OBJECT_SELF,"TalkCaveEntranceAgain"))
	{
	
		SetLocked(oCavedoor,FALSE);
		JumpPartyToArea(oPC1, GetWaypointByTag("intothecave"));

	}
	
	
	

	
	
	


}


void main()
{

object oPC1 = GetFirstPC();
object oCavedoor = GetObjectByTag("i3caveds");

//SendMessageToPC(oPC1,"The script is now running");

if(GetIsInCombat(oPC1)) return;


string sCompanion = GetFirstRosterMember();

	while(!GetIsRosterNameInParty(oPC1,sCompanion))
	{
		
		sCompanion = GetNextRosterMember();
		
	}
	
object oCompanion = GetObjectByTag(sCompanion);	

DelayCommand(0.2,DamnDelays(oCompanion));
	

}

EDIT4: Rant: Apparently this is impossible for some reason! Gawd darn I hate this game sometimes! Alright, seems like I have to do it the dumb way (the only way the game wants to do it) by taking my conversation and add in all potential companions in the dialogue and check each and every one of those there instead. I would have wanted my slick way of just checking what companions are in the party and let one of them be the owner of the conversation, but no, no, it HAS to be the object that’s the conversation owner otherwise it doesn’t work! That’s how NWN2 wants to do things. FINE!

Ok, I think I’m losing my mind now. It still won’t work. I put the gp_talk_object script on the OnFailToOpen, use my rogue companion and try to open the door, but the conversation doesn’t fire. I’ve placed the conversation in the conversation slot on the door even…I have no idea what’s going on anymore…
I even tried and copied travus exact script (just changing the conversation name tag) and it didn’t work either.

EDIT: I finally got it to work! I put Key Required TRUE and then it worked. Didn’t know that part was so important.

EDIT2: I could even use my original script and it worked now. And it even worked with setting Plot to True.

2 Likes