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!

XmlSockets

ArteGordon

Wanderer
XmlSockets v1.04

XmlSockets
v1.04
updated 12/26/04
ArteGordon

SUMMARY
This set of attachments provides a system for adding sockets and socket augmentations to items and mobs. The XmlSockets attachment adds sockets that can be filled with augmentations that will enhance specific abilities. The XmlSocketable attachment enables player-addable sockets that can be added to the target object by players meeting customizable skill and resources requirements.


INSTALLATION:

This thread is no longer updated. GO HERE for the latest version
http://www.runuo.com/forum/showthread.php?t=49925


DESCRIPTION:

This system makes use of the XmlSpawner2 attachment system and the XmlSpawner2 package must be installed to support it. You dont need to use the xmlspawners themselves, and it doesnt matter whether you use the standard distribution spawners or any other spawning system but you do need the XmlSpawner2 package installed.

Because the attachment system neither requires nor makes any changes to serialization/deserializations of any item or mobile, it can be safely added and removed at any time now or in the future without interfering with any other systems that you might have installed.

Note, this is intended as more of a development system for people to add custom content to their shards than just a drop-and-play system with a full complement of socket augmentations. While I have included a number of augmentations in the package that can be used as-is, they are intended to illustrate its features so that users can extend them with additional content.

Features:

Note that ANY object can in principle be socketed - weapons, armor, jewelry, clothing, tools, trees, doors, fruit, creatures, players, gems - anything. You just have to tag them with the sockets/socketable attachments using one of the methods described below. It is then the responsibility of the augment to determine what it can affect and what effect it has on the socketed object.

Sockets
Sockets allow target objects to be enhanced by providing slots in which specially designed augmentations can be placed. Different augmentations will confer different abilities to the target.
Sockets can either come pre-existing on a target, or can be added by an individual with sufficient skill and resources.

Socketability
Individual objects can be flagged as being "socketable", by adding the XmlSocketable attachment which allows the maximum number of sockets, the type of skill and minimum skill level required to socket, and the resources used in socketing, to be specified. By default 100 Blacksmithing and 50 Valorite ingots are required to add a socket to a target.

Augmenting
To add an augmentation to a socket, both the augmentation and the item to be augmented must be in the players pack. To bring up the socket gump you must use the item identification skill on the item. In the gump, click on the socket and target the augmentation. By default, augmenting requires no resources and will always succeed. This behavior can be changed in the ConsumeOnAugment and OnAugment override methods for individual augmentations.
After a socket has been filled with an augmentation, clicking on the socket will display the augmentation properties.

Item Identification. This skill is used to display the sockets and socketability of target objects. Just use the skill and target an object (either items or creatures).

Examples. Examples of socketed/socketable objects including tamable creatures such as a socketable dragon are included in the example .xml file socket1.xml. To try this out, place the file "socket1.xml" in your top level RunUO directory and execute the command "[xmlloadhere socket1.xml"
It creates several bags of augmentations and various socketed and socketable items. The dragon can be socketed after it is tamed.


Commands/Control Items:

