RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.1+] Random Name Prefixes on Loot

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 );
                }
to:
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.
 

Attachments

  • NameRandomizer.cs
    9 KB · Views: 63

Nockar

Sorceror
Thanks for making this Iraq!

Here are some more names & words to add to the list if anyone would like to use them.
 

Attachments

  • More_Names_and_Words.txt
    6.5 KB · Views: 45
Top