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!

Factions On All Maps Mod

KoNNaN

Knight
Google cache to the rescue. Had to manually fix most of the formatting so if I missed something let me know.

-*Factions On All Maps Mod*-

I've seen many people ask why simply setting the map in Factions.cs to Map.Felucca || Map.Whatever doesn't work. I thought that everyone could use this tutorial,
as that is the completely wrong direction to getting them to work.

Description
This mod of mine will allow your faction players to do battle on any map, no matter if it is Felucca rulesets or not!
This mod also alows faction players to recieve silver on the other maps.

Why Would I Want This?
Well, you ever notice that shards that have trammy facets, limit pvp to just Felucca or whichever maps are set to Fel Rulesets? Now all of your PvPers and PvMers can live in harmony, no matter what rulesets you use on any map.

Installation
You will have to do each edit manually, as it is done in multiple core files...sorry to be such a pain, but I stray from plug and play systems if they use core edits.

Step 1
Scripts/Misc/Notoriety.cs

Inside
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target )

Change
Code:
if( (!Core.ML || map == Faction.Facet) && targetFaction != null )
to

Code:
if( targetFaction != null )
Inside
public static int CorpseNotoriety( Mobile source, Corpse target )

Change
Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
to

Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction )

Change
Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
to

Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction )
Inside
public static int MobileNotoriety( Mobile source, Mobile target )

Change
Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
to

Code:
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction )
[B]Inside[/B]
public static bool Mobile_AllowHarmful( Mobile from, Mobile target )

Find
Code:
Guild fromGuild = GetGuildFor( from.Guild as Guild, from );
ADD MY CODE ABOVE THIS
Code:
//Allow factions to fight anywhere mod by Tresdni
            Faction srcFaction = Faction.Find( from, true, true );
            Faction trgFaction = Faction.Find( target, true, true );
 
            if( srcFaction != null && trgFaction != null && srcFaction != trgFaction )
                return true;
//end allow factions to fight anywhere mod by Tresdni
Step 2 (Lets get the faction names to show up above our names on any map)

Scripts/Mobiles/PlayerMobile.cs

Inside
protected override void OnMapChange(Map oldMap)

Change
Code:
if ((Map != Faction.Facet && oldMap == Faction.Facet) || (Map == Faction.Facet && oldMap != Faction.Facet))
                InvalidateProperties();
to

Code:
//if ((Map != Faction.Facet && oldMap == Faction.Facet) || (Map == Faction.Facet && oldMap != Faction.Facet))//Commented out to always InvalidateProperties on map change.
                InvalidateProperties();
Inside
public override void GetProperties(ObjectPropertyList list)

