Will need to add these references to the top of your region script of course.public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
{
global = LightCycle.NightLevel;
personal = 1; //Adjust Light Level [Darkest = 0]
}
public override bool OnBeginSpellCast(Mobile m, ISpell s)
{
if ((s is NightSightSpell) && m.AccessLevel == AccessLevel.Player)
{
m.SendMessage("That spell does not seem to work in this place.");
return false;
}
using Server.Mobiles;
using Server.Spells;
using Server.Spells.First;
The first snippet of code (in green) is what you include in your newly created region file to control the desired light level. The 2nd portion (in orange) is an example of how to restrict the use of the nightsight spell if you choose. There are already region files within the server scripts folder you can use for structure, however, you will also need to define your new region bounds [X, Y, Z] in data\Regions.xml under the correct Facet.I want to change the light level of a region, what you posted is nightsight spell isnt it?
using Server;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.First;
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 CemetaryRegion : BaseRegion
{
public CemetaryRegion(XmlElement xml, Map map, Region parent)
: base(xml, map, parent)
{
}
public override void OnEnter(Mobile m)
{
m.SendMessage("You enter the cemetary.");
//m.SendLocalizedMessage(1077179); // You are infused with the intense energy of this area.
//Effects.PlaySound(m.Location, m.Map, 0x0F7);
base.OnEnter(m);
}
public override void OnExit(Mobile m)
{
m.SendMessage("You exit the cemetary.");
//m.SendMessage("The intense energy dissipates.");
//Effects.PlaySound(m.Location, m.Map, 0x0F8);
base.OnExit(m);
}
public override bool AllowHousing(Mobile from, Point3D p)
{
if (from.AccessLevel == AccessLevel.Player)
return false;
else
return base.AllowHousing(from, p);
}
//==Cemetary is always NightLevel...see LightCycle.cs==//
public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
{
global = LightCycle.NightLevel;
personal = 1;//Adjust Light Level [Darkest = 0]
}
public override bool OnBeginSpellCast(Mobile m, ISpell s)
{
if ((s is NightSightSpell) && m.AccessLevel == AccessLevel.Player)
{
m.SendMessage("That spell does not seem to work in this place.");
return false;
}
else
{
return base.OnBeginSpellCast(m, s);
}
/*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( "That spell does not seem to work in this place." );
return false;
}
else
{
return base.OnBeginSpellCast( m, s );
}
}*/
}
}
}
<region type="CemetaryRegion" priority="50" name="Britain Cemetary">
<rect x="1336" y="1443" width="40" height="69" />
<rect x="1374" y="1442" width="17" height="52" />
<go x="1384" y="1497" z="10" />
<music name="GoodVsEvil" />
</region>
We use essential cookies to make this site work, and optional cookies to enhance your experience.