[addsocket - To add a socket to a socketable object the player issues the "[addsocket" command and targets an object. If the target is an item, then the item must be in the players backpack. If the target is a creature, then the creature must be under the players control. If socketing is successful, you will see the new socket in the socket gump. On each failure resources will still be consumed and there is a 10% chance that the target will be destroyed (this probability can be set by the static DefaultDestructionProbability variable in XmlSocket.cs).
The difficulty of adding a socket depends on the minimum skill required by the object, the skill level of the player, and the existing number of sockets.
The chance of succeeding in adding a socket can be displayed by using the Item Identification skill on a socketable object.

SocketHammer - an item that provides the same functionality as the [addsocket command. Just double-click to use and target the object to be socketed. It can be given either limited (set UsesRemaining to a value > 0) or unlimited number of uses (set UsesRemaining to a value < 0).

Adding sockets to items/mobs

Manually to individual item/mobs


- the xmlSockets attachment can be added to objects in several ways. It can be manually attached to any existing object with the "[addatt" command.

For example

"[addatt xmlsockets 4"

will add 4 sockets to a targeted object.


To scripts

- Sockets can also be added to scripted objects. See the included script TestSocketedWeapon.cs for an example of this.

To spawned objects

- To add sockets to spawned objects use the ATTACH keyword in spawn entries such as this

katana/ATTACH/xmlsockets,4

which would spawn a katana with 4 sockets.

or

orc/ADD/<katana/ATTACH/xmlsockets,4>

would spawn an orc carrying the socketd katana.

To try out the included example spawner .xml file, place the file "socket1.xml" in your top level RunUO directory and execute the command

"[xmlloadhere socket1.xml"


Making items/mobs socketable by players

Manually to individual item/mobs


- the xmlSocketable attachment can be added to objects in several ways. It can be manually attached to any existing object with the "[addatt" command.

For example

"[addatt xmlsocketable 4"

will flag the target object as socketable and supporting a maximum of 4 player-added sockets.


To scripts

- Socketability can also be added to scripted objects. See the included script TestSocketedWeapon.cs for an example of this.

To spawned objects

- To add sockets to spawned objects use the ATTACH keyword in spawn entries such as this

katana/ATTACH/xmlsocketable,4

which would spawn a katana supporting a maximum of 4 player-added sockets.

buckler/ATTACH/xmlsocketable,2,Tinkering,115,gold,2000

which would spawn a buckler supporting a maximum of 2 player-added sockets that require a minimum of 115 Tinkering and 2000 gold to add.
 

NoobAttack

Wanderer
Phantom said:
Dude enough with the xml scripts...Time for you to use something better :lol: like a binary file.
I personally am a great fan of evrything he has done with the XML scripts, another great system thank you arte
 

Phantom

Knight
Well sorry reading xml is slow....I am not the only person who has said this...

He needs to advance to something else

Plus I don't like the fact this requires another script, which I dislike.

A good script doesn't require code from another submission. Submissions like this become broken in 6 months or a submission it requires is lost and its useless.

Plus then people complain they want it, which is never good.
 

ArteGordon

Wanderer
a quick update

Added the file SocketsLootMod.zip which contains modified distro RC0 versions of Loot.cs and LootPack.cs that will give random lootpack drops of augmentations. The frequency of drop is low (about the same as instruments), and the definitions include the rune augmentations.

To use them, either replace the distro Scripts/Misc/LootPack.cs and Scripts/Misc/Loot.cs with the versions in the SocketsLootMod.zip file (always make backups of your original scripts), or just look in those files for the changes marked "ARTEGORDONMOD", and incorporate them into your existing lootpack.cs and loot.cs files.

Note, I intentionally renamed the files with ._cs extensions so that they wouldnt cause problems if you extracted them into your scripts area. The extensions need to be changed to .cs if you wish to use them as replacements for the distro loot.cs and lootpack.cs scripts.
 

Phantom

Knight
I think I should explain why I dislike scripts that use another system.

Two words

Bob Smart ( something like that )

He submitted a small archive of scripts, and then never came back after 3 months.

Then when the forum was wiped people wanted this script, which I still say wasn't very good.

Anyhow people would submit scripts assumng this system was used, was almost to a point where people had to be warned not to use it ( modifyed default classes ).

ANyhow I have no doubt this system is good. Just be aware of what your giving up by using something like this.

Mainly your freedom to do what you want on your shard if something happens to the author.

This of course is true for every script you use, why I suggest you write your own.
 

ArteGordon

Wanderer
In this world, we often rely upon the support and goodwill of others. It is not a weakness, but a strength. It is called community. I'm happy to be a part of that, to help others, and to benefit from their contributions.

Now back to our regularly sponsored thread...
 

Vertigo

Wanderer
Hia Arte
can i fix those errors ?
I have XMLSpawner last version and customattack scripts
Code:
Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 50, column 17) 'Server.Engines.XmlSpawner2.XmlCustomDefenses' doe
s not contain a definition for 'AddDefense'
 - Error: Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 118, column 17) 'Server.Engines.XmlSpawner2.XmlCustomAttacks' doe
s not contain a definition for 'AddAttack'
 - Error: Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 125, column 17) 'Server.Engines.XmlSpawner2.XmlCustomDefenses' do
es not contain a definition for 'AddDefense'
 - Error: Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 191, column 17) 'Server.Engines.XmlSpawner2.XmlCustomAttacks' doe
s not contain a definition for 'AddAttack'
 - Error: Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 198, column 17) 'Server.Engines.XmlSpawner2.XmlCustomDefenses' do
es not contain a definition for 'AddDefense'
 - Error: Scripts\CustomCodes\CustomSystem\XMLSpawner\xmlsocket\runeaugments.cs:
 CS0117: (line 264, column 17) 'Server.Engines.XmlSpawner2.XmlCustomAttacks' doe
s not contain a definition for 'AddAttack'
 

ArteGordon

Wanderer
erm, sorry you're right. I forgot to up the latest version of customattacks that is needed for the Sockets support. I'll update that now.

(edit)

just updated XmlCustomAttacks to v1.02. That should take care of it.
 

Arkryal

