Yeah!
Okay, here goes:
I use the NESS alot. I use NESS for loot. Normally, I use the flags that have an integer >500 for loot. This means, for anyone interested who doesn't know NESS, that I store all of the loot in loot merchants, which act as containers. Each merchant is given a tag like LOOT_501. When a spawn is created, the script goes into the loot merchant, pulls out a random item, and sticks it in the spawns inventory.
This works well, and its very easy to add or subtract items from the loot merchant.
However, the issue I'm running into is that I like to have low % chances for really good items (like most mods do, I imagine). The way to do this is to create copies of more mundane items in the loot merchants. So, as a poor example, you might have a +3 flaming longsword, but 20 heal kits. As you increase the number of items in the merchants, they get really bloated.
My solution to this, I hope, was to put a % table directly into spawn_cfg_loot, and use flags that call to numbers less than 500. I will try to post the script so you can see it. I've left off the tail end, but its essentially what cereborn and neshke use for the >500 merchants. In fact, most of it comes from the >500 portion of the script, I've just moved it, added in the random die roll, and then made a call for the oSpawn's CR (putting it in place of the call for the Loot_ +string).
Quote:
// Only Make Modifications Between These Lines
// Table 00
if (nLootTable == 77)
{
object oStore = OBJECT_INVALID;
int nCR;
object oItem;
int nCount;
int nAmount = 1;
// Determine Loot Merchant
nRandom = d100();
if(nRandom < 41)
{
oStore = GetObjectByTag ( "LOOT_POTION");
}
else if(nRandom < 71)
{
oStore = GetObjectByTag ( "LOOT_GEMS");
}
else if(nRandom < 81)
{
oStore = GetObjectByTag ( "LOOT_SCROLLS");
}
else if(nRandom < 91)
{
oStore = GetObjectByTag ( "LOOT_LQ_STATIC");
}
else if(nRandom < 98)
{
int nCR = GetChallengeRating (oSpawned) + 100;
oStore = GetObjectByTag ( "LOOT_" + IntToString(nCR));
}
else if(nRandom < 99)
{
int nCR = GetChallengeRating (oSpawned) + 101;
oStore = GetObjectByTag ( "LOOT_" + IntToString(nCR));
}
else if(nRandom == 99)
{
int nCR = GetChallengeRating (oSpawned) + 102;
oStore = GetObjectByTag ( "LOOT_" + IntToString(nCR));
}
else if(nRandom == 100)
{
int nCR = GetChallengeRating (oSpawned) + 103;
oStore = GetObjectByTag ( "LOOT_" + IntToString(nCR));
}
if( GetIsObjectValid ( oStore ) )
{
// -- check if we already know item count
nCount = GetLocalInt (oStore , "nItemCount" );
if( nCount <= 0 )
{
// -- Count Items in Store Inventory
oItem = GetFirstItemInInventory ( oStore );
while( GetIsObjectValid( oItem ) )
{
nCount++ ;
oItem = GetNextItemInInventory ( oStore );
}
SetLocalInt ( oStore , "nItemCount" , nCount );
}
while( nAmount > 0 )
{
// -- Determine random item
int nSelected;
int nRand = Random( nCount ) + 1;
// -- Get the item
oItem = GetFirstItemInInventory ( oStore );
for( nSelected = 1 ; nSelected < nRand ; nSelected++ )
{
oItem = GetNextItemInInventory ( oStore );
}
// -- Grab item template
if (oItem != OBJECT_INVALID)
{
sTemplate = GetResRef( oItem );
}
// -- Checks to see if this it is a ammo or thrown item and creates more in the stack
string sRoot = GetStringLowerCase ( GetSubString( sTemplate , 0 , 6 ) );
if( sRoot == "nw_wam" || sRoot == "nw_wth" )
{
nStack = Random( 30 ) + 1;
}
else
// -- Check if the item is Gold, and creates more in Stack
// small amount generated : gold placement should maybe be handled in some other way.
if( GetStringLowerCase ( sTemplate ) == "nw_it_gold001" )
nStack = Random( 30 ) + 5;
else
if( nStack < 1 )
nStack = 1;
// -- create the item on oSpawned
oItem = CreateItemOnObject ( sTemplate , oSpawned , nStack );
// -- decerement the Item Amount counter
nAmount--;
}
}
Do you see any issues with this? Any comments? Is there an easier way to do it?