Author Topic: Question about area building...  (Read 1259 times)

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Question about area building...
« Reply #15 on: March 23, 2015, 06:45:25 am »


               


Basic advice - script CLEANLY, efficiently and you need not worry about 'too many areas'.


 


My server is stable, does not lag, does not crash, is repleat with smooth-running features, and boasts 1337+ Areas. Emphasis on the "+". NWN is a robust game, well built and stable. More, it was built for machines we were running 14 years ago... today's machines are far superior. The bottom line is this, unless the user does something really not-well-thought-out, NWN will  run fine. If you start to see lag or running crash issues, look to the systems used first (rather than too many areas).




 


I'm not too concerned about hitting the resource limit. But it just seems silly for me to tie up my mod with multiple single room areas for this or that shop when many that reside in the same general area (like a city) can be consolidated into a single area and a little fog of war trickery to give the illusion of being in that one shop. It just makes managing the mod in the toolset less of a hassle for me when I'm working instead of scrolling through a list of hundreds of areas.


               
               

               
            

Legacy_an ominous cow herd

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Question about area building...
« Reply #16 on: March 26, 2015, 11:12:03 pm »


               

The builders for Thain have, in recent history, consolidated many of the city interiors into one area (for each city). It's worked well for us, and certainly makes browsing the area list in the toolset easier.


 


For merchants, we have a script set to OnOpenStore that destroys duplicate items; this keeps the inventory somewhat tidy(er) but still allows other people to buy things other players have sold. We also have one particular shop that saves part of it's inventory over restarts since it's pretty much just a dump for loot and doesn't sell anything by default.


 


Here is the code (DISCLAIMER: I don't know if this is optimal. It's probably not! I didn't do it, I swear!)


// file name: merch_trim_inv
// Trim duplicate items from the merchant object if over the duplicate threshold
void main()
{
    // Bill Jones  20-Jun-2006; Reduced allowable duplicates from 5 to 3
    int iNumAllowedDupes = 3;
    int iItemCount;
    string sItemTag;

    object oCurrentItem = GetFirstItemInInventory();
    while (oCurrentItem != OBJECT_INVALID)
    {
        sItemTag = GetTag(oCurrentItem);
        iItemCount = GetLocalInt(OBJECT_SELF, "count_"+sItemTag);

        if (iItemCount >= iNumAllowedDupes)
        {
            DestroyObject(oCurrentItem);
        }
        // Bill Jones  24-Mar-2008; Don't count items with the tag "aly_throwweapons"
        else if (sItemTag != "aly_throwweapons")
        {
            iItemCount++;
            SetLocalInt(OBJECT_SELF, "count_"+sItemTag, iItemCount);
        }
        oCurrentItem = GetNextItemInInventory();
    }


    // Reset all the counts in preparation for the next store opening
    oCurrentItem = GetFirstItemInInventory();
    while (oCurrentItem != OBJECT_INVALID)
    {
        SetLocalInt(OBJECT_SELF, "count_"+GetTag(oCurrentItem), 0);
        oCurrentItem = GetNextItemInInventory();
    }
}


               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Question about area building...
« Reply #17 on: March 30, 2015, 12:16:08 pm »


               


 


The builders for Thain have, in recent history, consolidated many of the city interiors into one area (for each city). It's worked well for us, and certainly makes browsing the area list in the toolset easier.


 


For merchants, we have a script set to OnOpenStore that destroys duplicate items; this keeps the inventory somewhat tidy(er) but still allows other people to buy things other players have sold. We also have one particular shop that saves part of it's inventory over restarts since it's pretty much just a dump for loot and doesn't sell anything by default.


 


Here is the code (DISCLAIMER: I don't know if this is optimal. It's probably not! I didn't do it, I swear!)



// file name: merch_trim_inv
// Trim duplicate items from the merchant object if over the duplicate threshold
void main()
{
    // Bill Jones  20-Jun-2006; Reduced allowable duplicates from 5 to 3
    int iNumAllowedDupes = 3;
    int iItemCount;
    string sItemTag;

    object oCurrentItem = GetFirstItemInInventory();
    while (oCurrentItem != OBJECT_INVALID)
    {
        sItemTag = GetTag(oCurrentItem);
        iItemCount = GetLocalInt(OBJECT_SELF, "count_"+sItemTag);

        if (iItemCount >= iNumAllowedDupes)
        {
            DestroyObject(oCurrentItem);
        }
        // Bill Jones  24-Mar-2008; Don't count items with the tag "aly_throwweapons"
        else if (sItemTag != "aly_throwweapons")
        {
            iItemCount++;
            SetLocalInt(OBJECT_SELF, "count_"+sItemTag, iItemCount);
        }
        oCurrentItem = GetNextItemInInventory();
    }


    // Reset all the counts in preparation for the next store opening
    oCurrentItem = GetFirstItemInInventory();
    while (oCurrentItem != OBJECT_INVALID)
    {
        SetLocalInt(OBJECT_SELF, "count_"+GetTag(oCurrentItem), 0);
        oCurrentItem = GetNextItemInInventory();
    }
}



 


Much appreciated! I'll give this a looksee!