QUOTE |
- added the new "TAKEN" keyword, which can be used wherever an item keyword like ARMOR could be used. It will refer to the most recent item obtained via the TAKE or TAKEBYTYPE keyword. This allows you to take items and then test properties on them, manipulate them, give them back, or even spawn them. For example, to take some gold and then test to see if you actually got the proper amount, you can do 1 TAKEBYTYPE,1,100,false/Gold 1 IF/GETONTAKEN,Amount < 100/33/44 2 GOTO/1 33 SAY/Sorry, you do not have enough gold 33 GIVE/TAKEN 44 SAY/Very good. Here is your armor 44 TAKEN/DELETE 44 GIVE/ARMOR,1,2 |
QUOTE |
- added the new "AMOUNTCARRIED,itemtype" keyword that will return the total amount of the specified type of item being carried in the backpack of the triggering mob. You can use this to test for carried items like IF/AMOUNTCARRIED,gold < 100/33 or add it to a Condition field in xmldialogs or in a triggering condition test on spawners AMOUNTCARRIED,bandage>100 |
QUOTE |
- 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. MaxUses An integer value that restricts the maximum number of uses allowed. (default = unlimited) Refractory An integer that restricts the minimum time in seconds between uses. (default = 0) MaxRange An integer that restricts the maximum distance in tiles allowed from the target object (default = 3) RequireLOS A bool that determines whether line-of-sight between the user and the object is required (default = false) SuccessAction Assign 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. FailureAction This 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 1 Note 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 [getatt and 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 an example of the new XmlUse attachment in customuse.xml. 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. |