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 SVN] User-Defined Chairs

Irian

Page
[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:

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).
 

Attachments

  • CustomChair.jpg
    CustomChair.jpg
    51 KB · Views: 247
  • BaseChair.cs
    9.8 KB · Views: 44

Sythen

Sorceror
I Love This Concept...

But how do tha animations look in-game using real custom chairs, not a gold coin? If players can't notice a difference then I think this would be an awesome addition to my server! I could set up the invisible chairs while drawing my statics.

The trouble would come when players set down their own chairs inside their homes. How do they have access to the invisible chairs - if they can't see them. I'm a bit confused as to how to make that work. Its one thing to use them as statics and put them where chairs cant be moved, but if a player is decorating their house, replacing the chairs seems a bit quirky to me if the player cant see it.
 

Irian

Page
That's what the script does. It adds a "custom" chair (with your newly patched id). When you move that custom chair, the "invisble" chair is moved with it as well.

So, all you have to do is...

1. Set the ItemIDs for the inivisble chairs
2. Implement your own custom chairs by extending BaseChair

Bingo. Now you can use your custom chair and when you move it, the invisible chair will be moved as well, so you don't have to care about it.
 

Mideon

Page
Amazing idea, props to you Irian.

You've just solved one of UO's ugly client restrictions. Great job! thanks for the submission
 
great job !!!!!!

now i just have to find 4 chairs not used in game yet lol

*wonders if any new ones came out with ml from the 5.0.6.5-5.0.9.1 erra that is have not implamented yet , hummmmm
 
mot sure if this is in the update or not
need to make it so the "hidden" one does not decay
else when locked down in house, or gm places somewhere and sets it movable false - the hidden one decays and it is no longer sittable

so need to add this to the invisablechair
public override bool Decays{ get{ return false; } }
 
Top