public override bool Init()
{
// Load first, to get race, location, etc.
this.Load();
if (this.NPC == null)
{
Log.Error("{0}: No race set.", this.GetType().Name);
return false;
}
this.NPC.ScriptType = this.GetType();
if (this.NPC.RegionId > 0)
{
var region = ChannelServer.Instance.World.GetRegion(this.NPC.RegionId);
if (region == null)
{
Log.Error("Failed to spawn '{0}', region '{1}' not found.", this.GetType().Name, this.NPC.RegionId);
return false;
}
// Add creature to region, unless the script already did it
// for some reason.
if (!region.CreatureExists(this.NPC.EntityId))
region.AddCreature(this.NPC);
}
this.NPC.SpawnLocation = new Location(this.NPC.RegionId, this.NPC.GetPosition());
return true;
}