61 lines
1.8 KiB
Plaintext
61 lines
1.8 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//::
|
|
//:: Custom Literature Script
|
|
//:: By James Upp (Merle)
|
|
//:: jservey@clemson.edu
|
|
//:: October 21, 2002
|
|
//::
|
|
//:: Based on the original random treasure script
|
|
//:: by Brent of BioWare
|
|
//::
|
|
//:: To use:
|
|
//:: Make sure that all custom books that you want
|
|
//:: to appear follow the same resref naming
|
|
//:: convention of "custombook###" where ### is a
|
|
//:: three-digit number. Since you can't change the
|
|
//:: resref of an item after it's creation, you
|
|
//:: will need to give your custom books the
|
|
//:: name "custombook###" when you first create
|
|
//:: them, and then modify the name of the book
|
|
//:: in the Item Editor later.
|
|
//::
|
|
//:: To set the number of random books, change the
|
|
//:: nNumBooks.
|
|
//::
|
|
//:: Make sure this script rests on both the
|
|
//:: OnDeath and OnOpen scripts for your bookshelves
|
|
//:: and book piles. This shouldn't be a problem
|
|
//:: if you are using the custom erfs. If you are
|
|
//:: not using the custom erfs, it would be best
|
|
//:: to create custom placeables of your own, by
|
|
//:: copying the standard bookshelves and book
|
|
//:: pile and then changing the script, and then
|
|
//:: adding them to the custom palette.
|
|
//::
|
|
//:://////////////////////////////////////////////
|
|
|
|
|
|
void main()
|
|
{
|
|
|
|
int nNumBooks = 30; // Change this to the number of random
|
|
// books available.
|
|
|
|
object oTarget = OBJECT_SELF;
|
|
int nBook = Random(nNumBooks) + 1;
|
|
string sRes = "CUSTOMBOOK";
|
|
int nDoOnce = GetLocalInt(OBJECT_SELF, "DoOnce");
|
|
if (nDoOnce != 1) {
|
|
if (nBook < 10)
|
|
{
|
|
sRes = "CUSTOMBOOK00" + IntToString(nBook);
|
|
}
|
|
else
|
|
{
|
|
sRes = "CUSTOMBOOK0" + IntToString(nBook);
|
|
}
|
|
CreateItemOnObject(sRes, oTarget);
|
|
SetLocalInt(OBJECT_SELF, "DoOnce", 1);
|
|
}
|
|
}
|