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!

How to Create a Custom Faction

old_school

Wanderer
How to Create a Custom Faction

Ok cuple things to keep in mind when creating a faction. you need to use a place normaly not in use by regular players becase they will no longer be able to enter that area unless they join the faction. So plan carefully. Ok now lets get down to business.

Let use the the shadowlords as a basis for our new faction script so go to Scripts\Engines\Factions\Instances\Factions and just make a copy of the shadowlords.

Next open the shadowlords script up and choose edit replace all. For what type Shadowlords Replace with use test then click replace all.

Script will look like this:

Code:
using System;
using Server;

namespace Server.Factions
{
	public class test : Faction
	{
		private static Faction m_Instance;

		public static Faction Instance{ get{ return m_Instance; } }

		public test()
		{
			m_Instance = this;

			Definition =
				new FactionDefinition(
					3,
					1109, // shadow
					2211, // green
					1109, // join stone : shadow
					2211, // broadcast : green
					0x79, 0x3EB0, // war horse
					"test", "shadow",
					new TextDefinition( 1011537, "test" ),
					new TextDefinition( 1060772, "test faction" ),
					new TextDefinition( 1011424, "<center>SHADES OF DARKNESS</center>" ),
					new TextDefinition( 1011451,
						"The Shadow Lords are a faction that has sprung up within the ranks of " +
						"Minax. Comprised mostly of undead and those who would seek to be " +
						"necromancers, they pose a threat to both the sides of good and evil. " +
						"Their plans have disrupted the hold Minax has over Felucca, and their " +
						"ultimate goal is to destroy all life." ),
					new TextDefinition( 1011456, "This city is controlled by the Shadow Lords." ),
					new TextDefinition( 1042255, "This sigil has been corrupted by the test" ),
					new TextDefinition( 1041046, "The faction signup stone for the test" ),
					new TextDefinition( 1041384, "The Faction Stone of the test" ),
					new TextDefinition( 1011466, ": test" ),
					new TextDefinition( 1005184, "Minions of the test will now be ignored." ),
					new TextDefinition( 1005185, "Minions of the test will now be warned of their impending deaths." ),
					new TextDefinition( 1005186, "Minions of the test will now be attacked at will." ),
					new StrongholdDefinition(
						new Rectangle2D[]
						{
							new Rectangle2D( 960, 688, 8, 9 ),
							new Rectangle2D( 944, 697, 24, 23 )
						},
						new Point3D( 969, 768, 0 ),
						new Point3D( 947, 713, 0 ),
						new Point3D[]
						{
							new Point3D( 953, 713, 20 ),
							new Point3D( 953, 709, 20 ),
							new Point3D( 953, 705, 20 ),
							new Point3D( 953, 701, 20 ),
							new Point3D( 957, 713, 20 ),
							new Point3D( 957, 709, 20 ),
							new Point3D( 957, 705, 20 ),
							new Point3D( 957, 701, 20 )
						} ),
					new RankDefinition[]
					{
						new RankDefinition( 10, 991, 8, new TextDefinition( 1060799, "Purveyor of Darkness" ) ),
						new RankDefinition(  9, 950, 7, new TextDefinition( 1060798, "Agent of Evil" ) ),
						new RankDefinition(  8, 900, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  7, 800, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  6, 700, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  5, 600, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  4, 500, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  3, 400, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  2, 200, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  1,   0, 4, new TextDefinition( 1060795, "Servant" ) )
					},
					new GuardDefinition[]
					{
						new GuardDefinition( typeof( FactionHenchman ),		0x1403, 5000, 1000, 10,		new TextDefinition( 1011526, "HENCHMAN" ),		new TextDefinition( 1011510, "Hire Henchman" ) ),
						new GuardDefinition( typeof( FactionMercenary ),	0x0F62, 6000, 2000, 10,		new TextDefinition( 1011527, "MERCENARY" ),		new TextDefinition( 1011511, "Hire Mercenary" ) ),
						new GuardDefinition( typeof( FactionDeathKnight ),	0x0F45, 7000, 3000, 10,		new TextDefinition( 1011512, "DEATH KNIGHT" ),	new TextDefinition( 1011503, "Hire Death Knight" ) ),
						new GuardDefinition( typeof( FactionNecromancer ),	0x13F8, 8000, 4000, 10,		new TextDefinition( 1011513, "SHADOW MAGE" ),	new TextDefinition( 1011504, "Hire Shadow Mage" ) ),
					}
				);
		}
	}
}


Next

Before we go any further we need to check and see what number this faction will be. Look at this section of code toward the top

