Over the years I have gathered notes and shortcuts for various functions on a shard. Most of these are fairly common, and I can't guarantee they do or will continue to work with ServUO repos, but they can help point you in the right direction.
1.) Adding items globally to player's backpacks
[global addtopack StuffyAnimal where playermobile
[global addtopack "item name" where playermobile map != null (to get just the online players)
[global addtopack [class name of item to add] set [property name] [value] [property name] [value] ... where [class name to use as filter] [property name] [comparison expression] [value]
[global addtopack apple set itemid 123 hue 456 name "Chocolate bunny" where playermobile skills.wrestling < 100
How to add items to all player's packpack
[online addtopack apple set itemid 123 hue 456 name "Chocolate bunny" where playermobile
this code shows how to add a normal item but have a different ID
If you have a script item which you would like to use
[online addtopack superdragonarmor name "Surprise" where playermobile
or
[online addtopack cake hue 302 name "Special Cake" where playermobile
2.) Changing the hue of multis, like houses, boats, etc.
[area interface where basemulti
3.) Ser/Deser Issues
If you know its crashing in Deserialize for playermobile, just stick a console.writeline before every read operation in the playermobile.deserialize method... see what the last one is that gets read before the crash... and then look at that line and compare it to the serialization and see whats out of order.
4.) XML Siege Info
[availatt will list all available attachments and their constructors, so you can see the list using that command.
[area addatt xmlsiege where basemulti (Add xml siege attachment to a multi)
[xmlfind basemulti 20 (Will show all multis within the range (20 in this case) and their attachments)
[addatt xmlsiege (creates a damageable object with 1000 hits, 30% fire and physical resist, and repair requirement of 1 stone, 20 iron, an 20 wood to repair 100 hits. Optional arguments:
xmlsiege hitsmax
xmlsiege hitsmax resistfire resistphysical
xmlsiege hitsmax resistfire resistphysical wood iron stone
HitsMax specifies the maximum number of hits the structure can take before being destroyed.
ResistFire and ResistPhysical are the percentage reduction in that type of damage that the object will take.
Wood, Iron, Stone - are the amount of each resource that will be required to repair 100 hits of damage on the object using the SiegeRepairTool
[getatt (opens the dialog box to modify xml attachments.)
To display HP of HP on Siege items with hit points:
if (siege != null)
{
bool ascii = true;
int hue = 1156;
string Siegepoints;
Siegepoints = string.Format("[{0}/{1}]",siege.Hits, siege.HitsMax);
PrivateOverheadMessage(MessageType.Label, hue, ascii, Siegepoints, from.NetState);
}
base.OnSingleClick( from );
}
Cannonballs
iron has medium range (15), no area, high damage (100)
light as longer range (17), no area, medium damage (80)
exploding has shorter range (11), small area (1), lower damage (60)
fiery has shortest range (8), large area (2), lowest damage (40)
light has good accuracy (0), fastest speed (35)
iron has good accuracy (0), medium speed (25)
exploding has lower accuracy (-10), slower speed (20)
fiery has lowest accuracy (-20), slowest speed (10)
5.) For adding Text Under an Item Name:
list.Add( "Blah blah blah" );
base.GetProperties( list );
6.) Moving a fully-deco'd house
The location for a house is dead center of the floor plot, so when you select the destination take that into account.
[props - target house sign.
click arrow next to "Owner"
Then "View Properties" on the owner menu
go to second page of properties menu and look for "Location" and "Map"
right down the current location, then enter the destination co-ordinates.
*** Venders, teleporters and some add-on items MAY not move with the plot. IF you have this happen, use the original location and destination location to calculate an offset formula.
(IE Original X3000, Y2000 - Destination X5000, Y1500 = Offset X2000, Y -500)
With that in hand, you can now move BillyBob the the cheese seller.
[props on vender, location x3009, y2012
add in formula to get new location = X5009,Y1512
POOF vender is now in the exact relationship to the house, but in the new destination.
or
[inc x 2000 y -500 <enter> target NPC
7.) All Houses listed by price Desc.
[global interface view price owner where basehouse order by price desc
8.) You can replace any music. When you replace it in the server\regions.cs, you're merely changing how the server handles the mp3. In other words, it just makes it so we, scripters, can more easily choose which music is played by selecting a more descriptive name. When you change them in the config.txt file, you associate that reference with whatever mp3 you chose.
If I were to change tavern04 to void, this is what I'd do.
1. Edit server\region.cs and change tavern04 to void. and recompile the server.
2. Edit music\digital\config.txt and change tavern4 to void
3. Edit data\regions.xml and um....not sure what needs to be done here yet....maybe make the void region and associate the void music to it.
4. Edit dawns music box and change the reference to tavern04 to void. Additionally, you might need to change the cliloc references to tavern04, as Dawns music box uses it.
And, actually, that's about it.
IMPORTANT: Some references are hard coded into the client. DeathTune is hard coded at 42 and cannot change. I mean, you can chose whichever music you want for DeathTune, but when you die, #42 plays. Combat 38, 39, and 40 are hard coded, as is login.
9.) XmlEdit
Gump Styles-
Gump,0 = A gump with just a done button and text.
Gump,1 = A gump with yes/no buttons and text.
Gump,2 = A gump with a textbox for players to type in and okay button with text.
Gump,3 = A gump with I Accept! button and No thanks, I decline button with text.
Gump,4 = A gump with Two custom answer buttons with text.
Gump,5 = A gump that is totally blank with no text.
Gump,6 = A gump with the NPC's name, a blue line at the top and an okay button with no text.
10.) Keyword Doors
[add keyworddoor westcw
WestCW,
EastCCW,
WestCCW,
EastCW,
SouthCW,
NorthCCW,
SouthCCW,
NorthCW,
//Sliding Doors
SouthSW,
SouthSE,
WestSS,
WestSN
11.) ItemID - GumpID (for replacing with custom items/gumps)
Teleporters-ItemID 14170
Mysticism Spells 24000-24015
Necro Spells
24080-24095
Chiv Spells
20736-20745
Ninjitsu Spells
21280-21287
Bushido Spells
21536-21542
Spellweaving
23000-23015
12.) Item activation by players:
If your item does not fit one of these categories, then you need to add it to the BaseHouse code here somewhere:
else if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
else if ( item is Runebook )
return true;
else if ( item is ISecurable )
return HasSecureAccess( from, ((ISecurable)item).Level );
else if ( item is Container )
return IsCoOwner( from );
else if ( item.Stackable )
return true;
else if ( item is BaseLight )
return IsFriend( from );
else if ( item is PotionKeg )
return IsFriend( from );
else if ( item is BaseBoard )
return true;
else if ( item is Dices )
return true;
else if ( item is RecallRune )
return true;
else if ( item is TreasureMap )
return true;
else if ( item is Clock )
return true;
else if ( item is BaseInstrument )
return true;
else if ( item is Dyes || item is DyeTub )
return true;
else if ( item is VendorRentalContract )
return true;
else if ( item is RewardBrazier )
return true;
13.) Example of play time limit to the area (opposed to 1st char & never > 400.0 skills)
Per Player Character: ( PlayerMobile.GameTime < Timespan.FromDays( 7 ) )
Per Account: ( ((Accounting.Account)PlayerMobile.Account).TotalGameTime < Timespan.FromDays( 7 ) )
One Time Only Character Creation codes:
//One Per Account Here.
Account ac = m.Account as Account;
if ( ac != null )
{
if (ac.Count == 1 )
{
//Noob one time only pack loot
PackItem( MakeNewbie ( new TambourineTassel() ) );
PackItem( MakeNewbie ( new Candle() ) );
PackItem( MakeNewbie ( new Scissors() ) );
PackItem( MakeNewbie ( new Dagger() ) );
PackItem( new Apple() );
PackItem( new RedBook( "a book", m.Name, 20, true ) );
//Region Ethy (Method used to hue item on creation)
EtherealHorse mount = new EtherealHorse();
mount.Hue = ( Utility.RandomMetalHue() );
PackItem( mount );
//End Region
//Noob one time only bank loot caller
NewbBank( m );
//Noob Broadcast
World.Broadcast( 33, true, ""+m.Name+" has joined Mystic for the first time!");
}
}
private static void NewbBank( Mobile m )
{
BankBox bank = m.BankBox;
Container cont;
// Begin box of money
cont = new WoodenBox();
cont.ItemID = 0xE7D;
cont.Hue = 0x489;
PlaceItemIn( cont, 34, 115, new Gold( 5000 ) );
PlaceItemIn( bank, 18, 169, cont );
// End box of money
// Begin bag of tools
cont = new Bag();
cont.Name = "Tool Bag";
PlaceItemIn( cont, 30, 35, new TinkerTools( 500 ) );
PlaceItemIn( cont, 60, 35, new HousePlacementTool() );
PlaceItemIn( cont, 90, 35, new Saw( 500 ) );
PlaceItemIn( cont, 30, 68, new Scissors() );
PlaceItemIn( cont, 45, 68, new MortarPestle( 500 ) );
PlaceItemIn( cont, 75, 68, new ScribesPen( 500 ) );
PlaceItemIn( cont, 90, 68, new SmithHammer( 500 ) );
PlaceItemIn( cont, 30, 118, new TwoHandedAxe() );
PlaceItemIn( cont, 60, 118, new FletcherTools( 500 ) );
PlaceItemIn( cont, 90, 118, new SewingKit( 500 ) );
PlaceItemIn( bank, 118, 169, cont );
// End bag of tools
// Begin bag of archery ammo
cont = new Bag();
cont.Name = "Bag Of Archery Ammo";
PlaceItemIn( cont, 48, 76, new Arrow( 1000 ) );
PlaceItemIn( bank, 118, 124, cont );
// End bag of archery ammo
// Begin bag of raw materials
cont = new Bag();
cont.Hue = 0x835;
cont.Name = "Raw Materials Bag";
PlaceItemIn( cont, 92, 84, new Leather( 500 ) );
PlaceItemIn( cont, 30, 118, new Cloth( 500 ) );
PlaceItemIn( cont, 30, 84, new Board( 500 ) );
PlaceItemIn( cont, 57, 80, new BlankScroll( 50 ) );
PlaceItemIn( cont, 86, 35, new IronIngot( 500 ) );
PlaceItemIn( bank, 98, 169, cont );
// End bag of raw materials
// Begin bag of spell casting stuff
cont = new Backpack();
cont.Hue = 1738;
cont.Name = "Spell Casting Stuff";
Item toHue = new BagOfReagents( 100 );
toHue.Hue = 0x2D;
PlaceItemIn( cont, 45, 150, toHue );
Runebook runebook = new Runebook( 10 );
runebook.CurCharges = runebook.MaxCharges;
PlaceItemIn( cont, 145, 105, runebook );
PlaceItemIn( cont, 45, 105, new Spellbook( UInt64.MaxValue ) );
for ( int i = 0; i < 9; ++i )
PlaceItemIn( cont, 45 + (i * 10), 75, new RecallRune() );
PlaceItemIn( bank, 78, 169, cont );
// End bag of spell casting stuff
//Begin Practice Weapons
cont = new Backpack();
cont.Hue = 2101;
cont.Name = "Practice Weapons";
PlaceItemIn( cont, 45, 66, new PracticeSword() );
PlaceItemIn( cont, 69, 82, new PracticeKryss() );
PlaceItemIn( cont, 93, 99, new PracticeBow() );
PlaceItemIn( cont, 117, 115, new PracticeHatchet() );
PlaceItemIn( cont, 45, 150, new PracticeClub() );
PlaceItemIn( bank, 38, 124, cont );
//End Practice Weapons
}
14.) Adding Properties to any items.
public override void GetProperties( ObjectPropertyList list )
{
list.Add( "Custom Text" );
base.GetProperties list );
list.Add( "More Custom Text" );
}
public override void GetProperties( ObjectPropertyList list )
{
list.Add( "Custom Text" );
base.GetProperties( list );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( "Custom Text" );
}
[global addtopack StuffyAnimal where playermobile
[global addtopack "item name" where playermobile map != null (to get just the online players)
[global addtopack [class name of item to add] set [property name] [value] [property name] [value] ... where [class name to use as filter] [property name] [comparison expression] [value]
[global addtopack apple set itemid 123 hue 456 name "Chocolate bunny" where playermobile skills.wrestling < 100
How to add items to all player's packpack
[online addtopack apple set itemid 123 hue 456 name "Chocolate bunny" where playermobile
this code shows how to add a normal item but have a different ID
If you have a script item which you would like to use
[online addtopack superdragonarmor name "Surprise" where playermobile
or
[online addtopack cake hue 302 name "Special Cake" where playermobile
2.) Changing the hue of multis, like houses, boats, etc.
[area interface where basemulti
3.) Ser/Deser Issues
If you know its crashing in Deserialize for playermobile, just stick a console.writeline before every read operation in the playermobile.deserialize method... see what the last one is that gets read before the crash... and then look at that line and compare it to the serialization and see whats out of order.
4.) XML Siege Info
[availatt will list all available attachments and their constructors, so you can see the list using that command.
[area addatt xmlsiege where basemulti (Add xml siege attachment to a multi)
[xmlfind basemulti 20 (Will show all multis within the range (20 in this case) and their attachments)
[addatt xmlsiege (creates a damageable object with 1000 hits, 30% fire and physical resist, and repair requirement of 1 stone, 20 iron, an 20 wood to repair 100 hits. Optional arguments:
xmlsiege hitsmax
xmlsiege hitsmax resistfire resistphysical
xmlsiege hitsmax resistfire resistphysical wood iron stone
HitsMax specifies the maximum number of hits the structure can take before being destroyed.
ResistFire and ResistPhysical are the percentage reduction in that type of damage that the object will take.
Wood, Iron, Stone - are the amount of each resource that will be required to repair 100 hits of damage on the object using the SiegeRepairTool
[getatt (opens the dialog box to modify xml attachments.)
To display HP of HP on Siege items with hit points:
if (siege != null)
{
bool ascii = true;
int hue = 1156;
string Siegepoints;
Siegepoints = string.Format("[{0}/{1}]",siege.Hits, siege.HitsMax);
PrivateOverheadMessage(MessageType.Label, hue, ascii, Siegepoints, from.NetState);
}
base.OnSingleClick( from );
}
Cannonballs
iron has medium range (15), no area, high damage (100)
light as longer range (17), no area, medium damage (80)
exploding has shorter range (11), small area (1), lower damage (60)
fiery has shortest range (8), large area (2), lowest damage (40)
light has good accuracy (0), fastest speed (35)
iron has good accuracy (0), medium speed (25)
exploding has lower accuracy (-10), slower speed (20)
fiery has lowest accuracy (-20), slowest speed (10)
5.) For adding Text Under an Item Name:
list.Add( "Blah blah blah" );
base.GetProperties( list );
6.) Moving a fully-deco'd house
The location for a house is dead center of the floor plot, so when you select the destination take that into account.
[props - target house sign.
click arrow next to "Owner"
Then "View Properties" on the owner menu
go to second page of properties menu and look for "Location" and "Map"
right down the current location, then enter the destination co-ordinates.
*** Venders, teleporters and some add-on items MAY not move with the plot. IF you have this happen, use the original location and destination location to calculate an offset formula.
(IE Original X3000, Y2000 - Destination X5000, Y1500 = Offset X2000, Y -500)
With that in hand, you can now move BillyBob the the cheese seller.
[props on vender, location x3009, y2012
add in formula to get new location = X5009,Y1512
POOF vender is now in the exact relationship to the house, but in the new destination.
or
[inc x 2000 y -500 <enter> target NPC
7.) All Houses listed by price Desc.
[global interface view price owner where basehouse order by price desc
8.) You can replace any music. When you replace it in the server\regions.cs, you're merely changing how the server handles the mp3. In other words, it just makes it so we, scripters, can more easily choose which music is played by selecting a more descriptive name. When you change them in the config.txt file, you associate that reference with whatever mp3 you chose.
If I were to change tavern04 to void, this is what I'd do.
1. Edit server\region.cs and change tavern04 to void. and recompile the server.
2. Edit music\digital\config.txt and change tavern4 to void
3. Edit data\regions.xml and um....not sure what needs to be done here yet....maybe make the void region and associate the void music to it.
4. Edit dawns music box and change the reference to tavern04 to void. Additionally, you might need to change the cliloc references to tavern04, as Dawns music box uses it.
And, actually, that's about it.
IMPORTANT: Some references are hard coded into the client. DeathTune is hard coded at 42 and cannot change. I mean, you can chose whichever music you want for DeathTune, but when you die, #42 plays. Combat 38, 39, and 40 are hard coded, as is login.
9.) XmlEdit
Gump Styles-
Gump,0 = A gump with just a done button and text.
Gump,1 = A gump with yes/no buttons and text.
Gump,2 = A gump with a textbox for players to type in and okay button with text.
Gump,3 = A gump with I Accept! button and No thanks, I decline button with text.
Gump,4 = A gump with Two custom answer buttons with text.
Gump,5 = A gump that is totally blank with no text.
Gump,6 = A gump with the NPC's name, a blue line at the top and an okay button with no text.
10.) Keyword Doors
[add keyworddoor westcw
WestCW,
EastCCW,
WestCCW,
EastCW,
SouthCW,
NorthCCW,
SouthCCW,
NorthCW,
//Sliding Doors
SouthSW,
SouthSE,
WestSS,
WestSN
11.) ItemID - GumpID (for replacing with custom items/gumps)
Teleporters-ItemID 14170
Mysticism Spells 24000-24015
Necro Spells
24080-24095
Chiv Spells
20736-20745
Ninjitsu Spells
21280-21287
Bushido Spells
21536-21542
Spellweaving
23000-23015
12.) Item activation by players:
If your item does not fit one of these categories, then you need to add it to the BaseHouse code here somewhere:
else if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
else if ( item is Runebook )
return true;
else if ( item is ISecurable )
return HasSecureAccess( from, ((ISecurable)item).Level );
else if ( item is Container )
return IsCoOwner( from );
else if ( item.Stackable )
return true;
else if ( item is BaseLight )
return IsFriend( from );
else if ( item is PotionKeg )
return IsFriend( from );
else if ( item is BaseBoard )
return true;
else if ( item is Dices )
return true;
else if ( item is RecallRune )
return true;
else if ( item is TreasureMap )
return true;
else if ( item is Clock )
return true;
else if ( item is BaseInstrument )
return true;
else if ( item is Dyes || item is DyeTub )
return true;
else if ( item is VendorRentalContract )
return true;
else if ( item is RewardBrazier )
return true;
13.) Example of play time limit to the area (opposed to 1st char & never > 400.0 skills)
Per Player Character: ( PlayerMobile.GameTime < Timespan.FromDays( 7 ) )
Per Account: ( ((Accounting.Account)PlayerMobile.Account).TotalGameTime < Timespan.FromDays( 7 ) )
One Time Only Character Creation codes:
//One Per Account Here.
Account ac = m.Account as Account;
if ( ac != null )
{
if (ac.Count == 1 )
{
//Noob one time only pack loot
PackItem( MakeNewbie ( new TambourineTassel() ) );
PackItem( MakeNewbie ( new Candle() ) );
PackItem( MakeNewbie ( new Scissors() ) );
PackItem( MakeNewbie ( new Dagger() ) );
PackItem( new Apple() );
PackItem( new RedBook( "a book", m.Name, 20, true ) );
//Region Ethy (Method used to hue item on creation)
EtherealHorse mount = new EtherealHorse();
mount.Hue = ( Utility.RandomMetalHue() );
PackItem( mount );
//End Region
//Noob one time only bank loot caller
NewbBank( m );
//Noob Broadcast
World.Broadcast( 33, true, ""+m.Name+" has joined Mystic for the first time!");
}
}
private static void NewbBank( Mobile m )
{
BankBox bank = m.BankBox;
Container cont;
// Begin box of money
cont = new WoodenBox();
cont.ItemID = 0xE7D;
cont.Hue = 0x489;
PlaceItemIn( cont, 34, 115, new Gold( 5000 ) );
PlaceItemIn( bank, 18, 169, cont );
// End box of money
// Begin bag of tools
cont = new Bag();
cont.Name = "Tool Bag";
PlaceItemIn( cont, 30, 35, new TinkerTools( 500 ) );
PlaceItemIn( cont, 60, 35, new HousePlacementTool() );
PlaceItemIn( cont, 90, 35, new Saw( 500 ) );
PlaceItemIn( cont, 30, 68, new Scissors() );
PlaceItemIn( cont, 45, 68, new MortarPestle( 500 ) );
PlaceItemIn( cont, 75, 68, new ScribesPen( 500 ) );
PlaceItemIn( cont, 90, 68, new SmithHammer( 500 ) );
PlaceItemIn( cont, 30, 118, new TwoHandedAxe() );
PlaceItemIn( cont, 60, 118, new FletcherTools( 500 ) );
PlaceItemIn( cont, 90, 118, new SewingKit( 500 ) );
PlaceItemIn( bank, 118, 169, cont );
// End bag of tools
// Begin bag of archery ammo
cont = new Bag();
cont.Name = "Bag Of Archery Ammo";
PlaceItemIn( cont, 48, 76, new Arrow( 1000 ) );
PlaceItemIn( bank, 118, 124, cont );
// End bag of archery ammo
// Begin bag of raw materials
cont = new Bag();
cont.Hue = 0x835;
cont.Name = "Raw Materials Bag";
PlaceItemIn( cont, 92, 84, new Leather( 500 ) );
PlaceItemIn( cont, 30, 118, new Cloth( 500 ) );
PlaceItemIn( cont, 30, 84, new Board( 500 ) );
PlaceItemIn( cont, 57, 80, new BlankScroll( 50 ) );
PlaceItemIn( cont, 86, 35, new IronIngot( 500 ) );
PlaceItemIn( bank, 98, 169, cont );
// End bag of raw materials
// Begin bag of spell casting stuff
cont = new Backpack();
cont.Hue = 1738;
cont.Name = "Spell Casting Stuff";
Item toHue = new BagOfReagents( 100 );
toHue.Hue = 0x2D;
PlaceItemIn( cont, 45, 150, toHue );
Runebook runebook = new Runebook( 10 );
runebook.CurCharges = runebook.MaxCharges;
PlaceItemIn( cont, 145, 105, runebook );
PlaceItemIn( cont, 45, 105, new Spellbook( UInt64.MaxValue ) );
for ( int i = 0; i < 9; ++i )
PlaceItemIn( cont, 45 + (i * 10), 75, new RecallRune() );
PlaceItemIn( bank, 78, 169, cont );
// End bag of spell casting stuff
//Begin Practice Weapons
cont = new Backpack();
cont.Hue = 2101;
cont.Name = "Practice Weapons";
PlaceItemIn( cont, 45, 66, new PracticeSword() );
PlaceItemIn( cont, 69, 82, new PracticeKryss() );
PlaceItemIn( cont, 93, 99, new PracticeBow() );
PlaceItemIn( cont, 117, 115, new PracticeHatchet() );
PlaceItemIn( cont, 45, 150, new PracticeClub() );
PlaceItemIn( bank, 38, 124, cont );
//End Practice Weapons
}
14.) Adding Properties to any items.
public override void GetProperties( ObjectPropertyList list )
{
list.Add( "Custom Text" );
base.GetProperties list );
list.Add( "More Custom Text" );
}
public override void GetProperties( ObjectPropertyList list )
{
list.Add( "Custom Text" );
base.GetProperties( list );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( "Custom Text" );
}