Hide parts of an area you've already been to

In my module I have an area you visit. Let’s say it’s a house. Then later in the module the PC and the companions are teleported back to that house, only in a different locked room. If you’ve already been to this house, you can clearly see that there’s a corridor outside and you see the other rooms you’ve been to. If you haven’t been there before everything outside the room is black.

Is there a way to make the areas outside of the room black even if you’ve been there before?

I tried with the ExploreAreaForPlayer function by setting it to false but that didn’t do anything:

// Expose the entire map of oArea to oPlayer.
// RWT-OEI 03/28/07 - Added parameter
// nExplored - If FALSE, it will unexplore the area for the player.
void ExploreAreaForPlayer(object oArea, object oPlayer, int nExplored=TRUE);

tl;dr i don’t see a totally satisfactory solution …

nExplored=FALSE seems to work with two caveats

a player in the area when the function is called is not immediately affected

It acts as a reset-the-area-to-unexplored every time the player subsequently enters that area … and there’s no way I can see to set the area back to normal exploration rules

 
if that’s not so good, here are a couple of big black placeables

tag
PLC_MC_TILEBLOCK1
PLC_MC_TILEBLOCK2

that can be created, sized, and destroyed … (if set non-static and walkable)

perhaps, when the party ports into the locked room, try creating a few of them to cover the floorplan of the rest of house and, if/when you want the party to recognize where they’re at once they get the door open, delete the blocks to reveal the area.

( if you choose to create them at waypoints, they probly line up with their north-west corners positioned at their waypoint, or similar – alternately set their scale to 0.0001 then use SetScale() to expand them )

HOWEVER they don’t appear to block the Map or Minimap …

 
lastly

// MAP 2/14/2009
// EXPERIMENTAL
// Creates a new area based on an existing area. The new area is loaded from
// disk (so created/destroyed contents in the original area will not be duplicated)
// however the walkmesh is shared with the existing area to reduce
// lag during load time, as well as to keep memory consumption lower.
object CreateInstancedAreaFromSource(object oArea);

but that could be a headache if the party changed the state of the area during a previous visit, plus potentially duplicated tags of objects etc

Actually, in this case it wouldn’t be too much of a problem. I’ve been a little vague becuase I don’t want to spoil my whole module here on the forums. But at the moment when the party teleports to this area I had this function on OnClientEnter and it didn’t do anything. If what you say is true it should have had some effect. I also change the music of the area and that happens in the script right after the ExploreAreaForPlayer so I know this part of the script runs.

If this won’t work I think the best and easiest sollution to this whole problem would be to just duplicate the area in the toolset (and erasing waypoints and whatnot as to eliminate potential problems). As I already have a lot of areas in my module I wanted to avoid that, but if there’s no other way I guess I’ll just have to go with that.

Here’s what the script looks like in the OnClientEnter of the area:

const string sDEST_NPC      		= "npc1wp";
const string sDEST_NPC2      		= "npc2wp";
const string sDEST_NPC3      		= "npc3wp";
const string sDEST_NPC4      		= "npc4wp";
const string sDEST_NPC5     		= "npc5wp";
const string sDEST_NPC6      		= "npc6wp";
const string sDEST_NPC7      		= "npc7wp";
const string sDEST_NPC8      		= "npc8wp";
const string sDEST_NPC9      		= "npc9wp";

#include "ginc_sound"

void transition(object oSitter, string sDest)
{    
    AssignCommand(oSitter, ClearAllActions());
    AssignCommand(oSitter, JumpToObject(GetWaypointByTag(sDest)));
}


void main()
{



object oNPC = GetObjectByTag("commhum2");
object oNPC2 = GetObjectByTag("commelf1");
object oNPC3 = GetObjectByTag("commhum1");
object oNPC4 = GetObjectByTag("commelf2");
object oNPC5 = GetObjectByTag("commhum4");
object oNPC6 = GetObjectByTag("commelf4");
object oNPC7 = GetObjectByTag("commhum3");
object oNPC8 = GetObjectByTag("chalfelf1");
object oNPC9 = GetObjectByTag("commelf3");

	if(GetGlobalInt("innsitting"))
	{

 	transition(oNPC, sDEST_NPC);
 	transition(oNPC2, sDEST_NPC2);
 	transition(oNPC3, sDEST_NPC3);
 	transition(oNPC4, sDEST_NPC4);
 	transition(oNPC5, sDEST_NPC5);
 	transition(oNPC6, sDEST_NPC6);
 	transition(oNPC7, sDEST_NPC7);
 	transition(oNPC8, sDEST_NPC8);
 	transition(oNPC9, sDEST_NPC9);
	}


SetGlobalInt("innsitting",1);

AssignCommand(oNPC, ActionInteractObject(GetObjectByTag("sitbench11")));
AssignCommand(oNPC2, ActionInteractObject(GetObjectByTag("sitbench2")));
AssignCommand(oNPC3, ActionInteractObject(GetObjectByTag("sitbench5")));
AssignCommand(oNPC4, ActionInteractObject(GetObjectByTag("sitbench10")));
AssignCommand(oNPC5, ActionInteractObject(GetObjectByTag("chairy1")));
AssignCommand(oNPC6, ActionInteractObject(GetObjectByTag("chairy2")));
AssignCommand(oNPC7, ActionInteractObject(GetObjectByTag("chairy3")));
AssignCommand(oNPC8, ActionInteractObject(GetObjectByTag("chairy4")));
AssignCommand(oNPC9, ActionInteractObject(GetObjectByTag("chairy5")));


object oPC = GetEnteringObject();

	if(!GetIsPC(oPC)) return;
	
	int nInt=GetLocalInt(oPC,"NW_JOURNAL_ENTRYq_margret");
	object oArea = GetObjectByTag("fbtavern");
	
	
	if (nInt == 11)
	{
	ExploreAreaForPlayer(oArea,oPC,FALSE);
	SaveMusicTrack(oArea);
	ChangeMusicTrack(oArea,3);
	SetLocalInt(oArea,"changedmusicstrack",1);
	}
	
	else if(GetLocalInt(oArea,"changedmusicstrack") && (nInt != 11))
	{	
	RestoreMusicTrack(oArea);		
	}
	

}

If one would to use CreateInstancedAreaFromSource, would you be able to erase that duplicate area once you leave it?

OnClientEnter won’t work. The PC is already in the area and hence the area won’t be set unexplored until PC re-enters the area.

i figur you’d have to set the area unexplored at the source of the teleport

that’s viable too …

nope

1 Like

Ah, I see. I’ll try that then. Thanks.

I tried running the script before going to the area and now it worked splendidly. I think I’ll do it like this actually. Or maybe I’ll change my mind once I’ve gotten further with the module, who knows.

Again, thanks for the help!

1 Like