[RunUO 2 SVN] User-Defined Chairs
Hi,
Last Updated: 01/20/2009
as probably many people know, the Ultima Online client doesn't allow new chairs, because it's hardcoded, what items are chairs. So you can patch in a new chair, but the players won't sit on it, as the client doesn't recognize the new chair as "sitable". The only choice you have is to replace old chairs. This script allows you to change that and add as many custom chairs as you want.
The script needs a little(!) bit of patching, as you have to replace the Art tile of four existing (working) chairs (with different directions) with empty images, so that you will get four "invisible" chairs (one for each direction). But as this script is only for shards which want to patch in custom chairs, this shouldn't be a problem. Using Mulpatcher (or any other tool) you should easily be able to replace four chairs (one for each direction) with an empty tile. Personally, I replaced 0xB4E - 0xB51 (of course, I saved the original images before, so that I could patch them into another slot later).
The chairs are now invisible, but the players will still be able SIT on it, if you use this itemID (because, as I mentioned, it's hardcoded into the client, on which items the sitting "animation" will be shown).
The idea of the script is simple: It uses these patched in "invisible" chairs and moves such an invisible chair along with the newly created one, which would normaly not be sitable - but as the invisible chair "below" it IS sitable, the player will seem to sit on the new one. The only thing you have to do before implementing your own chairs is to fill in the correct ItemIDs at the top of the file:
Simply replace the 0x0 with the ItemIDs where your invisble chairs (with the correct directions) are.
How to use:
1. Edit the IDs (see above)
2. Implement a new class for your newly patched chair, extending BaseChair. For example, if you patched a new cushion at 0x1234 and want it to be sitable (with the player facing south), you would write a "MyCushion" class:
3. You're done. Now you can add the new chair (MyCushion in this example) and an invisible chair will be placed automatically with it and moved, when your new chair is moved (so nobody has to care about the invisible chair at all, the script does that). You can now sit on it. Yeah!
Updated (01/20/2009):
By using the FlipableDirections Attribute, you can make the chair behaving correctly when flipping it.
Benches (allow facing in two directions) and stools (allow facing in all directions) are now supported.
The invisble chair now never decays (but is deleted when the custom is deleted, of course).
See the attached picture for an example - a custom chair with the ItemID 0x3D1D (I reused a standard item image, but it's patched into a new location, so it could also be something very exotic).
Hi,
Last Updated: 01/20/2009
as probably many people know, the Ultima Online client doesn't allow new chairs, because it's hardcoded, what items are chairs. So you can patch in a new chair, but the players won't sit on it, as the client doesn't recognize the new chair as "sitable". The only choice you have is to replace old chairs. This script allows you to change that and add as many custom chairs as you want.
The script needs a little(!) bit of patching, as you have to replace the Art tile of four existing (working) chairs (with different directions) with empty images, so that you will get four "invisible" chairs (one for each direction). But as this script is only for shards which want to patch in custom chairs, this shouldn't be a problem. Using Mulpatcher (or any other tool) you should easily be able to replace four chairs (one for each direction) with an empty tile. Personally, I replaced 0xB4E - 0xB51 (of course, I saved the original images before, so that I could patch them into another slot later).
The chairs are now invisible, but the players will still be able SIT on it, if you use this itemID (because, as I mentioned, it's hardcoded into the client, on which items the sitting "animation" will be shown).
The idea of the script is simple: It uses these patched in "invisible" chairs and moves such an invisible chair along with the newly created one, which would normaly not be sitable - but as the invisible chair "below" it IS sitable, the player will seem to sit on the new one. The only thing you have to do before implementing your own chairs is to fill in the correct ItemIDs at the top of the file:
Code:
private static int itemIdWest = 0x0;
private static int itemIdSouth = 0x0;
private static int itemIdEast = 0x0;
private static int itemIdNorth = 0x0;
Simply replace the 0x0 with the ItemIDs where your invisble chairs (with the correct directions) are.
How to use:
1. Edit the IDs (see above)
2. Implement a new class for your newly patched chair, extending BaseChair. For example, if you patched a new cushion at 0x1234 and want it to be sitable (with the player facing south), you would write a "MyCushion" class:
Code:
public class MyCushion : BaseChair
{
[Constructable]
public MyCushion() : base( 0x1234, Direction.SOUTH ) {}
// Add Serialization stuff
}
3. You're done. Now you can add the new chair (MyCushion in this example) and an invisible chair will be placed automatically with it and moved, when your new chair is moved (so nobody has to care about the invisible chair at all, the script does that). You can now sit on it. Yeah!
Updated (01/20/2009):
By using the FlipableDirections Attribute, you can make the chair behaving correctly when flipping it.
Benches (allow facing in two directions) and stools (allow facing in all directions) are now supported.
The invisble chair now never decays (but is deleted when the custom is deleted, of course).
See the attached picture for an example - a custom chair with the ItemID 0x3D1D (I reused a standard item image, but it's patched into a new location, so it could also be something very exotic).