Author Topic: Certain Areas Only  (Read 635 times)

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« on: November 30, 2010, 07:31:05 pm »


               I was wondering if there is a way to place a script on to specific areas. What I mean is I have something like a wrapper script on every Areas OnEnter but I want a certain thing to happen... say to only my underdark areas; which all my underdark areas tag starts with underdark _###.

So I was wondering if I can use:
// Prevent Area's Map to be seen
if(GetStringLeft(GetTag(oArea), 6) == "Underdark")
{
ExecuteScript("block_ar_map", oPC);
}

Would something like this work or is their another way to make this happen?

Thanks in advance.
Taino
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Certain Areas Only
« Reply #1 on: November 30, 2010, 07:57:44 pm »


               I see no problems with your solution.

EDIT:  Just remember that the OnAreaEnter event fires for every object that enters the area, So make sure you have a filter so your script does not fire for every critter that spawns in the area.
               
               

               


                     Modifié par Lightfoot8, 30 novembre 2010 - 08:02 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Certain Areas Only
« Reply #2 on: November 30, 2010, 10:10:03 pm »


               This would be a good use of the area's heartbeat actually. Use it to erase and keep erasing the players minimaps. I know, you're blinking and staring in disbelief now, but ... area heartbeats only run while someone is in that area. Same with triggers. Their heartbeats only run when someone is inside the trigger. Either would be very useful in this case and should be low impact, despite being dreaded "hearbeats". '<img'>
               
               

               


                     Modifié par kalbaern, 30 novembre 2010 - 10:10 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Certain Areas Only
« Reply #3 on: November 30, 2010, 10:19:08 pm »


               420 has a really great solution but I am chilling at Panera and do not have my home PC out though like Kal says, not all heartbeats are killers. This one is a good one to use it on as we do the same in Dungeons and such like without a player buying a map.



(Triggers work but do some blocky stuff depending on if you use a floor placeable or something similiar.)
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Certain Areas Only
« Reply #4 on: November 30, 2010, 10:51:53 pm »


               Don't use tags, and don't use heartbeats. The first is too limiting, and the latter unnecessary. Tags were the old way of identifying area characteristics, waaaaaaay back in the day, for one simple reason: people were unable to set ints in the toolset, it had to be done ingame. Now, however, you don't have to operate under that limitation. Variables are FAR more flexible.

We do what you're wanting to do on HG, using a combination of variables. There's one if an  area is underwater, another if immortals are subject to respawn there, and still another if the area applies some kind of penalty. All of those are handy for when you want to do something to a group of areas. For things that only apply in a single area, we have our generic area script for that event fire off a custom script specified by variable on the area. Here, by way of example, is our area enter script, which is on most areas in the mod, save for a few very old ones which don't need it. It handles everything that needs handling in an area entry script, like NPC spawnins, despawn tracking (antiexploit), and much much more:


#include "hg_inc"
#include "hg_area_inc"
#include "hg_antiex_inc"
#include "fky_environ_inc"
#include "ac_qstatus_inc"

#include "tsk_inc"

