Initial Upload
Initial Upload
This commit is contained in:
214
_module/nss/asg_rseedbooks.nss
Normal file
214
_module/nss/asg_rseedbooks.nss
Normal file
@@ -0,0 +1,214 @@
|
||||
object oMod = GetModule();
|
||||
|
||||
int DEBUG = FALSE;
|
||||
void main()
|
||||
{
|
||||
|
||||
// *** Objects
|
||||
object oCChest;
|
||||
object oItem;
|
||||
object oNewItem;
|
||||
object oDest;
|
||||
object oArea;
|
||||
// *** Ints
|
||||
int iIndex = 0;
|
||||
int iMaxIndex;
|
||||
int iTemp;
|
||||
int iK;
|
||||
int iCount;
|
||||
int iRandom;
|
||||
int iPass;
|
||||
// ************************
|
||||
// ** < Scripters Edge >
|
||||
// ** If you don't have 19 differant catagories of placeables you can cut this
|
||||
// ** down.
|
||||
// *************************
|
||||
int iMaxContainer = 19;
|
||||
// *** Strings
|
||||
string sIndexTag;
|
||||
string sTemp;
|
||||
string sTag;
|
||||
string sBase;
|
||||
string sText;
|
||||
|
||||
|
||||
// ************************
|
||||
// ** < Scripters Edge >
|
||||
// ** If you want to place your own containers in here instead of the generic
|
||||
// ** Neverwinter Objects. Change out the sTag in the Switch Statment to the
|
||||
// ** one you want.
|
||||
// *************************
|
||||
|
||||
// Step One Create Temporay Index of Avaible Containers
|
||||
// Create List of Items inside of Material Chest;
|
||||
|
||||
for (iK=1;iK<=iMaxContainer;iK++)
|
||||
{
|
||||
switch(iK)
|
||||
{
|
||||
case(1): sTag = "Armoire"; break;
|
||||
case(2): sTag = "Barrel"; break;
|
||||
case(3): sTag = "BookPiles"; break;
|
||||
case(4): sTag = "Bookshelf"; break;
|
||||
case(5): sTag = "Cabinet"; break;
|
||||
case(6): sTag = "Chest1"; break;
|
||||
case(7): sTag = "Chest2"; break;
|
||||
case(8): sTag = "Chest3"; break;
|
||||
case(9): sTag = "Chest4"; break;
|
||||
case(10): sTag = "ChestofDrawers"; break;
|
||||
case(11): sTag = "NW_VAMPIRE_SHAD"; break;
|
||||
case(12): sTag = "BoxCrate1"; break;
|
||||
case(13): sTag = "BoxCrate2"; break;
|
||||
case(14): sTag = "BoxCrate3"; break;
|
||||
case(15): sTag = "BoxCrate4"; break;
|
||||
case(16): sTag = "Desk"; break;
|
||||
case(17): sTag = "SarcophagusEgyptian"; break;
|
||||
case(18): sTag = "arcophagusEvil"; break;
|
||||
case(19): sTag = "SarcophagusGood"; break;
|
||||
}
|
||||
iCount = 0;
|
||||
oDest = GetObjectByTag(sTag,iCount);
|
||||
while (GetIsObjectValid(oDest))
|
||||
{
|
||||
iTemp = GetLocalInt(oMod,sTag);
|
||||
if (iTemp==0)
|
||||
{
|
||||
// Update iIndex
|
||||
iIndex++;
|
||||
if (iIndex<100)
|
||||
{
|
||||
sTemp = "0";
|
||||
}
|
||||
if (iIndex<10)
|
||||
{
|
||||
sTemp = "00";
|
||||
}
|
||||
SetLocalString(oMod,"INDEX_"+sTemp+IntToString(iIndex),sTag);
|
||||
SetLocalInt(oMod,sTag,1);
|
||||
iMaxIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oMod,sTag,iTemp+1);
|
||||
}
|
||||
iCount++;oDest = GetObjectByTag(sTag,iCount);
|
||||
}
|
||||
}
|
||||
// Index of Possible Locations Created - Now Scatter the Items into
|
||||
// these containers.
|
||||
//
|
||||
// ** Arcane Books
|
||||
//
|
||||
oCChest = GetObjectByTag("ASG_ACCHEST");
|
||||
if (GetIsObjectValid(oCChest))
|
||||
{
|
||||
// Works One Book at a time...
|
||||
oItem = GetFirstItemInInventory(oCChest);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
iPass = FALSE;
|
||||
while (iPass == FALSE)
|
||||
{
|
||||
iIndex = Random(iMaxIndex)+1;
|
||||
sBase = "INDEX_";
|
||||
if (iIndex<100)
|
||||
{
|
||||
sTemp = "0";
|
||||
}
|
||||
if (iIndex<10)
|
||||
{
|
||||
sTemp = "00";
|
||||
}
|
||||
sBase+=sTemp+IntToString(iIndex);
|
||||
sTemp = GetLocalString(oMod,sBase);
|
||||
iTemp = GetLocalInt(oMod,sTemp);
|
||||
iIndex = Random(iTemp)+1;
|
||||
oDest = GetObjectByTag(sTemp,iIndex);
|
||||
if (GetIsObjectValid(oDest))
|
||||
{
|
||||
iTemp = GetUseableFlag(oDest);
|
||||
if (iTemp==TRUE)
|
||||
{
|
||||
// Attempt to Copy Object to Dest.
|
||||
oNewItem = CopyObject(oItem,GetLocation(oDest),oDest);
|
||||
if (GetIsObjectValid(oNewItem))
|
||||
{
|
||||
iPass = TRUE;
|
||||
oArea = GetArea(oDest);
|
||||
sText = "ASG MICS DEBUG: Placed "+GetName(oItem)+" in Container "+GetName(oDest)+" in Area "+GetName(oArea);
|
||||
if (DEBUG==TRUE) PrintString(sText); // Print to Log Locations - for debug purpose.
|
||||
}
|
||||
}
|
||||
// If not possible continue in Loop until it is..
|
||||
}
|
||||
}
|
||||
oItem = GetNextItemInInventory(oCChest);
|
||||
}
|
||||
}
|
||||
// ** Divine Books .....
|
||||
oCChest = GetObjectByTag("ASG_DVCHEST");
|
||||
if (GetIsObjectValid(oCChest))
|
||||
{
|
||||
// Works One Book at a time...
|
||||
oItem = GetFirstItemInInventory(oCChest);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
iPass = FALSE;
|
||||
while (iPass == FALSE)
|
||||
{
|
||||
iIndex = Random(iMaxIndex)+1;
|
||||
sBase = "INDEX_";
|
||||
if (iIndex<100)
|
||||
{
|
||||
sTemp = "0";
|
||||
}
|
||||
if (iIndex<10)
|
||||
{
|
||||
sTemp = "00";
|
||||
}
|
||||
sBase+=sTemp+IntToString(iIndex);
|
||||
sTemp = GetLocalString(oMod,sBase);
|
||||
iTemp = GetLocalInt(oMod,sTemp);
|
||||
iIndex = Random(iTemp)+1;
|
||||
oDest = GetObjectByTag(sTemp,iIndex);
|
||||
if (GetIsObjectValid(oDest))
|
||||
{
|
||||
iTemp = GetUseableFlag(oDest);
|
||||
if (iTemp==TRUE)
|
||||
{
|
||||
// Attempt to Copy Object to Dest.
|
||||
oNewItem = CopyObject(oItem,GetLocation(oDest),oDest);
|
||||
if (GetIsObjectValid(oNewItem))
|
||||
{
|
||||
iPass = TRUE;
|
||||
oArea = GetArea(oDest);
|
||||
sText = "ASG MICS DEBUG: Placed "+GetName(oItem)+" in Container "+GetName(oDest)+" in Area "+GetName(oArea);
|
||||
PrintString(sText);
|
||||
}
|
||||
}
|
||||
// If not possible continue in Loop until it is..
|
||||
}
|
||||
}
|
||||
oItem = GetNextItemInInventory(oCChest);
|
||||
}
|
||||
}
|
||||
// Delete Array
|
||||
for (iK=1;iK<=iMaxIndex;iK++)
|
||||
{
|
||||
iIndex = iK;
|
||||
sBase = "INDEX_";
|
||||
if (iIndex<100)
|
||||
{
|
||||
sTemp = "0";
|
||||
}
|
||||
if (iIndex<10)
|
||||
{
|
||||
sTemp = "00";
|
||||
}
|
||||
sBase+=sTemp+IntToString(iIndex);
|
||||
sTemp = GetLocalString(oMod,sBase);
|
||||
DeleteLocalString(oMod,sBase);
|
||||
DeleteLocalInt(oMod,sTemp);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user