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!

Creating a new Region.

P

php-junkie

Guest
Creating a new Region.

I've created a new region for people to duel in. I've made it so when people enter the region they turn Criminal. I set up a timer to check their criminal setting to make sure they are grey while in the region.
What I need help with is finding a different way to do this, because the timer is hardly the way of doing it even though it works. Can anyone give a few suggestions on different ways I might be able to do this?

Here is my script.[code:1]using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.Third;
using Server.Spells.Seventh;
using Server.Spells.Fourth;
using Server.Spells.Sixth;
using Server.Spells.Eighth;
using Server.Spells.Fifth;

namespace Server.Regions
{
public class WarRegion : Region
{
private TourneyHallTimer m_Timer;
private Mobile m_Mobile;

public static void Initialize()
{
Region.AddRegion( new WarRegion( "Tourney Hall" ) );
}

public WarRegion( string name ) : base( "", name, Map.Felucca )
{
LoadFromXml = false;

this.Coords = new ArrayList( 0 );
this.Coords.Add( new Rectangle2D( 6014, 390, 6135, 507 ) );
}

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

public override void OnEnter( Mobile m )
{
base.OnEnter( m );
m_Timer = new TourneyHallTimer( m );
m_Timer.Start();
}

public override void OnExit( Mobile m )
{
base.OnExit( m );
m_Mobile = m;
m_Timer.Stop();
if ( m_Mobile.Criminal == true )
m_Mobile.Criminal = false;
}

public override double LightLevel( Mobile m, double level )
{
return LightCycle.WarLevel;
}

public override bool OnBeginSpellCast( Mobile m, ISpell s )
{
if ( m.AccessLevel == AccessLevel.Player &&
( s is MarkSpell || s is RecallSpell || s is GateTravelSpell || s is PolymorphSpell ||
s is SummonDaemonSpell || s is AirElementalSpell || s is EarthElementalSpell || s is EnergyVortexSpell ||
s is FireElementalSpell || s is WaterElementalSpell || s is BladeSpiritsSpell || s is SummonCreatureSpell ||
s is ParalyzeFieldSpell || s is EnergyFieldSpell ) )
{
m.SendMessage( "That spell is not allowed in this area." );
return false;
}
else
{
return base.OnBeginSpellCast( m, s );
}
}

private class TourneyHallTimer : Timer
{
private Mobile m_From;

public TourneyHallTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.1 ), TimeSpan.FromSeconds( 0.1 ) )
{
Priority = TimerPriority.TwoFiftyMS;

m_From = from;
}

protected override void OnTick()
{
if ( m_From.Criminal == false )
m_From.Criminal = true;
}
}
}
}[/code:1]
 
S

Sno

Guest
I think you'll need to edit MobileNotoriety in Misc\Notoriety.cs, check if the player is in the specified region and return the appropriate value.
 
Top