void DoAreaEffects (object oArea, object oPC, int nDamAmount, int nDamType, int nDamVis, string sMessage) {
    if (GetArea(oPC) != oArea)
        return;

    if (!GetIsDead(oPC) && !GetPlotFlag(oPC)) {
        if (nDamType < 0) {
            if (nDamType == -1) {
                int nBreath = GetCanBreatheWater(oPC, TRUE);

                if (nBreath == 2)
                    return;

                if (!nBreath) {
                    if (GetLocalInt(oPC, "Area_WaterBreath_Warning") < 3) {
                        FloatingTextStringOnCreature("You cannot hold your breath much longer!", oPC, FALSE);
                        AddLocalInt(oPC, "Area_WaterBreath_Warning", 1);
                    } else {
                        FloatingTextStringOnCreature("You can no longer hold your breath!", oPC, FALSE);
                        DeleteLocalInt(oPC, "Area_WaterBreath_Warning");

                        ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDeath()), oPC);
                    }
                } else
                    DeleteLocalInt(oPC, "Area_WaterBreath_Warning");
            } else if (nDamType == -2) {
                int nLev = GetCanLevitate(oPC);

                if (nLev == 2)
                    return;

                if (!nLev) {
                    if (!GetIsResting(oPC))
                        FloatingTextStringOnCreature("You are unable to control your motion in the air!", oPC, FALSE);

                    RemoveEffectsOfType(EFFECT_TYPE_CUTSCENEIMMOBILIZE, oPC, oArea);

                    effect eEff = SupernaturalEffect(EffectCutsceneImmobilize());
                    DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEff, oPC, 9.0));
                }
            } else if (nDamType == -3) {
                /* passwall; do nothing */
                return;
            } else if (nDamType == -4) {
                int nFirewalk = GetCanFirewalk(oPC);

                if (nFirewalk == 2)
                    return;

                if (!nFirewalk) {
                    FloatingTextStringOnCreature("You are unable to breathe elemental fire!", oPC, FALSE);

                    ApplyDirectDamage(oPC, (GetMaxHitPoints(oPC) * 2) / 5, DAMAGE_TYPE_INTERNAL,
                                      DAMAGE_POWER_ENERGY, "Elemental Fire", "You burn to a crisp!");
                    ApplyVisualToObject(VFX_IMP_FLAME_M, oPC);
                }
            }
        } else {
            effect eDam = EffectDamage(d10(nDamAmount), nDamType);
            effect eVis = EffectVisualEffect(nDamVis);

            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oPC);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

            if (sMessage != "")
                FloatingTextStringOnCreature(sMessage, oPC, FALSE);
        }
    }
    DelayCommand(6.0, DoAreaEffects(oArea, oPC, nDamAmount, nDamType, nDamVis, sMessage));
}

void DoDust (object oPC, object oItem) {
    SetPlotFlag(oItem, FALSE);
    DestroyObject(oItem);
    CreateItemOnObject("drowdust", oPC);
}

object GetVFXLoopTarget (object oSource, string sTarget) {
    int nCount = 1;
    struct SubString ss = GetFirstSubString(sTarget, "#");

    if (ss.rest != "") {
    }

    return GetNearestObjectByTag(ss.first, oSource, nCount);
}

float GetVFXLoopVaryingFloat (float fRand) {
    int nVary = FloatToInt(fRand * 100.0);
    nVary = Random((nVary * 2) + 1) - nVary;

    return (nVary * 0.01);
}

void VoidBroadcastProjectileToObject (object oSource, object oTarget, int nSpellId, int nDelay) {
    BroadcastProjectileToObject(oSource, oTarget, nSpellId, nDelay);
}

void DoVFXLoop (object oVFX, int nVis, float fCyc, float fDur, string sTarget, int bBeam,
                float fCycRand, float fDurRand, int nMulti, float fMultiInt, float fMultiRand) {
    if (GetLocalInt(OBJECT_SELF, "Area_Clear")) {
        AddLocalInt(OBJECT_SELF, "Area_VFX_Active", -1);
        return;
    }

    if (nMulti > 1) {
        /* ugly to have a second copy, but removes unnecessary delaycommands */
        int i;
        float fDelay = 0.0;

        for (i = 0; i < nMulti; i++) {
            float fDurVary = GetVFXLoopVaryingFloat(fDurRand);

            if (sTarget != "") {
                object oTarget = GetVFXLoopTarget(oVFX, sTarget);

                if (bBeam) {
                    effect eBeam = EffectBeam(nVis, oVFX, BODY_NODE_CHEST, (bBeam == 2));
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, fDur + fDurVary));
                } else if (nVis < 0) {
                    DelayCommand(fDelay, VoidBroadcastProjectileToObject(oVFX, oTarget, -nVis, FloatToInt((fDur + fDurVary) * 1000.0)));
                } else if (fDur > 0.0) {
                    effect eVis = EffectVisualEffect(nVis);
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, fDur + fDurVary));
                } else {
                    DelayCommand(fDelay, ApplyVisualToObject(nVis, oTarget));
                }
            } else {
                if (fDur > 0.0) {
                    effect eVis = EffectVisualEffect(nVis);
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oVFX, fDur + fDurVary));
                } else {
                    DelayCommand(fDelay, ApplyVisualToObject(nVis, oVFX));
                }
            }

            fDelay += fMultiInt + GetVFXLoopVaryingFloat(fMultiRand);
        }
    } else {
        float fDurVary = GetVFXLoopVaryingFloat(fDurRand);

        if (sTarget != "") {
            object oTarget = GetVFXLoopTarget(oVFX, sTarget);

            if (bBeam) {
                effect eBeam = EffectBeam(nVis, oVFX, BODY_NODE_CHEST, (bBeam == 2));
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, fDur + fDurVary);
            } else if (nVis < 0) {
                BroadcastProjectileToObject(oVFX, oTarget, -nVis, FloatToInt((fDur + fDurVary) * 1000.0));
            } else if (fDur > 0.0) {
                effect eVis = EffectVisualEffect(nVis);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, fDur + fDurVary);
            } else {
                ApplyVisualToObject(nVis, oTarget);
            }
        } else {
            if (fDur > 0.0) {
                effect eVis = EffectVisualEffect(nVis);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oVFX, fDur + fDurVary);
            } else {
                ApplyVisualToObject(nVis, oVFX);
            }
        }
    }

    float fCycVary = GetVFXLoopVaryingFloat(fCycRand);
    DelayCommand(fCyc + fCycVary, DoVFXLoop(oVFX, nVis, fCyc, fDur, sTarget, bBeam, fCycRand, fDurRand, nMulti, fMultiInt, fMultiRand));
}


