Trying to make a bonus resource subject to region
Code:
  if (Core.ML)
            {
                oreAndStone.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource( 0, 99.2, null, null ),    //Nothing
                    new BonusHarvestResource( 100, .1, 1072562, typeof( BlueDiamond ) ),
                    new BonusHarvestResource( 100, .1, 1072567, typeof( DarkSapphire ) ),
                    new BonusHarvestResource( 100, .1, 1072570, typeof( EcruCitrine ) ),
                    new BonusHarvestResource( 100, .1, 1072564, typeof( FireRuby ) ),
                    new BonusHarvestResource( 100, .1, 1072566, typeof( PerfectEmerald ) ),
                    new BonusHarvestResource( 100, .1, 1072568, typeof( Turquoise ) ),
                    new BonusHarvestResource( 100, .1, 1077180, typeof( RandomBlackRock ) ),//You uncover a small piece of blackrock!
                   //new BonusHarvestResource(100, .1, 1077181, typeof(RandomBlackRockLarge)),//You unearth a large piece of blackrock!
                };
                if (OreAndStoneMap == Server.Map.TerMur)
                {
                    new BonusHarvestResource(100, .1, 1113799, typeof(CrystallineBlackrock));
                }
                else
                    new BonusHarvestResource(100, .1, 1077180, typeof(RandomBlackRock));
                if (Region.IsPartOf(typeof(Regions.BlackrockRegion)))     //this section throws error
                  {
                      new BonusHarvestResource(100, .1, 1077181, typeof(RandomBlackRockLarge));
                  }
                else
                      new BonusHarvestResource(100, .1, 1077180, typeof(RandomBlackRock));
            
                oreAndStone.RaceBonus = Core.ML;
                oreAndStone.RandomizeVeins = Core.ML;
                Definitions.Add(oreAndStone);
            #endregion
Errors:
+ Services/Harvest/Mining.cs:
CS0120: Line 136: An object reference is required for the non-static field,
method, or property 'Server.Region.IsPartOf(System.Type)'
 
Replied on RunUO too.. but maybe post your BlackrockRegion script?
My skillcheck.cs reads the region fine but including it in harvest scripts is problematic,
I tried to make an oreandstoneRegion in mining.cs but it crashes server when d-click on mining tools.
Code:
using System;
using System.Xml;
using Server;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.Third;
using Server.Spells.Fourth;
using Server.Spells.Fifth;
using Server.Spells.Sixth;
using Server.Spells.Seventh;
using Server.Spells.Eighth;
using Server.Spells.Chivalry;
using Server.SkillHandlers;
 
 
namespace Server.Regions
{
	public class BlackrockRegion : BaseRegion
	{
        public BlackrockRegion(XmlElement xml, Map map, Region parent)
            : base(xml, map, parent)
		{
		}
 
                                  public override void OnEnter(Mobile m)
                                  {
 
                                      m.SendLocalizedMessage(1077179); // You are infused with the intense energy of this area.
                                      Effects.PlaySound(m.Location, m.Map, 0x0F7);
                                      // new BuffInfo(BuffIcon.ArcaneEmpowerment, 1078511);
                      
                                              base.OnEnter(m);
                                    }
 
                                    public override void OnExit(Mobile m)
                                    {
 
                                        //m.SendMessage("The intense energy dissipates.");
                                        Effects.PlaySound(m.Location, m.Map, 0x0FB);
                                        //m.Remove(BuffInfo);
                                              base.OnExit(m);
 
                                  }
                                
	                public override bool AllowHousing( Mobile from, Point3D p )
	                {
		            if ( from.AccessLevel == AccessLevel.Player )
		                      return false;
		              else
			                return base.AllowHousing( from, p );
		 }
                                                                    
		public override bool OnBeginSpellCast( Mobile m, ISpell s )		{
            if ((s is RecallSpell || s is MarkSpell || s is GateTravelSpell || s is SacredJourneySpell) && m.AccessLevel == AccessLevel.Player)
			{				m.SendMessage( "You can cast that spell here." );
				return true;
			}
			else
			{
				return base.OnBeginSpellCast( m, s );
			}
		}
        }
}
 
Last edited:
just a thought, maybe do a test by setting the region to another existing region, any small region that is well established.

I have a similar system, if its not too old, I can compare notes with it.
 
Oh wait, you are calling the region area, but you have no reference to what needs to be called from.

so you need something like.. (from.Region.IsPartOf(typeof(Regions.BlackrockRegion)))

Or whatever the object reference to the PlayerMobile would be, in that mining method.
 
It says region isn't defined in harvestdefinition.cs so I try this and...

add references using Server.Regions
When I define region in the mining.cs it crashes server when I d-click a shovel or pickaxe

such as ~ Public Region OreandStoneRegion;

Then in bonus harvest
If OreandStoneRegion ==


It uses
Code:
if (OreAndStoneMap == Server.Map.TerMur)
 
 
{
 
 
new BonusHarvestResource(100, .1, 1113799, typeof(CrystallineBlackrock));
 
 
}
 
 
else
 
 
new BonusHarvestResource(100, .1, 1077180, typeof(Turquoise));
 
Last edited:
Back