1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
5/5, 1 rating

Xmlspawner Quick Commands/Advanced Installation

Summary of the tutorial

Feature Usage: All Xmlspawner Extra Installation Steps

Installation Step:

Estimated Completion Time: ~2:00 hours (give or take copy/paste speed)

Tutorial Steps: 12 @ ~5:00 minutes/ea.

Introduction: While ServUO's repo has Xmlspawner installed and all additional steps, this tutorial is for those that are not using ServUO's repo and serves as a reference after Xmlspawner has been installed.

Tutorial Step 1-A:
This is the first XmlSpawner/XmlQuest Creation Tutorial. We will begin by going over a few basic commands and continue with creating an XmlQuestNPC. Included in this initial tutorial you will also find the Advanced XmlSpawner installation steps. From this point forward, it will be assumed you have done those steps, prior to attempting to follow any of these tutorials. It's completely fine if you have done all 12 additional steps during the first installation. None of the additional steps will interfere with your shard if you don't plan on using them right away. If there is an advanced step required during a tutorial, it will be noted at the top of the tutorial. My commands all start with "[", it may be different for each shard.

Helpful Commands and Advanced Installation

If you have a Staff Toolbar running on your shard, it can be very helpful to include the following commands:

[Add Xmlspawner - This will create a brand new Xmlspawner to be placed at your target. By default all new Xmlspawners are turned off when placed.

[Add XmlQuestNPC - This will place a randomly created NPC at your target. Your first step after placing the NPC should be to freeze it in place.

[GETATT - This will show any and all attachments that your target has. This is handy for troubleshooting to make sure your attachment values are being changed properly.

[XmlShow - Displays all XmlSpawners as ship masts for easy editing. While they are still invisible, players can still get "stuck" on them, so you probably don't want to do this when there are lots of players online. Another flaw is that if you or a player is standing on top of a spawner displayed as a mast, you won't be able to double-click to open the gump. You have to be at least 1 tile away.

[XmlHide - Returns XmlSpawners to their invisible "crystal" items after using XmlShow. Using XmlHide does have one annoying consequence in that all spawners become frozen, so if you're carrying a bunch in your backpack (hopefully they are NOT running as that is a huge mistake), those will all become frozen as well.

[XmlEdit - This attaches the XmlDialog attachment to your target, i.e. the QuestNPC, but it can also be used on inanimate objects.

[XmlAdd - While not really a command that is needed in a toolbar, this particular command allows you to set defaults for Xmlspawners that your character creates from that point forward. This also means that characters can have different default settings. (see image 1.0).

[​IMG]
Image 1.0


The following steps should be taken to complete the Xmlspawner installation with the additional options. You can have all these options installed, but only use one or two as they won't interfere with "normal" shard function unless you are using them in conjunction with an Xml package. It's helpful to do these steps in the event that at a future date you would like to use more of the functions of Xmlspawner.

Tutorial Step 1-B:
Advanced Installation Steps:
STEP 1: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To take advantage of the XmlQuest killtask keywords KILL and KILLNAMED, one line must be added to the OnDeath method in BaseCreature.cs as described below (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, the KILL and KILLNAMED features simply wont do anything)

around line 4172 of basecreature.cs change

Code (C#):
  1. Titles.AwardKarma( ds.m_Mobile, totalKarma, true );
to

Code (C#):
  1. Titles.AwardKarma( ds.m_Mobile, totalKarma, true );
  2. // modification to support XmlQuest Killtasks
  3. XmlQuest.RegisterKill( this, ds.m_Mobile);

STEP 2: (NOT recommended but allowed) (Included in the ServUO Repo)
-------------------------------------
In order to provide the book extended text entry interface, xmlspawner replaces the default packet handler for basebooks. While this does not affect the behavior of standard books in any way, if you DON'T want this mod, comment out the following line at line 26 in PacketHandlerOverrides.cs
If you comment out this line then you will NOT be able to edit spawner entries using the book interface.

Code (C#):
  1. // Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ContentChangeOverride ) );

STEP 3: (recommended but not required) (Included in the ServUO Repo) NOTE: Use a program like WinMerge to compare files before you replace them if NOT using the ServUO Repo.
--------------------------------------
To take advantage of the stealable rares/artifacts system and the support for eliminating issues of maintained spawner control over items, either replace the default distribution files container.cs (Scripts/Items/Containers/Container.cs) and stealing.cs (Scripts/Skills/Stealing.cs) with the versions found in xmlspawner2-support.zip. Select the appropriate RC1 or RC2 versions and change the extension back to .cs (always keep backups of the originals). Or the simpler way is to just change the extension of the distro files to something other than .cs


STEP 4: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To take advantage of spawner triggering on skill use you must change 4 lines in Scripts/Misc/SkillCheck.cs (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, the SkillTriggering features simply wont do anything). Near the beginning of the file at line 73 change these lines.

Code (C#):
  1. public static void Initialize()
  2. {
  3. Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation );
  4. Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation );
  5.  
  6. Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget );
  7. Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget );
  8. }
to this

Code (C#):
  1. public static void Initialize()
  2. {
  3. // Begin mod to enable XmlSpawner skill triggering
  4. Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( XmlSpawnerSkillCheck.Mobile_SkillCheckLocation );
  5. Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( XmlSpawnerSkillCheck.Mobile_SkillCheckDirectLocation );
  6.  
  7. Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( XmlSpawnerSkillCheck.Mobile_SkillCheckTarget );
  8. Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( XmlSpawnerSkillCheck.Mobile_SkillCheckDirectTarget );
  9. // End mod to enable XmlSpawner skill triggering
  10. }

STEP 5: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To allow the XmlQuest killtask keywords KILL and KILLNAMED to be applied to players providing a contract kill system, one line must be added to ReportMurderer.cs (Scripts/Gumps/ReportMurderer.cs) as described below (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, the KILL and KILLNAMED features simply wont work when specifying players as the targets).
This is also required to allow the attachment system to register kills (through the OnKill or OnKilled methods). Some addons such as XmlPoints require this.

around line 64 of ReportMurderer.cs change

Code (C#):
  1. Titles.AwardKarma( g, karmaAward, true );
to

Code (C#):
  1. Titles.AwardKarma( g, karmaAward, true );
  2. // modification to support XmlQuest Killtasks of players
  3. Server.Items.XmlQuest.RegisterKill( m, g);


STEP 6: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To allow attachments to be triggered on weapon hits, one line must be added to BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs) as described below (note, you don't have to make this mod if you don't want to, the spawner and other items will work just fine without it, the attachment OnWeaponHit method simply wont be called so attachments such as XmlMinionStrike will not work)

around line 1644 of BaseWeapon.cs at the end of the OnHit method, change

Code (C#):
  1. if ( AnimalForm.UnderTransformation( defender, typeof( BullFrog ) ) )
  2.                     attacker.ApplyPoison( defender, Poison.Regular );
  3.             }
  4.         }
to

Code (C#):
  1. if ( AnimalForm.UnderTransformation( defender, typeof( BullFrog ) ) )
  2.                     attacker.ApplyPoison( defender, Poison.Regular );
  3.             }
  4.             // hook for attachment OnWeaponHit method
  5.             Server.Engines.XmlSpawner2.XmlAttach.OnWeaponHit(this, attacker, defender, damageGiven);
  6.         }

STEP 7: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To allow the ItemIdentification skill to be used to reveal attachments on items/mobs, one line must be added to ItemIdentification.cs (Scripts/Skills/ItemIdentification.cs) as described below. (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, players just wont be able to see what attachments are on an item/mob using this skill).

around line 50 of ItemIdentification.cs change

Code (C#):
  1. else if ( o is Mobile )
  2. {
  3.     ((Mobile)o).OnSingleClick( from );
  4. }
  5.     else
  6. {
  7.     from.SendLocalizedMessage( 500353 ); // You are not certain...
  8. }
to

Code (C#):
  1. else if ( o is Mobile )
  2. {
  3.     ((Mobile)o).OnSingleClick( from );
  4. }
  5.     else
  6. {
  7.     from.SendLocalizedMessage( 500353 ); // You are not certain...
  8. }
  9. //allows the identify skill to reveal attachments
  10. Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from,o);

STEP 8: (recommended but not required) (Included in the ServUO Repo)
--------------------------------------
To allow attachments to make use of the OnEquip and OnRemoved methods, the following 8 changes must be made in three files, BaseArmor.cs, BaseWeapon.cs, and BaseJewel.cs. (note, you dont have to make this mod if you dont want to, the spawner and other items/attachments will work just fine without it, you just wont be able to use certain attachments that make use of this feature such as XmlFactionEquip).

around line 1202 of BaseArmor.cs (Scripts/Items/Armor/BaseArmor.cs) at the end of the CanEquip method change

Code (C#):
  1. return base.CanEquip( from );
to

Code (C#):
  1. // XmlAttachment check for CanEquip
  2.     if(!Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, from))
  3.     {
  4.             return false;
  5.     } else
  6.     {
  7.  
  8.         return base.CanEquip( from );
  9.     }

around line 1241 of BaseArmor.cs (Scripts/Items/Armor/BaseArmor.cs) at the end of the OnEquip method change


Code (C#):
  1. return base.OnEquip( from );
to


Code (C#):
  1. // XmlAttachment check for OnEquip
  2.         Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, from);
  3.  
  4.     return base.OnEquip( from );

around line 1273 of BaseArmor.cs (Scripts/Items/Armor/BaseArmor.cs) at the end of the OnRemoved method change


Code (C#):
  1. base.OnRemoved( parent );
to

Code (C#):
  1. // XmlAttachment check for OnRemoved
  2.     Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
  3.  
  4.     base.OnRemoved( parent );

around line 569 of BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs) at the end of the CanEquip method change

Code (C#):
  1. else if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
  2.             {
  3.                 return false;
  4.             }
  5.             else
  6.             {
  7.                 return base.CanEquip( from );
  8.             }
to

Code (C#):
  1. else if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
  2.             {
  3.                 return false;
  4.             }
  5.             else
  6.                 // XmlAttachment check for CanEquip
  7.                 if (!Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, from))
  8.                 {
  9.                     return false;
  10.                 }
  11.                 else
  12.                 {
  13.                     return base.CanEquip(from);
  14.                 }

around line 628 of BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs) at the end of the OnEquip method change

Code (C#):
  1. return true;
to

Code (C#):
  1. // XmlAttachment check for OnEquip
  2.     Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, from);
  3.  
  4.     return true;

around line 686 of BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs) at the end of the OnRemoved method change

Code (C#):
  1. m.Delta( MobileDelta.WeaponDamage );
  2.         }
  3.     }
to

Code (C#):
  1. m.Delta( MobileDelta.WeaponDamage );
  2.         }
  3.         // XmlAttachment check for OnRemoved
  4.         Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
  5.     }

around line 138 of BaseJewel.cs (Scripts/Items/Jewels/BaseJewel.cs) at the end of the OnAdded method change

Code (C#):
  1. from.CheckStatTimers();
  2.         }
  3.     }
to


Code (C#):
  1. from.CheckStatTimers();
  2.         }
  3.  
  4.             // XmlAttachment check for OnEquip and CanEquip
  5.         if(parent is Mobile)
  6.             {
  7.                 if(Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent))
  8.                 {
  9.                     Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent);
  10.                 } else
  11.                 {
  12.                     ((Mobile)parent).AddToBackpack(this);
  13.                 }
  14.             }
  15.     }

around line 151 of BaseJewel.cs (Scripts/Items/Jewels/BaseJewel.cs) at the end of the OnRemoved method change

Code (C#):
  1. from.CheckStatTimers();
  2.         }
  3.     }
to

Code (C#):
  1. from.CheckStatTimers();
  2.         }
  3.  
  4.         // XmlAttachment check for OnRemoved
  5.         Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
  6.     }
STEP 9: (recommended but not required) (Included in the ServUO Repo)
---------------------------------------
To allow attachments to make use of the OnArmorHit methods, the following changes must be made in BaseWeapon.cs.(note, you don't have to make this mod if you don't want to, the spawner and other items/attachments will work just fine without it, you just wont be able to use features of certain attachments that require this such as XmlCustomAttacks).


at the beginning of the AbsorbDamageAOS method around line 1103 of BaseWeapon.cs change

Code (C#):
  1. public virtual int AbsorbDamageAOS( Mobile attacker, Mobile defender, int damage )
  2.         {
  3.             bool blocked = false;
to

Code (C#):
  1. public virtual int AbsorbDamageAOS( Mobile attacker, Mobile defender, int damage )
  2.         {
  3.             bool blocked = false;
  4.             int originaldamage = damage;

in the AbsorbDamageAOS method around line 1142 of BaseWeapon.cs change

Code (C#):
  1. if ( shield != null )
  2.         {
  3.             shield.OnHit( this, damage );
  4.  
  5.         }
to
Code (C#):
  1. if ( shield != null )
  2.         {
  3.             shield.OnHit( this, damage );
  4.  
  5.             // XmlAttachment check for OnArmorHit
  6.             Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, shield, this, originaldamage);
  7.         }

in the AbsorbDamageAOS method around line 1173 of BaseWeapon.cs change

Code (C#):
  1. if (armor != null)
  2.                 {
  3.                     armor.OnHit(this, damage); // call OnHit to lose durability
  4.                 }
  5.             }
  6.  
  7.             return damage;
  8.         }

to

Code (C#):
  1. if (armor != null)
  2.                 {
  3.                     armor.OnHit(this, damage); // call OnHit to lose durability
  4.  
  5.                     // XmlAttachment check for OnArmorHit
  6.                     damage -= Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, armorItem, this, originaldamage);
  7.                 }
  8.             }
  9.  
  10.             return damage;
  11.         }


in the AbsorbDamage method around line 1210 of BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs) change


Code (C#):
  1. int virtualArmor = defender.VirtualArmor + defender.VirtualArmorMod;

to

Code (C#):
  1. // XmlAttachment check for OnArmorHit
  2.     damage -= Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, armorItem, this, damage);
  3.     damage -= Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, shield, this, damage);
  4.  
  5.     int virtualArmor = defender.VirtualArmor + defender.VirtualArmorMod;


STEP 10: (recommended but not required) (Included in the ServUO Repo)
---------------------------------------
To allow attachment properties on weapons/armor to be automatically displayed in the properties list on mouseover/click, these changes must be made to BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs), BaseArmor.cs (Scripts/Items/Armor/BaseArmor.cs) and BaseJewel.cs (Scripts/Items/Jewels/BaseJewel.cs) described below. (note, you don't have to make this mod if you don't want to, the spawner and other items will work just fine without it, players just wont automatically see attachment properties on items with attachments).

at the end of the GetProperties method around line 3246 of BaseWeapon.cs change

Code (C#):
  1. if ( m_Hits > 0 && m_MaxHits > 0 )
  2.         list.Add( 1060639, "{0}\t{1}", m_Hits, m_MaxHits ); // durability ~1_val~ / ~2_val~
to

Code (C#):
  1. if ( m_Hits > 0 && m_MaxHits > 0 )
  2.         list.Add( 1060639, "{0}\t{1}", m_Hits, m_MaxHits ); // durability ~1_val~ / ~2_val~
  3.  
  4.     // mod to display attachment properties
  5.     Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list);

at the end of the GetProperties method around line 1518 of BaseArmor.cs change

Code (C#):
  1. if ( m_HitPoints > 0 && m_MaxHitPoints > 0 )
  2.         list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~
to

Code (C#):
  1. if ( m_HitPoints > 0 && m_MaxHitPoints > 0 )
  2.         list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~
  3.        
  4.     // mod to display attachment properties
  5.     Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list);
at the end of the GetProperties method around line 226 of BaseJewel.cs change


Code (C#):
  1. base.AddResistanceProperties( list );
to

Code (C#):
  1. base.AddResistanceProperties( list );
  2.        
  3.         // mod to display attachment properties
  4.         Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list);

STEP 11: (recommended but not required)
---------------------------------------
To prevent Paragons from being despawned due to smartspawning, add this property to BaseCreature.cs anywhere within the BaseCreature class. Paragons should be excluded because the OnBeforeSpawn and OnAfterSpawn methods are not called when smartspawning, so if they despawn, they will not come back as paragons.

Code (C#):
  1. public virtual bool HoldSmartSpawning
  2.         {
  3.             get{
  4.                 // dont smartspawn paragons
  5.                 if(IsParagon) return true;
  6.  
  7.                 return false;
  8.             }
  9.         }
STEP 12: (recommended but not required) (Included in the ServUO Repo)
---------------------------------------
To fix a problem with lootpack generation under RunUO 2.0 using the LOOTPACK keyword, make this mod in Misc/LootPack.cs around line 571. If you don't make this mod, you will not be able to use the LOOTPACK keyword. (Note: To my knowledge this still needs to be done with every fork after RunUO 2.0.)

Code (C#):
  1. private static bool IsInTokuno(Mobile m)
  2.         {
  3.             // ARTEGORDONMOD
  4.             // allow lootpack construction without a mobile
  5.             if (m == null) return false;
  6.  
  7.             if (m.Region.IsPartOf("Fan Dancer's Dojo"))
  8.                 return true;
  9.  
  10.             if (m.Region.IsPartOf("Yomotsu Mines"))
  11.                 return true;
  12.  
  13.             return (m.Map == Map.Tokuno);
  14.         }