Code:
public test()
		{
			m_Instance = this;

			Definition =
				new FactionDefinition(
					3,

This Faction is the number 3 faction. Now to tell what number goes in here you need to minize and count how many faction our currently in place. Defult number of factions is 4 that will make this one be number 5 so change it to look like this:

Code:
public test()
		{
			m_Instance = this;

			Definition =
				new FactionDefinition(
					5,

So now our faction script looks like this


Code:
using System;
using Server;

namespace Server.Factions
{
	public class test : Faction
	{
		private static Faction m_Instance;

		public static Faction Instance{ get{ return m_Instance; } }

		public test()
		{
			m_Instance = this;

			Definition =
				new FactionDefinition(
					5,
					1109, // shadow
					2211, // green
					1109, // join stone : shadow
					2211, // broadcast : green
					0x79, 0x3EB0, // war horse
					"test", "shadow",
					new TextDefinition( 1011537, "test" ),
					new TextDefinition( 1060772, "test faction" ),
					new TextDefinition( 1011424, "<center>SHADES OF DARKNESS</center>" ),
					new TextDefinition( 1011451,
						"The Shadow Lords are a faction that has sprung up within the ranks of " +
						"Minax. Comprised mostly of undead and those who would seek to be " +
						"necromancers, they pose a threat to both the sides of good and evil. " +
						"Their plans have disrupted the hold Minax has over Felucca, and their " +
						"ultimate goal is to destroy all life." ),
					new TextDefinition( 1011456, "This city is controlled by the Shadow Lords." ),
					new TextDefinition( 1042255, "This sigil has been corrupted by the test" ),
					new TextDefinition( 1041046, "The faction signup stone for the test" ),
					new TextDefinition( 1041384, "The Faction Stone of the test" ),
					new TextDefinition( 1011466, ": test" ),
					new TextDefinition( 1005184, "Minions of the test will now be ignored." ),
					new TextDefinition( 1005185, "Minions of the test will now be warned of their impending deaths." ),
					new TextDefinition( 1005186, "Minions of the test will now be attacked at will." ),
					new StrongholdDefinition(
						new Rectangle2D[]
						{
							new Rectangle2D( 960, 688, 8, 9 ),
							new Rectangle2D( 944, 697, 24, 23 )
						},
						new Point3D( 969, 768, 0 ),
						new Point3D( 947, 713, 0 ),
						new Point3D[]
						{
							new Point3D( 953, 713, 20 ),
							new Point3D( 953, 709, 20 ),
							new Point3D( 953, 705, 20 ),
							new Point3D( 953, 701, 20 ),
							new Point3D( 957, 713, 20 ),
							new Point3D( 957, 709, 20 ),
							new Point3D( 957, 705, 20 ),
							new Point3D( 957, 701, 20 )
						} ),
					new RankDefinition[]
					{
						new RankDefinition( 10, 991, 8, new TextDefinition( 1060799, "Purveyor of Darkness" ) ),
						new RankDefinition(  9, 950, 7, new TextDefinition( 1060798, "Agent of Evil" ) ),
						new RankDefinition(  8, 900, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  7, 800, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  6, 700, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  5, 600, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  4, 500, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  3, 400, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  2, 200, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  1,   0, 4, new TextDefinition( 1060795, "Servant" ) )
					},
					new GuardDefinition[]
					{
						new GuardDefinition( typeof( FactionHenchman ),		0x1403, 5000, 1000, 10,		new TextDefinition( 1011526, "HENCHMAN" ),		new TextDefinition( 1011510, "Hire Henchman" ) ),
						new GuardDefinition( typeof( FactionMercenary ),	0x0F62, 6000, 2000, 10,		new TextDefinition( 1011527, "MERCENARY" ),		new TextDefinition( 1011511, "Hire Mercenary" ) ),
						new GuardDefinition( typeof( FactionDeathKnight ),	0x0F45, 7000, 3000, 10,		new TextDefinition( 1011512, "DEATH KNIGHT" ),	new TextDefinition( 1011503, "Hire Death Knight" ) ),
						new GuardDefinition( typeof( FactionNecromancer ),	0x13F8, 8000, 4000, 10,		new TextDefinition( 1011513, "SHADOW MAGE" ),	new TextDefinition( 1011504, "Hire Shadow Mage" ) ),
					}
				);
		}
	}
}

Now the fun part look at these lines of code

Code:
1109, // shadow
					2211, // green
					1109, // join stone : shadow
					2211, // broadcast : green
					0x79, 0x3EB0, // war horse

You can edit these values to what ever u want

You can edit these as well
Code:
"test", "shadow",
					new TextDefinition( 1011537, "test" ),
					new TextDefinition( 1060772, "test faction" ),
					new TextDefinition( 1011424, "<center>SHADES OF DARKNESS</center>" ),
					new TextDefinition( 1011451,
						"The Shadow Lords are a faction that has sprung up within the ranks of " +
						"Minax. Comprised mostly of undead and those who would seek to be " +
						"necromancers, they pose a threat to both the sides of good and evil. " +
						"Their plans have disrupted the hold Minax has over Felucca, and their " +
						"ultimate goal is to destroy all life." ),
					new TextDefinition( 1011456, "This city is controlled by the Shadow Lords." ),
					new TextDefinition( 1042255, "This sigil has been corrupted by the test" ),
					new TextDefinition( 1041046, "The faction signup stone for the test" ),
					new TextDefinition( 1041384, "The Faction Stone of the test" ),
					new TextDefinition( 1011466, ": test" ),
					new TextDefinition( 1005184, "Minions of the test will now be ignored." ),
					new TextDefinition( 1005185, "Minions of the test will now be warned of their impending deaths." ),
					new TextDefinition( 1005186, "Minions of the test will now be attacked at will." ),
					new StrongholdDefinition(


Now comes a semi hard part setting up were u want the factions strong hold or fort. To do this find a area u want type the [where command then go to other side repeat so it would be a invisable rectangle if u were to draw it out on paper

Code:
new Rectangle2D[]
						{
							new Rectangle2D( 960, 688, 8, 9 ),
							new Rectangle2D( 944, 697, 24, 23 )
						},
						new Point3D( 969, 768, 0 ),
						new Point3D( 947, 713, 0 ),
						new Point3D[]
						{
							new Point3D( 953, 713, 20 ),
							new Point3D( 953, 709, 20 ),
							new Point3D( 953, 705, 20 ),
							new Point3D( 953, 701, 20 ),
							new Point3D( 957, 713, 20 ),
							new Point3D( 957, 709, 20 ),
							new Point3D( 957, 705, 20 ),
							new Point3D( 957, 701, 20 )
						} ),

this is the section were u define the strong holds cornates the 2d's our easy and the 3d's fairly easy as well. Set those up then move on down the script.


Code:
					new RankDefinition[]
					{
						new RankDefinition( 10, 991, 8, new TextDefinition( 1060799, "Purveyor of Darkness" ) ),
						new RankDefinition(  9, 950, 7, new TextDefinition( 1060798, "Agent of Evil" ) ),
						new RankDefinition(  8, 900, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  7, 800, 6, new TextDefinition( 1060797, "Bringer of Sorrow" ) ),
						new RankDefinition(  6, 700, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  5, 600, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  4, 500, 5, new TextDefinition( 1060796, "Keeper of Lies" ) ),
						new RankDefinition(  3, 400, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  2, 200, 4, new TextDefinition( 1060795, "Servant" ) ),
						new RankDefinition(  1,   0, 4, new TextDefinition( 1060795, "Servant" ) )
					},

This is were u set the ranks of the faction. I kept mine defult cause this is just a exsample. Anyway there u go. the guard ones I dont even care to edit but u could if u wanted to.


Moving on to Scripts\Engines\Factions\Core open the factin script. Add your factions name in there. I did not include the entire script cause its huge and not important. Look down u will see were to add it.

Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Guilds;
using Server.Mobiles;
using Server.Prompts;
using Server.Targeting;
using Server.Accounting;
using Server.Commands;
using Server.Commands.Generic;

namespace Server.Factions
{
	[CustomEnum( new string[]{ "Minax", "Council of Mages", "True Britannians", "Shadowlords", "test" } )]
	public abstract class Faction : IComparable
	{
		private FactionDefinition m_Definition;
		private FactionState m_State;
		private StrongholdRegion m_StrongholdRegion;

		public StrongholdRegion StrongholdRegion
		{
			get{ return m_StrongholdRegion; }
			set{ m_StrongholdRegion = value; }
		}

		public FactionDefinition Definition
		{
			get{ return m_Definition; }
			set
			{
				m_Definition = value;
				m_StrongholdRegion = new StrongholdRegion( this );
			}
		}

		public FactionState State
		{
			get{ return m_State; }
			set{ m_State = value; }
		}



Now if u go to Scripts\Engines\Factions\Instances\Towns Kinda back were we started u need to copy and paste a towns script Ill use brits. then change brits name to test so my script looks like this


Code:
using System;

namespace Server.Factions
{
	public class Test : Town
	{
		public Test()
		{
			Definition =
				new TownDefinition(
					0,
					0x1869,
					"Britain",
					"Britain",
					new TextDefinition( 1011433, "BRITAIN" ),
					new TextDefinition( 1011561, "TOWN STONE FOR BRITAIN" ),
					new TextDefinition( 1041034, "The Faction Sigil Monolith of Angry farmer" ),
					new TextDefinition( 1041404, "The Faction Town Sigil Monolith of test" ),
					new TextDefinition( 1041413, "Faction Town Stone of test" ),
					new TextDefinition( 1041395, "Faction Town Sigil of test" ),
					new TextDefinition( 1041386, "Corrupted Faction Town Sigil of test" ),
					new Point3D( 1521, 1507, 0 ),
					new Point3D( 1525, 1425, 55 ) );
		}
	}
}

You might want to change the point 3d values to your factions but im not going to for this exsample. But u will want to.


Thats pretty much it. restart your server log in and type [generatefactions. Then go to your factiong dtrong hold [add joinstone then props it set it to your faction boom your done. Players can now join your new faction. I hope this helps there did not seem to be a how to make a faction sticky so I had to learn the hard way.
 

Legate

Wanderer
Defult number of factions is 4 that will make this one be number 5

The numbering actually starts with 0 (as all arrays do) - so the new faction would actually be 4, not 5.
 
Top