Change
Code:
if (Map == Faction.Facet)
            {
                PlayerState pl = PlayerState.Find(this);
 
                if (pl != null)
                {
                    Faction faction = pl.Faction;
 
                    if (faction.Commander == this)
                        list.Add(1042733, faction.Definition.PropName); // Commanding Lord of the ~1_FACTION_NAME~
                    else if (pl.Sheriff != null)
                        list.Add(1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName); // The Sheriff of  ~1_CITY~, ~2_FACTION_NAME~
                    else if (pl.Finance != null)
                        list.Add(1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~
                    else if (pl.MerchantTitle != MerchantTitle.None)
                        list.Add(1060776, "{0}\t{1}", MerchantTitles.GetInfo(pl.MerchantTitle).Title, faction.Definition.PropName); // ~1_val~, ~2_val~
                    else
                        list.Add(1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName); // ~1_val~, ~2_val~
                }
            }
to

Code:
//if (Map == Faction.Facet)
            //{
                PlayerState pl = PlayerState.Find(this);
 
                if (pl != null)
                {
                    Faction faction = pl.Faction;
 
                    if (faction.Commander == this)
                        list.Add(1042733, faction.Definition.PropName); // Commanding Lord of the ~1_FACTION_NAME~
                    else if (pl.Sheriff != null)
                        list.Add(1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName); // The Sheriff of  ~1_CITY~, ~2_FACTION_NAME~
                    else if (pl.Finance != null)
                        list.Add(1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~
                    else if (pl.MerchantTitle != MerchantTitle.None)
                        list.Add(1060776, "{0}\t{1}", MerchantTitles.GetInfo(pl.MerchantTitle).Title, faction.Definition.PropName); // ~1_val~, ~2_val~
                    else
                        list.Add(1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName); // ~1_val~, ~2_val~
                }
            //}        //Just commenting out the first if statement, it should always run now.
[B]Inside[/B]
public override void OnSingleClick(Mobile from)

Change
Code:
if (Map == Faction.Facet)
            {
                PlayerState pl = PlayerState.Find(this);
 
                if (pl != null)
                {
                    string text;
                    bool ascii = false;
 
                    Faction faction = pl.Faction;
 
                    if (faction.Commander == this)
                        text = String.Concat(this.Female ? "(Commanding Lady of the " : "(Commanding Lord of the ", faction.Definition.FriendlyName, ")");
                    else if (pl.Sheriff != null)
                        text = String.Concat("(The Sheriff of ", pl.Sheriff.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")");
                    else if (pl.Finance != null)
                        text = String.Concat("(The Finance Minister of ", pl.Finance.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")");
                    else
                    {
                        ascii = true;
 
                        if (pl.MerchantTitle != MerchantTitle.None)
                            text = String.Concat("(", MerchantTitles.GetInfo(pl.MerchantTitle).Title.String, ", ", faction.Definition.FriendlyName, ")");
                        else
                            text = String.Concat("(", pl.Rank.Title.String, ", ", faction.Definition.FriendlyName, ")");
                    }
 
                    int hue = (Faction.Find(from) == faction ? 98 : 38);
 
                    PrivateOverheadMessage(MessageType.Label, hue, ascii, text, from.NetState);
                }
            }
to

Code:
//if (Map == Faction.Facet)
            //{
                PlayerState pl = PlayerState.Find(this);
 
                if (pl != null)
                {
                    string text;
                    bool ascii = false;
 
                    Faction faction = pl.Faction;
 
                    if (faction.Commander == this)
                        text = String.Concat(this.Female ? "(Commanding Lady of the " : "(Commanding Lord of the ", faction.Definition.FriendlyName, ")");
                    else if (pl.Sheriff != null)
                        text = String.Concat("(The Sheriff of ", pl.Sheriff.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")");
                    else if (pl.Finance != null)
                        text = String.Concat("(The Finance Minister of ", pl.Finance.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")");
                    else
                    {
                        ascii = true;
 
                        if (pl.MerchantTitle != MerchantTitle.None)
                            text = String.Concat("(", MerchantTitles.GetInfo(pl.MerchantTitle).Title.String, ", ", faction.Definition.FriendlyName, ")");
                        else
                            text = String.Concat("(", pl.Rank.Title.String, ", ", faction.Definition.FriendlyName, ")");
                    }
 
                    int hue = (Faction.Find(from) == faction ? 98 : 38);
 
                    PrivateOverheadMessage(MessageType.Label, hue, ascii, text, from.NetState);
                }
            //}//Again, just commenting out the first if statement, it should always run, no matter the map.
[B]Inside[/B]
public override string ApplyNameSuffix(string suffix)

Change
Code:
if (Core.ML && this.Map == Faction.Facet)
to

Code:
if (Core.ML)

Step 3 (Optional, but allows faction players to get silver from creature kills on all maps.)
Scripts/Engines/Factions/Faction.cs

Inside
public static void HandleDeath( Mobile victim, Mobile killer )

Change
Code:
if ( bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction )
to

Code:
if ( victimFaction != null && killerState.Faction != victimFaction )
Change
Code:
if ( bc.Map == Faction.Facet && bc.GetEthicAllegiance( killer ) == BaseCreature.Allegiance.Enemy )
to

Code:
if ( bc.GetEthicAllegiance( killer ) == BaseCreature.Allegiance.Enemy )

...And wala! You're finished! Your factioners now can attack on any map, earn silver on any map, and their faction titles will always show in their name

I know this guide is kind of long and drawn out, but it produces what oh so many members here have asked for. I hope you guys enjoy this mod, I almost pulled every tooth making it.

P.S. - If my formatting is bad on the forum, I will try to clean it up afterwards - that was a lot of writing!
 

KISOR

Sorceror
Are you getting any errors or is it just not working?
EDIT: just looked at mine & noticed i most of had trouble with it too cause i only got step one working factions can fight anywhere for me but there faction title only shows up in fel
 
Top