Recent changes Random page
GAMING
Gaming
 
WoWWiki
Halopedia
FFXIclopedia
Age of Conan
Warhammer Online
Grand Theft Wiki
See more...

Show the entire map to the PC if they buy a map from a merchant

From NWNWiki

Jump to: navigation, search

[edit] Show the Entire Map to the PC if they buy a map from a merchant

This actually quite simple. First you must make an Item to be used as a Map that the PC can buy / find. Give it a Tag something like "MAP" or "MapToSewers". In fact you can make one for each area if you want.

Place this script in the OnEnter of Each area you want the show the PC if they have a map. Change the word MAP to that of the Item TAG of your map for that area.

void main()
{
    object oPC = GetEnteringObject();
    // First lets make sure a PC entered
    if(GetIsPC(oPC))
        {
        // Check for the map
        if(GetIsObjectValid(GetItemPossessedBy(oPC,"MAP")))
            {
            ExploreAreaForPlayer(OBJECT_SELF,oPC);
            }
        }
}

[edit] Multiple Areas

For multiple areas and Maps you can use the Same script in the OnEnter of each area so you don't have 10 different map scripts. However the codeing is a bit more complex. We need to make sure the PC has the map for the area they are currently in. In this script you will need to specifiy the Area TAG for each map check.

void main()
{
    object oPC = GetEnteringObject();
    // First lets make sure a PC entered
    if(GetIsPC(oPC))
        {
        // Check for the map A
        if(GetIsObjectValid(GetItemPossessedBy(oPC,"MAPA")))
            {
            ExploreAreaForPlayer(GetObjectByTag("MAPA_Area_Tag_Hear"),oPC);
            }
        // Check for map B
        if(GetIsObjectValid(GetItemPossessedBy(oPC,"MAPB")))
            {
            ExploreAreaForPlayer(GetObjectByTag("MAPB_Area_Tag_Hear"),oPC);
            }
        // Check for map C
        if(GetIsObjectValid(GetItemPossessedBy(oPC,"MAPC")))
            {
            ExploreAreaForPlayer(GetObjectByTag("MAPC_Area_Tag_Hear"),oPC);
            }
        }
}

Of course there are other, more advanced ways to do multiple maps but if you only have a few, this is the easiest to understand and use.

Also Note: Do NOT tag your maps with the same tag as the area. Although it may work when you test it, chances are it won't work after adding more areas. The reason is how GetObjectByTag() works. It may get the area (which is what we want) or it may Get the Map item on the PC. which is what we don't want.

Finally, if you simply want to explore the area for a PC with no map, use this

void main()
{
    object oPC = GetEnteringObject();
    if(GetIsPC(oPC))
        {
        ExploreAreaForPlayer(OBJECT_SELF,oPC);
        }
}
Rate this article:
Share this article: