Merix

Initiate
Hi,

I'm trying to make a custom region where every people see orange (can be attack) but is the player are n the same guild, the notoriety is green (ally).

I have some problems to understand the notoriety system.

Thanks
 
C:\RUNUO\Data\Locations
find
Region.xml
add lane
Code:
-<region name="Britain Pit" priority="50" type="CUSTOMREGIONMERIX">
<rune name="custom region merix"/>
<rect height="11" width="21" y="1651" x="1467"/>
<go y="1656" x="1490" z="10"/>
<music name="GrizzleDungeon"/>
<guards disabled="true"/>
</region>

find
C:\RUNUO\Scripts\Regions
create new region ( new.cs ) name CUSTOMREGIONMERIX.cs
open it

add lane
Code:
using System;
using System.Xml;
using Server;
using Server.Mobiles;
using System.Collections;
using System.Collections.Generic;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Multis;
using Server.Engines.Help;
using Server.Engines.ConPVP;
using Server.ContextMenus;
using Server.Network;
using Server.Spells;
using Server.Spells.Fifth;
using Server.Spells.Seventh;
using Server.Targeting;
using Server.Engines.Quests;
using Server.Factions;
using Server.Regions;
using Server.Accounting;
using Server.Engines.CannedEvil;
using Server.Engines.Craft;
using Server.Spells.Spellweaving;
using Server.Engines.PartySystem;

namespace Server.Regions
{
	public class CUSTOMREGIONMERIX: BaseRegion
	{
		public CUSTOMREGIONMERIX( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
		{
		}

		public override bool AllowHousing( Mobile from, Point3D p )
		{
		return false;
		}
blablabla...

save
find
C:\RUNUO\\Scripts\Misc
Open Notoriety.cs

Code:
public static int MobileNotoriety( Mobile source, Mobile target )
		{
			if( Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier) )
				return Notoriety.Invulnerable;

			if( target.AccessLevel > AccessLevel.Player )
				return Notoriety.CanBeAttacked;

			if( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature )
			{
				BaseCreature bc = (BaseCreature)target;

				Mobile master = bc.GetMaster();

				if ( master != null && master.AccessLevel > AccessLevel.Player )
					return Notoriety.CanBeAttacked;

				master = bc.ControlMaster;

				if ( Core.ML && master != null )
				{
					if ( ( source == master && CheckAggressor( target.Aggressors, source ) ) || ( CheckAggressor( source.Aggressors, bc ) ) )
						return Notoriety.CanBeAttacked;
					else
						return MobileNotoriety( source, master );
				}

				if( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() )
					return Notoriety.Enemy;
			}

			if ( target.Kills >= 5 || ( target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !( target is BaseFamiliar ) && !( target is ArcaneFey ) && !( target is Golem ) ) || ( target is BaseCreature && ( ( (BaseCreature)target ).AlwaysMurderer || ( (BaseCreature)target ).IsAnimatedDead ) ) )
			return Notoriety.Murderer;
			
			if( source.Player && source is PlayerMobile && (((PlayerMobile)source).Region is CUSTOMREGIONMERIX))
			return Notoriety.Enemy; // HERE YOUR REGION CODE TO ADD ***********************************************************

	        if ( target.Criminal )
		    return Notoriety.Criminal;

			Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
			Guild targetGuild = GetGuildFor( target.Guild as Guild, target );

			if( sourceGuild != null && targetGuild != null )
			{
				if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
					return Notoriety.Ally;
				else if( sourceGuild.IsEnemy( targetGuild ) )
					return Notoriety.Enemy;
			}

			Faction srcFaction = Faction.Find( source, true, true );
			Faction trgFaction = Faction.Find( target, true, true );

			if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
				return Notoriety.Enemy;

			if( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) )
				return Notoriety.CanBeAttacked;

			if( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable )
				return Notoriety.CanBeAttacked;

			if( CheckHouseFlag( source, target, target.Location, target.Map ) )
				return Notoriety.CanBeAttacked;

			if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )   //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
			{
				if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) )
					return Notoriety.CanBeAttacked;
			}

			if( CheckAggressor( source.Aggressors, target ) )
				return Notoriety.CanBeAttacked;

			if( CheckAggressed( source.Aggressed, target ) )
				return Notoriety.CanBeAttacked;

			if( target is BaseCreature )
			{
				BaseCreature bc = (BaseCreature)target;

				if( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
					return Notoriety.CanBeAttacked;
			}

			if( source is BaseCreature )
			{
				BaseCreature bc = (BaseCreature)source;

				Mobile master = bc.GetMaster();
				if( master != null )
					if( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked )
						return Notoriety.CanBeAttacked;
			}

			return Notoriety.Innocent;
		}
 
Last edited:
Hi @spawndef. Thanks for trying to help out with this. Would you mind adding code tags to your post?

It's very hard to differentiate the code from your instructions, especially for anyone reading this that might be less fluent in C# and coding in general.

Thanks!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back