void main () {
    object oPC = GetEnteringObject();
    object oArea = GetArea(oPC);

    if (GetIsPC(oPC)) {
        DeleteLocalInt(oArea, "Area_Clear");

        int bReveal = GetLocalInt(oArea, "Area_Reveal");
        if (bReveal > 0)
            ExploreAreaForPlayer(oArea, oPC, TRUE);
    }

    if (GetLocalString(oPC, "FKY_CHAT_PASSWORD_IP") == "CHECK")
        AssignCommand(GenCreator(), ApplyPasswordHold(oPC));

    /* execute specific onenter script if specified */
    string sScript = GetLocalString(oArea, "Area_OnEnter");
    if (sScript != "")
        ExecuteScript(sScript, oArea);

    /* PC-only stuff below here */
    if (!GetIsPC(oPC))
        return;

    if (GetLocalInt(oArea, "Area_VFX_Objects") > 0 &&
        GetLocalInt(oArea, "Area_VFX_Active") == 0) {

        int i, nObjects = GetLocalInt(oArea, "Area_VFX_Objects");
        object oVFX;

        for (i = 0; i < nObjects; i++) {
            oVFX = GetLocalObject(oArea, "Area_VFX_Object_" + IntToString(i));
            if (GetIsObjectValid(oVFX)) {
                int    nVis       = GetLocalInt(oVFX,    "VFX_Loop");
                int    nMulti     = GetLocalInt(oVFX,    "VFX_Loop_Multi");
                int    bBeam      = GetLocalInt(oVFX,    "VFX_Loop_Beam");
                float  fCyc       = GetLocalFloat(oVFX,  "VFX_Loop_Cycle");
                float  fCycRand   = GetLocalFloat(oVFX,  "VFX_Loop_Cycle_Vary");
                float  fDur       = GetLocalFloat(oVFX,  "VFX_Loop_Dur");
                float  fDurRand   = GetLocalFloat(oVFX,  "VFX_Loop_Dur_Vary");
                float  fMultiInt  = GetLocalFloat(oVFX,  "VFX_Loop_Multi_Int");
                float  fMultiRand = GetLocalFloat(oVFX,  "VFX_Loop_Multi_Int_Vary");
                string sTarget    = GetLocalString(oVFX, "VFX_Loop_Target");

                AddLocalInt(oArea, "Area_VFX_Active", 1);
                AssignCommand(oArea, DelayCommand(fCyc, DoVFXLoop(oVFX, nVis, fCyc, fDur, sTarget, bBeam, fCycRand, fDurRand, nMulti, fMultiInt, fMultiRand)));
            }
        }
    }

    /* if the PC is not allowed in the area, boot them and return */
    if (!CheckAreaTagRequirement(oArea, oPC))
        return;

    string sQuest = GetLocalString(oArea, "Area_Quest");
    if (sQuest != "")
        QSAddQuestStatus(sQuest, 1);

    /* for Hell and Limbo areas, set the Succor_ local */
    if (GetLocalInt(oArea, "notele") > 0)
        SetLocalInt(oPC, "Succor_" + GetResRef(oArea), 1);


    /* area damage/underwater areas */
    /* TODO: enhance this to be more generic, e.g. Hells penalties */
    if (!GetIsDM(oPC)) {
        int nDamType = GetLocalInt(oArea, "Area_Damage_Type");
        if (GetLocalInt(oArea, "Area_Underwater"))
            nDamType = -1;
        else if (GetLocalInt(oArea, "Area_Aerial"))
            nDamType = -2;
        else if (GetLocalInt(oArea, "Area_Passwall"))
            nDamType = -3;
        else if (GetLocalInt(oArea, "Area_Firewalk"))
            nDamType = -4;

        if (nDamType) {
            int nDamAmount  = GetLocalInt(oArea, "Area_Damage_Amount");
            int nDamVis     = GetLocalInt(oArea, "Area_Damage_VFX");
            string sMessage = GetLocalString(oArea, "Area_Damage_Message");

            AssignCommand(oArea, DoAreaEffects(oArea, oPC, nDamAmount, nDamType, nDamVis, sMessage));
        }


        /* destroy items that cannot survive in daylight */
        if (GetIsDay()                &&
            !GetIsAreaInterior(oArea) &&
            GetIsAreaAboveGround(oArea)) {

            int i;
            object oItem;

            for (i = 0; i < NUM_INVENTORY_SLOTS; i++) {
                oItem = GetItemInSlot(i, oPC);

                if (GetStringLeft(GetTag(oItem), 4) == "asdf")
                    DoDust(oPC, oItem);
            }

            if (GetIsObjectValid(oItem = GetItemPossessedBy(oPC, "sealofshadows")))
                DestroyObject(oItem);
        }
    }


    /* spawn anything specified in area locals */
    int nSpawns = GetLocalInt(oArea, "Area_Spawns");
    string sTask;
    struct IntList li;

    if (nSpawns > 0) {
        int i, nType;
        string sKey, sTag, sRes, sLoc, sLocType;
        object oSpawn;
        location lSpawn;

        for (i = 1; i <= nSpawns; i++) {
            sKey = "Area_Spawn_" + IntToString(i);
            sTag = GetLocalString(oArea, sKey + "_Tag");


            /* if the object has already been spawned, skip it */
            if (sTag != "") {
                if (GetIsObjectValid(GetNearestObjectByTag(sTag, oPC)))
                    continue;
            } else {
                if (GetIsObjectValid(GetLocalObject(oArea, sKey + "_Obj")))
                    continue;
            }


            sRes  = GetLocalString(oArea, sKey + "_Res");
            sLoc  = GetLocalString(oArea, sKey + "_Loc");
            nType = GetLocalInt(oArea, sKey + "_Type");

            if (nType == 0)
                nType = OBJECT_TYPE_CREATURE;

            sLocType = GetStringLeft(sLoc, 1);


            if (sLocType == "!")
                lSpawn = GetLocation(GetNearestObjectByTag(GetSubString(sLoc, 1, 64), oPC));
            else if (sLocType == "@")
                lSpawn = GetLocation(GetWaypointByTag(GetSubString(sLoc, 1, 64)));
            else if (sLocType == "&") {//designates task creature, only spawn if pc requires (uses waypoint)  ex: tsk_cr_1_2
                sTask = GetStringRight(sRes, (GetStringLength(sRes) - 7));
                li = GetIntList(sTask, "_");
                if (!GetPCHasTaskActive(oPC, li.i0) || (GetTaskCompleted(oPC, li.i0) != (li.i1 - 1)))//if they don't have the task active, don't spawn
                    continue;
                else
                    lSpawn = GetLocation(GetWaypointByTag(GetSubString(sLoc, 1, 64)));
            } else
                continue;


            if (GetAreaFromLocation(lSpawn) == oArea) {
                oSpawn = CreateObject(nType, sRes, lSpawn, FALSE, sTag);
                SetLocalObject(oArea, sKey + "_Obj", oSpawn);
            }
        }
    }


    /* respawn loot or other other respawnables */
    nSpawns = GetLocalInt(oArea, "Area_Respawns");

    if (nSpawns > 0) {
        int i, nType, nRespawnTime, nUptime = GetLocalInt(GetModule(), "uptime");
        string sKey, sVar;
        object oSpawn;

        for (i = 1; i <= nSpawns; i++) {
            sKey = IntToString(i);

            nRespawnTime = GetLocalInt(oArea, "Area_Respawn_" + sKey);
            if (nRespawnTime <= 0 ||
                nRespawnTime > nUptime ||
                GetIsObjectValid(GetLocalObject(oArea, "Area_Respawn_Obj_" + sKey)))
                continue;

            oSpawn = CreateObject(GetLocalInt(oArea, "Area_Respawn_Type_" + sKey),
                GetLocalString(oArea, "Area_Respawn_Res_" + sKey),
                GetLocalLocation(oArea, "Area_Respawn_Loc_" + sKey));

            SetLocalObject(oArea, "Area_Respawn_Obj_" + sKey, oSpawn);

            if ((sVar = GetLocalString(oArea, "Area_Respawn_Var_" + sKey)) != "")
                AssignCommand(oArea, DelayCommand(0.0, RestoreLocals(oSpawn, sVar)));
        }
    }

    /* clear despawn setting on area */
    if (GetLocalInt(oArea, "DespawnTrack")) {
        int nDespawnTime = GetLocalInt(oArea, "DespawnTime");
        if (nDespawnTime) {
            int nUptime = GetLocalInt(GetModule(), "uptime");
            if ((nUptime - 3600) > nDespawnTime) {
                DeleteLocalInt(oArea, "DespawnTime");
                DeleteLocalInt(oArea, "DespawnCount");
            }
        }
    }
}

