- added the new XmlUse attachment that allows you to control the use of any object. By adding this attachment to any object you can specify the conditions required to use the object as well as add new use functions to the object that will be executed on double clicks.
Properties:Condition A test string that is the same as any xmlspawner condition test. It will be tested whenever the object with the attachment is used (double clicked). If it returns true, then the object can be used. This can be used to control the built-in use functions of an object or the custom use functions that you add on the fly.
MaxUsesAn integer value that restricts the maximum number of uses allowed. (default = unlimited)
RefractoryAn integer that restricts the minimum time in seconds between uses. (default = 0)
MaxRangeAn integer that restricts the maximum distance in tiles allowed from the target object (default = 3)
RequireLOSA bool that determines whether line-of-sight between the user and the object is required (default = false)
SuccessActionAssign this string to specify custom actions (in addition to the default OnUse functionality) that will be taken when the conditions for use of the object are met. The action string can be any spawnable entry string and supports multiple actions separated by semicolons.
FailureActionThis action will be executed when the conditions for use of the object are NOT met.
MaxUsesAction This action will be executed when someone tries to use the object after the max uses has been exceeded.
RefractoryAction This action will be executed when someone tries to use the object before the refractory period is over.
BlockDefaultUse Setting this property to true will allow you to completely disable the default scripted RunUO method called when the object is used. This can be used to replace existing default use functions with your custom use actions.
Constructors: public XmlUse()
public XmlUse(int maxuses)
public XmlUse(int maxuses, double refractory)
Examples:For example, to make any object usable only once, just issue this command and target the object
[addatt xmluse 1Note that you can always just remove the attachment and the object will go back to its default behavior. The attachment makes no changes to the object.
To spawn a metal box that can only be opened 3 times with a minimum delay of 10 seconds between openings and delivers a message if someone tries to use it more than the maximum number of times use a spawn entry like
metalbox/ATTACH/<xmluse,3,10/maxusesaction/@SENDMSG/Max uses exceeded.>To spawn a stone static that pops open a gump when double clicked
static,3796/ATTACH/<xmluse/successaction/@GUMP,Wicked woods,0/Enter here and despair!>you could also add this manually to any existing static by simply adding the attachment with
[addatt xmluse and then opening up the props on the attachment with
[getattand assigning the
SuccessAction property the value of "GUMP,Wicked woods,0/Enter here and despair!"

To spawn a door that can only be opened by players named "Bob"
metaldoor,1/ATTACH/<xmluse/condition/@GETONTRIGMOB,name="Bob">or by players that havent yet completed an objective of a quest
metaldoor,1/ATTACH/<xmluse/condition/@GETONCARRIED,Bunglers quest,questholder,completed1=false>To prevent a player from using any metal doors for 2 minutes, create a triggered spawner that will add an xmluse attachment to the player lasting 2 minutes with the following entry
SETONTRIGMOB/ATTACH/<xmluse/expiration/00:02/condition/@GETONTHIS,TYPE!#MetalDoor>Note that GETONTRIGMOB will always refer to the player doing the using, and GETONTHIS will always refer to the object being used.
- added examples of the new XmlUse attachment in customuse.xml to xmlextras. Just do an "[xmlloadhere customuse.xml" and respawn it.
Examples:1. Creates a metalbox that can only be opened by someone with positive karma, and after opening it sends a message, opens a gump, and changes the players karma to evil. If someone with negative karma tries to open it, they are refused and a gump pops up.
2. Creates a door that can only be opened by someone with enough strength (>70). If a player is too weak, they will be blocked and a gump will be displayed.
3. Spawns a horse that can only be mounted by someone with high enough chivalry (>90). If a player lacking the skill attempts to use it, they will be blocked and a message will be displayed.
4. Creates a brazier that will spawn a daemon when double clicked if the player has enough fame (>1000).
5. Spawns a stone that will deliver a bag of regs when double-clicked with a waiting time between uses of 10 seconds.
6. Creates a magic portal that teleports the user to a site in Ilshenar when double clicked.
Note that examples 4,5, and 6 are done using simple statics that have no default use scripted.