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!

XmlSpawner2

Eowyn

Wanderer
Iam new so bear with me please

ArteGordon said:
XmlSpawner2
v2.71
updated 12/04/04
ArteGordon

Summary:
A spawn control system based upon BobSmarts xmlspawner supporting sophisticated conditional spawn triggering, individual customization of spawns and their drops, and systems for stealable rares, interactive npcs, functional attachments, mob factions, pvp points, custom special attacks, socketed items/creatures, and quests.

New to Version 2.71
updated 12/04/04

STEP 4: (recommended but not required)
To take advantage of the stealable rares/artifacts system and the support for eliminating issues of maintained spawner control over items, either replace the RC0 distribution files container.cs (Scripts/Items/Containers/Container.cs) and stealing.cs (Scripts/Skills/Stealing.cs) with the versions found in xmlspawner2-support2of2.zip (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

****
This step I completly got lost on since it wasn't spelled out as in the numerous steps following. I really don't have any ideas what to change the extensions of the distro files to and I feel hesitant in totally replacing the files.

Please walk me through this

Thanks in Advance,

Eowyn
 

ArteGordon

Wanderer
Eowyn said:
ArteGordon said:
XmlSpawner2
v2.71
updated 12/04/04
ArteGordon

Summary:
A spawn control system based upon BobSmarts xmlspawner supporting sophisticated conditional spawn triggering, individual customization of spawns and their drops, and systems for stealable rares, interactive npcs, functional attachments, mob factions, pvp points, custom special attacks, socketed items/creatures, and quests.

New to Version 2.71
updated 12/04/04

STEP 4: (recommended but not required)
To take advantage of the stealable rares/artifacts system and the support for eliminating issues of maintained spawner control over items, either replace the RC0 distribution files container.cs (Scripts/Items/Containers/Container.cs) and stealing.cs (Scripts/Skills/Stealing.cs) with the versions found in xmlspawner2-support2of2.zip (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

****
This step I completly got lost on since it wasn't spelled out as in the numerous steps following. I really don't have any ideas what to change the extensions of the distro files to and I feel hesitant in totally replacing the files.

Please walk me through this

Thanks in Advance,

Eowyn


if you have already located the files

Scripts/Items/Containers/Container.cs
Scripts/Skills/Stealing.cs

just rename them to something like

Container._cs
and
Stealing._cs

that way, they remain in their original locations but will not be loaded in due to the fact that they dont have the .cs extension.
 
M

michaelgrubb

Guest
I love the XMLspawner, but I am having trouble using the take command. I am sure it is my entry that is causing the trouble.

I am trying something like this:
mongbat/TAKE/key
Any help would be great, and thanks.
 

ArteGordon

Wanderer
TAKE is one of the standalone keywords as listed in the help gump. This means that it has to be the first thing in an entry, so that it gets spawned like your mongbat instead of modifying a spawn like the Value/Itemtype keywords.

If you wanted to spawn a mongbat and also take the object named "key", you would have 2 entries.

mongbat
TAKE/key


If you wanted to take a key type object rather than an object named "key" then you would use the TAKEBYTYPE keyword.

mongbat
TAKEBYTYPE/key

But note, this will take any key the player has in their pack.

If you wanted to have a mongbat that actually wandered around and took the key when the player encountered it, then you could spawn a mongbat and add the xmldialog attachment with a dialog entry that included the TAKE action (see the travelagent.npc example).
Like this

mongbat/ATTACH/xmldialog,travelagent

where travelagent.npc is one of the example .npc files
 

ArteGordon

Wanderer
yes, just spawn the chest and the key with the same KeyValue, like this

metalchest/locked/true/keyvalue/8765
key/keyvalue/8765

This will spawn a locked chest and a key that will unlock it because both the key and the chest have the keyvalue of 8765

If you wanted to spawn the key in a container you could do something like

bag/ADD/<key/keyvalue/8765>

to spawn a bag with the key in it

or

orc/ADD/<key/keyvalue/8765>

to spawn an orc carrying the key

or

orc/ADD/<bag/ADD/<key/keyvalue/8765>>

to spawn an orc carrying a bag that has they key in it

etc.
 

ArteGordon

Wanderer
the standard distribution keys dont support limited uses, that has to be scripted in.
David's GuardKey supports this. Just do the same thing that i mentioned earlier except spawn one of those instead and set the maxuses property.

Like this

metalchest/locked/true/keyvalue/8765
guardkey/keyvalue/8765/maxuses/2

for a 2 use key, or

guardkey/keyvalue/8765/maxuses/RND,1,2

for a key with 1 or 2 uses (random).
 

ArteGordon

Wanderer
updated to version 2.72

from the changelog

Version 2.72
updated 12/26/04
- modified installation step 11 to include displaying attachment properties on jewelry.

- minor modification of attachment properties display on mouseover (eliminated extra cr at the end.) (thanks to sUpplier1 for pointing this out).

- added Tokuno map support to xmlfind, xmlsaving, xmlloading, skill triggering, and .map importing.
 

Raynew43

Sorceror
Don't know where I went wrong but I get this error

Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Items\Jewels\BaseJewel.cs: CS1513: (line 133, column 6) } expe
cted
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Here's my jewel.cs. Maybe you can point out where I went wrong. Still new to messing around with the scripts.

Code:
using System;

namespace Server.Items
{
	public enum GemType
	{
		None,
		StarSapphire,
		Emerald,
		Sapphire,
		Ruby,
		Citrine,
		Amethyst,
		Tourmaline,
		Amber,
		Diamond
	}

	public abstract class BaseJewel : Item
	{
		private AosAttributes m_AosAttributes;
		private AosElementAttributes m_AosResistances;
		private AosSkillBonuses m_AosSkillBonuses;
		private CraftResource m_Resource;
		private GemType m_GemType;

		[CommandProperty( AccessLevel.GameMaster )]
		public AosAttributes Attributes
		{
			get{ return m_AosAttributes; }
			set{}
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public AosElementAttributes Resistances
		{
			get{ return m_AosResistances; }
			set{}
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public AosSkillBonuses SkillBonuses
		{
			get{ return m_AosSkillBonuses; }
			set{}
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public CraftResource Resource
		{
			get{ return m_Resource; }
			set{ m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public GemType GemType
		{
			get{ return m_GemType; }
			set{ m_GemType = value; InvalidateProperties(); }
		}

		public override int PhysicalResistance{ get{ return m_AosResistances.Physical; } }
		public override int FireResistance{ get{ return m_AosResistances.Fire; } }
		public override int ColdResistance{ get{ return m_AosResistances.Cold; } }
		public override int PoisonResistance{ get{ return m_AosResistances.Poison; } }
		public override int EnergyResistance{ get{ return m_AosResistances.Energy; } }
		public virtual int BaseGemTypeNumber{ get{ return 0; } }

		public override int LabelNumber
		{
			get
			{
				if ( m_GemType == GemType.None )
					return base.LabelNumber;

				return BaseGemTypeNumber + (int)m_GemType - 1;
			}
		}

		public virtual int ArtifactRarity{ get{ return 0; } }

		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;
		}

		public override void OnAdded( object parent )
		{
			if ( Core.AOS && parent is Mobile )
			{
				Mobile from = (Mobile)parent;

				m_AosSkillBonuses.AddTo( from );

				int strBonus = m_AosAttributes.BonusStr;
				int dexBonus = m_AosAttributes.BonusDex;
				int intBonus = m_AosAttributes.BonusInt;

				if ( strBonus != 0 || dexBonus != 0 || intBonus != 0 )
				{
					string modName = this.Serial.ToString();

					if ( strBonus != 0 )
						from.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

					if ( dexBonus != 0 )
						from.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

					if ( intBonus != 0 )
						from.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
				}

				from.CheckStatTimers();
			}
			
			// XmlAttachment check for OnEquip and CanEquip
		if(parent is Mobile)
    		{
        		if(Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent))
        		{
        			Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent);
        		} else
        		{
        			((Mobile)parent).AddToBackpack(this);
        		{     	
	        	{
	   }      		
		public override void OnRemoved( object parent )
		{
			if ( Core.AOS && parent is Mobile )
			{
				Mobile from = (Mobile)parent;

				m_AosSkillBonuses.Remove();

				string modName = this.Serial.ToString();

				from.RemoveStatMod( modName + "Str" );
				from.RemoveStatMod( modName + "Dex" );
				from.RemoveStatMod( modName + "Int" );

				from.CheckStatTimers();
			}
			
			// XmlAttachment check for OnRemoved
		Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
		
		}

		public BaseJewel( Serial serial ) : base( serial )
		{
		}

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			m_AosSkillBonuses.GetProperties( list );

			int prop;

			if ( (prop = ArtifactRarity) > 0 )
				list.Add( 1061078, prop.ToString() ); // artifact rarity ~1_val~

			if ( (prop = m_AosAttributes.WeaponDamage) != 0 )
				list.Add( 1060401, prop.ToString() ); // damage increase ~1_val~%

			if ( (prop = m_AosAttributes.DefendChance) != 0 )
				list.Add( 1060408, prop.ToString() ); // defense chance increase ~1_val~%

			if ( (prop = m_AosAttributes.BonusDex) != 0 )
				list.Add( 1060409, prop.ToString() ); // dexterity bonus ~1_val~

			if ( (prop = m_AosAttributes.EnhancePotions) != 0 )
				list.Add( 1060411, prop.ToString() ); // enhance potions ~1_val~%

			if ( (prop = m_AosAttributes.CastRecovery) != 0 )
				list.Add( 1060412, prop.ToString() ); // faster cast recovery ~1_val~

			if ( (prop = m_AosAttributes.CastSpeed) != 0 )
				list.Add( 1060413, prop.ToString() ); // faster casting ~1_val~

			if ( (prop = m_AosAttributes.AttackChance) != 0 )
				list.Add( 1060415, prop.ToString() ); // hit chance increase ~1_val~%

			if ( (prop = m_AosAttributes.BonusHits) != 0 )
				list.Add( 1060431, prop.ToString() ); // hit point increase ~1_val~

			if ( (prop = m_AosAttributes.BonusInt) != 0 )
				list.Add( 1060432, prop.ToString() ); // intelligence bonus ~1_val~

			if ( (prop = m_AosAttributes.LowerManaCost) != 0 )
				list.Add( 1060433, prop.ToString() ); // lower mana cost ~1_val~%

			if ( (prop = m_AosAttributes.LowerRegCost) != 0 )
				list.Add( 1060434, prop.ToString() ); // lower reagent cost ~1_val~%

			if ( (prop = m_AosAttributes.Luck) != 0 )
				list.Add( 1060436, prop.ToString() ); // luck ~1_val~

			if ( (prop = m_AosAttributes.BonusMana) != 0 )
				list.Add( 1060439, prop.ToString() ); // mana increase ~1_val~

			if ( (prop = m_AosAttributes.RegenMana) != 0 )
				list.Add( 1060440, prop.ToString() ); // mana regeneration ~1_val~

			if ( (prop = m_AosAttributes.ReflectPhysical) != 0 )
				list.Add( 1060442, prop.ToString() ); // reflect physical damage ~1_val~%

			if ( (prop = m_AosAttributes.RegenStam) != 0 )
				list.Add( 1060443, prop.ToString() ); // stamina regeneration ~1_val~

			if ( (prop = m_AosAttributes.RegenHits) != 0 )
				list.Add( 1060444, prop.ToString() ); // hit point regeneration ~1_val~

			if ( (prop = m_AosAttributes.SpellChanneling) != 0 )
				list.Add( 1060482 ); // spell channeling

			if ( (prop = m_AosAttributes.SpellDamage) != 0 )
				list.Add( 1060483, prop.ToString() ); // spell damage increase ~1_val~%

			if ( (prop = m_AosAttributes.BonusStam) != 0 )
				list.Add( 1060484, prop.ToString() ); // stamina increase ~1_val~

			if ( (prop = m_AosAttributes.BonusStr) != 0 )
				list.Add( 1060485, prop.ToString() ); // strength bonus ~1_val~

			if ( (prop = m_AosAttributes.WeaponSpeed) != 0 )
				list.Add( 1060486, prop.ToString() ); // swing speed increase ~1_val~%

			base.AddResistanceProperties( list );
			
			// mod to display attachment properties
            Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list);
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 2 ); // version

			writer.WriteEncodedInt( (int) m_Resource );
			writer.WriteEncodedInt( (int) m_GemType );

			m_AosAttributes.Serialize( writer );
			m_AosResistances.Serialize( writer );
			m_AosSkillBonuses.Serialize( writer );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

					goto case 1;
				}
				case 1:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosResistances = new AosElementAttributes( this, reader );
					m_AosSkillBonuses = new AosSkillBonuses( this, reader );

					if ( Core.AOS && Parent is Mobile )
						m_AosSkillBonuses.AddTo( (Mobile)Parent );

					int strBonus = m_AosAttributes.BonusStr;
					int dexBonus = m_AosAttributes.BonusDex;
					int intBonus = m_AosAttributes.BonusInt;

					if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
					{
						Mobile m = (Mobile)Parent;

						string modName = Serial.ToString();

						if ( strBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

						if ( dexBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

						if ( intBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
					}

					if ( Parent is Mobile )
						((Mobile)Parent).CheckStatTimers();

					break;
				}
				case 0:
				{
					m_AosAttributes = new AosAttributes( this );
					m_AosResistances = new AosElementAttributes( this );
					m_AosSkillBonuses = new AosSkillBonuses( this );

					break;
				}
			}

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
	}
}
 

ArteGordon

Wanderer
the problem is here

Code:
if(parent is Mobile)
    		{
        		if(Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent))
        		{
        			Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent);
        		} else
        		{
        			((Mobile)parent).AddToBackpack(this);
        		{     	
	        	{

you have the last two brackets going the wrong way. It should be

Code:
if(parent is Mobile)
    		{
        		if(Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent))
        		{
        			Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent);
        		} else
        		{
        			((Mobile)parent).AddToBackpack(this);
        		}     	
	        	}
 

Kurrgan

Wanderer
Okay maybe I missed something but I saw you added .map importing support. I have tried several different locations for my .map files but I just can't get it to load one. Can you walk me through it real quick. I have all my .map files in a subfolder inside the RunUO folder. So it would be like RunUO 1.0 RCOi\map files\Ilshenar\AncientLair.map I tried placing that in the config file spot but no luck, What am I doing wrong?

Thanks for your help and awesome script work mate.
 

ArteGordon

Wanderer
Kurrgan said:
Okay maybe I missed something but I saw you added .map importing support. I have tried several different locations for my .map files but I just can't get it to load one. Can you walk me through it real quick. I have all my .map files in a subfolder inside the RunUO folder. So it would be like RunUO 1.0 RCOi\map files\Ilshenar\AncientLair.map I tried placing that in the config file spot but no luck, What am I doing wrong?

Thanks for your help and awesome script work mate.

the default location is just the main RunUO installation directory. So if you did an

[xmlimportmap ancientlair.map

it would look for it in RunUO 1.0 RCOi\ancientlair.map

In your case you would load it as

[xmlimportmap "map files\Ilshenar\AncientLair.map"

Note, that you can also specify a subdirectory, in which case all of the .map files below that point will be loaded - helpful if you have a bunch of them and you dont want to import each one by hand.

Like this

[xmlimportmap "map files\Ilshenar"

would import all of the .map files within your Ilshenar directory as well as any directores below that (it does a recursive search).
 

Kurrgan

Wanderer
Awesome. i was going about it entirely the wrong way :) Thanks again.

is there a way to set these heavy light and such the way you do with the xml ones?
 

ArteGordon

Wanderer
Kurrgan said:
Awesome. i was going about it entirely the wrong way :) Thanks again.

is there a way to set these heavy light and such the way you do with the xml ones?
I'm not exactly sure what the question is, but once you import the files you can adjust things such as min/maxdelay on the spawners (if that's what you meant by the light and heavy spawns) just as you would if you had loaded them as .xml spawn files.

If you were thinking of modifying the names of the spawners after importing, when you import the files, it automatically names the spawners after the file and path used to import it, and the entry number in the .map file. So, for example, in your case, after importing your .map file you would have spawners named

map files\Ilshenar\AncientLair.map#1
map files\Ilshenar\AncientLair.map#2

etc.

After importing, you could save the spawners back out to an .xml file just by using that name as a filter.
For example

[xmlsave ancientlair.xml "map files\Ilshenar\AncientLair.map"

would save all of the imported spawners back out to the .xml file named ancientlair.xml
Note, the "map files\Ilshenar\AncientLair.map" is just a name filter that selects all the spawners that have names beginning with that string.

Once you have them in .xml form it is easy to edit the names or any of the other data fields in the .xml file
 
Top