ServUO Version
Publish Unknown
Ultima Expansion
None
Lets say i want change the light level of northem territory to the darkest one how can i do it?

Theres no reference of light @regions.xml

thanks!


i have custom regions in a box but i want to do it without using the script
 
Last edited:
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;
}
Will need to add these references to the top of your region script of course.
using Server.Mobiles;
using Server.Spells;
using Server.Spells.First;
 
Last edited:
I want to change the light level of a region, what you posted is nightsight spell isnt it?
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.

Example of a Region File
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 );
}
}*/
}
}
}

How to define a Region:
UO Region.jpg

Defined Region (data\Regions.xml)
<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>
 
Last edited:
ahhh i see now i understand ok thanks, i forgo to say that im using Runuo 2.2 so this line


C#:
public CemetaryRegion(XmlElement xml, Map map, Region parent)
: base(xml, map, parent)
{
}
is going to throw some errors i guess, i ll try when i get home thanks
 
Back