Iraq-
Sorceror
Code:
// Class: NameRandomizer
// File: NameRandomizer.cs
// By: SHAMBAMPOW
// Inspired by: Nockar (and his Script Support question)
// Date: 7/21/2012
// Purpose: Use this to apply a random prefix to valid items.
// Example: Rather than "Katana", it would show "Zues's Magical Katana"
// RunUO: 2.1+ (below versions would probably just require minor edits to command system usage)
// Methods: GiveRandomName( item ) and PotentiallyGiveRandomName( item, chance )
// Commands: [RandomName and [RandomPrefix
Attached: NameRandomizer.cs
Includes 2 commands:
[RandomName
[RandomPrefix
Includes 2 main static methods:
GiveRandomName( Item item )
PotentiallyGiveRandomName( Item item, double chance )
Includes 2 string lists:
Names
Adjectives
Installation Instructions:
1. Drop the NameRandomizer.cs into your /Scripts directory (anywhere really, but probably in a Customs folder)
2. In Scripts/Misc/LootPack.cs in the Generate method, around line 92 change:
PHP:
if ( item != null )
{
if ( !item.Stackable || !cont.TryDropItem( from, item, false ) )
cont.DropItem( item );
}
PHP:
if ( item != null )
{
NameRandomizer.GiveRandomName( item ); // add a random name to the item - 100% of the time.
// NameRandomizer.PotentiallyGiveRandomName( item, 0.005 ); // add a random name to the item 0.5% of the time
if ( !item.Stackable || !cont.TryDropItem( from, item, false ) )
cont.DropItem( item );
}
Switch the commented out methods, depending on your desired implementation.