This setup allows you to specific things with much much more detail than a tag-based setup (trust me, I tried using on in the first group of areas I made, back in the day, and we wound up converting to variable-based methods just a short time later). Here, for example, are all the variables set on one of our Abyss areas, the reef at the base of Demogorgon's fortress Abysm:

Abyss Level int 14
Area_OnEnter string aby_enter
Area_Penalties int 4
Area_Rest_Monster string aby_ixitpriest aby_ixitcultist aby_vampiricixit
Area_SpellHook string zwund_spellhook
Area_Underwater int 1
DespawnTrack int 1
HellLootSpawn int 4
Loot int 10
LootF int 66
NoImmo int 5
notele int 2

Imagine trying to store all that in a tag, one able to hold various other settings. It would be absurdly long, and much harder to make sense of, let alone change on the fly. There is simply no way in which tags are superior to variables for this purpose.

Funky
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Certain Areas Only
« Reply #5 on: November 30, 2010, 11:02:51 pm »


               

kalbaern wrote...

This would be a good use of the area's heartbeat actually. Use it to erase and keep erasing the players minimaps. I know, you're blinking and staring in disbelief now, but ... area heartbeats only run while someone is in that area. Same with triggers. Their heartbeats only run when someone is inside the trigger. Either would be very useful in this case and should be low impact, despite being dreaded "hearbeats". '<img'>