Wanderer
Damn your good. This is what I've been trying to do conceptually for 3 weeks. But here you've refined the idea while giving it a broader purpose than anything I was working on. Excellent Work. I can't wait to play with this code!
 

ArteGordon

Wanderer
TheOutkastDev said:
Im a little curious myself why all these systems have to "attach" to xmlspawner2?
They use a system of attachments that was developed as part of the xmlspawner package. Attachments are a way of associating an object such as an instance of the XmlSockets class to a target object such as an instance of a basecreature or baseweapon, without actually requiring modification of the target object.
In this way they alleviate the need to serialize/deserialize information directly by the target object class, or to make derivative classes that would perform this function, or in fact, to modify the target class in any way.

Attachments are a specific class that are defined in the xmlspawner system, so they arent actually "attached" to xmlspawners in any way, they simply use the attachment functionality that has been integrated into the xmlspawner system.
 

ArteGordon

Wanderer
Arkryal said:
Damn your good. This is what I've been trying to do conceptually for 3 weeks. But here you've refined the idea while giving it a broader purpose than anything I was working on. Excellent Work. I can't wait to play with this code!
good luck and have fun!
 

ArteGordon

Wanderer
updated to version 1.01

from the changelog

New to v1.01

- added a set of Mythic augments that are 3 socket augmentations in addition to the Ancient (1 socket) and Legendary (2 socket) types. Loot.cs in the optional SocketsLootMod-v101.zip was modified to reflect the change.

- the augment examples have been organized into a separate folder replacing the previous files otheraugments.cs, gemaugments.cs (you should get rid of those if you had them from an earlier installation or your will get errors about things being already defined).

- the socket1.xml example has been updated with the new augments.

- added the SocketHammer item as an alternative to the [addsocket command to add sockets to target objects. Just "[add sockethammer", double click the hammer and target the object to be socketed. Setting the number of uses (UsesRemaining property) to a value greater than zero will give it limited uses. Setting it less than zero makes it unlimited.

- having an item with an existing socket number that exceeds the maxsockets indicated in its XmlSocketable attachment will now automatically have that max adjusted to match the current number of existing sockets. It is basically just a cosmetic change to avoid confusion in the way the available sockets are reported. Some players were getting confused by items that indicated the maxsockets allowed as 1, and the available sockets as 2 for example. This just meant that the item already had 2 sockets, but that you could not add any additional sockets beyond 1.
 

ArteGordon

Wanderer
updated to version 1.02
12/3/04

from the changelog

New to version 1.02
- added an additional XmlSockets constructor that allows the default requirement for socketed items to be in the players pack when augmenting to be overridden. "[addatt xmlsockets 1 false" for example would allow you to attach a single socket that did not require the socketed item to be in the players pack when augmenting.
This can be useful for allowing items in the world such as doors to be augmented.

- added a new augmentation called a "keyaugment". This can be used to open doors and chests by assigning it a KeyValue that matches the KeyValue of the door/chest, and then using it to augment a socket on the door/chest. A skill requirement can also be assigned to it as can the number of uses. This is an example of placing additional constraints on the use of augmentations in the OnAugment method.

- added an example of a socketed door and socketed chest that open when a master thief places the proper keyaugment into the socket. This can be tested by loading the keyaugment.xml example. Use item identify on the door named "Sesame" to bring up the socket gump, and then augment it with the special "Sesame" rune (you must have at least 100 lockpicking). After opening, the door resockets itself so that it has to be augmented again to be opened. The chest can be opened in the same way with the "Sesame's treasure" keyaugment that has the form of a skull. That one requires 100 Stealing to use. Notice how the keyaugment to open the door does not get destroyed after it is used, while the one to the chest does. This is due to the UsesRemaining property that has been set on it. Setting this to a value < 0, gives it unlimited uses. Setting it to a value > 0 gives it the specified number of uses (a value of 1 would be the default single-use case).

- shifted the SocketAugmentations entries in the optional LootPack.cs mods to the ends of each lootpack list to reduce luck-enhanced chance of dropping augments. The way lootpacks work, entries near the top of the list have the greatest chance of being added due to luck, and the luck-computed drop probability is generally much higher than the drop chance specified for each entry (particularly if the entry chance is supposed to be low which is why you get so many luck-related magic item drops on poor lootpack mobs).

- added a range check for socketing creatures (maximum distance 2)
 

ArteGordon

Wanderer
updated to version 1.03
12/07/04

from the changelog

New to v1.03

- added 29 new augmentations in two sets, Crystals (2 socket) and RadiantCrystals (4 socket).

- modified the optional Loot.cs file to support lootpack drops of these augments.

- updated the socket1.xml example to include bags of the new augments.
 
Top