|
||
|
|
#1 (permalink) |
|
Forum Novice
Join Date: Jul 2004
Age: 22
Posts: 216
|
Firstly to do this you will need to know how to define your own regions. I recommend using the tool Region Editor found on the Pandora's Box website to get an accurate region.
Then using this nice FAQ you can define your new region. Once you have your new region set up and ready, you must override the method which handels people entering it. Here: Code:
public override bool OnMoveInto( Mobile from, Direction d, Point3D newLocation, Point3D oldLocation ) Code:
Guild g = from.Guild as Guild; Code:
if (from.AccessLevel > AccessLevel.Player)// This is so staff can still enter
{
return true;
}
if (from.Player == false) //So npcs and other monsters such as pets can move around
{
return true; //Change this to false if you don't want NPC's running around
}
else if ( g == null || g.Type != GuildType.Chaos) //This is the bit where the actual
{ //check on the guild is made
from.SendLocalizedMessage( 501284 ); // You may not enter.
return false;
}
return true; //Everything else has been accounted for so this returns true for chaos folk.
Code:
using System; using Server; using Server.Items; using Server.Multis; using Server.Mobiles; using Server.Spells; using Server.Spells.Seventh; using Server.Spells.Fourth; using Server.Spells.Sixth; using Server.Guilds; Code:
using System;
using Server;
using Server.Items;
using Server.Multis;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.Seventh;
using Server.Spells.Fourth;
using Server.Spells.Sixth;
using Server.Guilds;
namespace Server.Regions
{
public class Chaos : Region
{
public static void Initialize()
{
Region.AddRegion( new Chaos( Map.Ilshenar ) );
}
public Chaos( Map map ) : base( "", "Chaos", map )
{
}
public override bool AllowHousing( Mobile from, Point3D p )
{
if ( from.AccessLevel == AccessLevel.Player )
return false;
else
return true;
}
public override TimeSpan GetLogoutDelay( Mobile m )
{
return TimeSpan.Zero;
}
public override bool OnBeginSpellCast( Mobile from, ISpell s )
{
if ( from.AccessLevel == AccessLevel.Player )
from.SendLocalizedMessage( 502629 ); // You cannot cast spells here.
return ( from.AccessLevel > AccessLevel.Player );
}
public override bool OnCombatantChange( Mobile from, Mobile Old, Mobile New )
{
return ( from.AccessLevel > AccessLevel.Player );
}
public override bool OnMoveInto( Mobile from, Direction d, Point3D newLocation, Point3D oldLocation )
{
Guild g = from.Guild as Guild;
if (from.AccessLevel > AccessLevel.Player)// This is so staff can still enter
{
return true;
}
if (from.Player == false) //So npcs and other monsters such as pets can move around
{
return true; //Change this to false if you don't want NPC's running around
}
else if ( g == null || g.Type != GuildType.Chaos) //This is the bit where the actual
{ //check on the guild is made
from.SendLocalizedMessage( 501284 ); // You may not enter.
return false;
}
return true; //Everything else has been accounted for so this returns true for chaos folk.
}
public override void OnEnter( Mobile m )
{
m.SendMessage("You have entered the Chaos Domain");
}
public override void OnExit( Mobile m )
{
m.SendMessage("You have left the Chaos Domain");
}
}
}
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|