Almost forgot to respond to this. This is completely, totally incorrect. Both area and trigger heartbeats run regardless of whether someone is in them. Test and see for yourself. Pseudos are your friend.

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Certain Areas Only
« Reply #6 on: November 30, 2010, 11:05:32 pm »


               

kalbaern wrote...

... area heartbeats only run while someone is in that area. ...



I do not know how many times I have heard this,  It is false.  Area heartbeats will run even if no one is in the area. 


EDIT: lol  Funky beat me to it, while I was testing to make sure my memory was not faulty.
               
               

               


                     Modifié par Lightfoot8, 30 novembre 2010 - 11:08 .
                     
                  


            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #7 on: December 01, 2010, 12:25:44 am »


               This use wont be for the heartbeat on the Areas Event. It is pretty much an idea for the OnEnter and what I'm trying to eliminate is having to place a variable in every area I create and also it seems when I place the variables on areas where if the players have a map it wont work.

Here's what my areas event looks like:
//:: mod_ar_onenter
////////////////////////////////////////////////////////////////////////////////
#include "spawn_functions"
#include "nw_i0_tool"
////////////////////////////////////////////////////////////////////////////////
void main()
{
     object oPC = GetEnteringObject();
//******************************************************************************\\\\
//:: Map Unexplored
//******************************************************************************//
     ExecuteScript("map_unexplored", OBJECT_SELF);
//******************************************************************************\\\\
//:: NESS
//******************************************************************************//
     Spawn_OnAreaEnter();
//******************************************************************************\\\\
//:: Area OnEnter Function
//******************************************************************************//
//:: Area:: Training Area
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Training_Area")            { ExecuteScript("reveal_map_00",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Starting Point
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Module_Starting_Point")    { ExecuteScript("newbie_jump",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Faerunian_Pantheon
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Faerunian_Pantheon")       { ExecuteScript("newbie_start_itm", OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Prison
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "PRISON")                   { ExecuteScript("reveal_jail_map",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Underdark: Upperdark: Araumtcos
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Araumtcos_906"  || GetTag(OBJECT_SELF) == "Araumtcos_907" ||
        GetTag(OBJECT_SELF) == "Araumtcos_908"  || GetTag(OBJECT_SELF) == "Araumtcos_909" ||
        GetTag(OBJECT_SELF) == "Araumtcos_913"  || GetTag(OBJECT_SELF) == "Araumtcos_914" ||
        GetTag(OBJECT_SELF) == "Araumtcos_915"  || GetTag(OBJECT_SELF) == "Araumtcos_917" ||
        GetTag(OBJECT_SELF) == "Araumtcos_918"  || GetTag(OBJECT_SELF) == "Araumtcos_919" ||
        GetTag(OBJECT_SELF) == "Araumtcos_920"  || GetTag(OBJECT_SELF) == "Araumtcos_924" ||
        GetTag(OBJECT_SELF) == "Araumtcos_925"  || GetTag(OBJECT_SELF) == "Araumtcos_926") {
        ExecuteScript("f_area_g_enter",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Undraeth City Avalanche Cavern
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Undraeth_Avalanche_Cavern")      { ExecuteScript("oe_mine",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Ched Nasad
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "Ched_Nasad_001")                 { ExecuteScript("info_chedn_001",OBJECT_SELF); }
//******************************************************************************\\\\
//:: Area:: Show Area if Player has specific Map
//******************************************************************************//
     if(GetIsPC(oPC) && !GetIsDM(oPC))  {
//******************************************************************************\\\\
//:: Itzal
//******************************************************************************//
     if(GetTag(OBJECT_SELF) == "ITZAL_NORTH_WARD" || GetTag(OBJECT_SELF) == "ITZAL_SOUTH_WARD") {
       if((!HasItem(oPC, "MAP_ITZAL")) == FALSE) {
            ExploreAreaForPlayer(OBJECT_SELF, oPC);
            }
         }
//******************************************************************************\\\\
//:: Abburth Drow City
//******************************************************************************//
     else if(GetTag(OBJECT_SELF) == "Abburth_City") {
          if((!HasItem(oPC, "MAP_ABBURTH")) == FALSE) {
            ExploreAreaForPlayer(OBJECT_SELF, oPC);
            }
         }
//******************************************************************************\\\\
//:: Undraeth City "Merciless Drow City"
//******************************************************************************//
     else if(GetTag(OBJECT_SELF) == "Undraeth_City_1" || GetTag(OBJECT_SELF) == "Undraeth_City_2" ||
             GetTag(OBJECT_SELF) == "Undraeth_City_3" || GetTag(OBJECT_SELF) == "Undraeth_City_4") {
          if((!HasItem(oPC, "MAP_UNDRAETH")) == FALSE) {
            ExploreAreaForPlayer(OBJECT_SELF, oPC);
            }
         }
//******************************************************************************\\\\
//:: Morander "City of the Ever Living"
//******************************************************************************//
     else if(GetTag(OBJECT_SELF) == "Morander_City_1" || GetTag(OBJECT_SELF) == "Morander_City_2" ||
             GetTag(OBJECT_SELF) == "Morander_City_3" || GetTag(OBJECT_SELF) == "Morander_City_4") {
          if((!HasItem(oPC, "MAP_MORANDER")) == FALSE) {
            ExploreAreaForPlayer(OBJECT_SELF, oPC);
            }
        }
    }
}

This is what map_unexplored is.
//:: map_unexplored
////////////////////////////////////////////////////////////////////////////////
//  Called by an Area OnEnter script, this function Hides the Map from oPlayer;
//  while oPlayer is in the Area, the Map updates every fDelay seconds.
////////////////////////////////////////////////////////////////////////////////
void SetMapUnexplored(object oPlayer, float fDelay = 3.0);
void SetMapUnexplored(object oPlayer, float fDelay = 3.0)
{
    if(GetArea(oPlayer) == OBJECT_SELF)
    {
        ExploreAreaForPlayer(OBJECT_SELF, oPlayer, FALSE);
        DelayCommand(fDelay, SetMapUnexplored(oPlayer, fDelay));
    }
}
////////////////////////////////////////////////////////////////////////////////
//  Area OnEnter script ...
////////////////////////////////////////////////////////////////////////////////
void main()
{
    object oPC = GetEnteringObject();
    if(GetIsPC(oPC) && !GetIsDM(oPC))
        SetMapUnexplored(oPC, GetLocalFloat(OBJECT_SELF, "Map_Update"));
}

Like I said above is what Im trying to do is place the map_unexplored only for my underdark areas. This way if the players have a city map the can view the mini map of the city. Just wondering if my idea would work.. If so cool if not then anyone got a better idea?

Thanks in advance!!!
Taino
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #8 on: December 01, 2010, 12:30:39 am »


               Funky, I can see your point and how you can place things correctly. Unfortunately that scripting is a bit outta my league. One day I would like to be at that level of a scripter but one must take baby steps. '<img'>
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #9 on: December 01, 2010, 12:40:06 am »


               Also should I change my GetTag to GetArea? Probably work better I take it.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Certain Areas Only
« Reply #10 on: December 01, 2010, 01:04:46 am »


               No, change it to GetLocalInt. Setting an int isn't any more difficult than setting a tag, and doesn't involve editing a script every time to want to add an area. I promise you, it's simply a better setup. No, really. If you don't want to listen to my advice, that's fine, but you're setting yourself up a fair amount of unnecessary hassle. I just don't see how you think setting a variable is more difficult than setting a tag AND editing and compiling a script. Nevermind the script sprawl.



To answer your question less coquettishly, there's no reason to use GetArea(OBJECT_SELF) in place of OBJECT_SELF. I would definitely only GetTag once, assigning a variable for the result, and comparing the variable - cleaner code, less overhead.



Funky
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #11 on: December 01, 2010, 01:53:54 am »


               Hmm, got it and I'm changing it to GetLocalInt now. Yes I haven't worked to much on calling a int from a script but I do have an idea. I also would take your advise as well as others.


Thanks,
Taino
               
               

               


                     Modifié par Taino, 01 décembre 2010 - 02:02 .
                     
                  


            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #12 on: December 01, 2010, 03:25:39 am »


               My idea didn't work. When I've added:
// Prevent Area's Map to be seen
    if(GetStringLeft(GetTag(oArea), 6) == "Underdark") {
    ExecuteScript("map_unexplored", oPC); {


Nothing happened like it did when I just had it:
ExecuteScript("map_unexplored", OBJECT_SELF);

Thanks in advance
Taino
               
               

               


                     Modifié par Taino, 01 décembre 2010 - 03:27 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Certain Areas Only
« Reply #13 on: December 01, 2010, 04:37:29 am »


               That is likely because Underdark is 9 characters, not 6. '<img'>



Funky
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Certain Areas Only
« Reply #14 on: December 01, 2010, 03:27:32 pm »


               *Duh* Wow I feel silly....