ExX
Member
So I made a teleport that only allows you to use it if you don't have a custom account tag. Been working on it for hours since I am so new, and I got it to compile. I was testing out the different parts I put into it. Like only allowing players on it. So I spawned a dog next to it so try and get the dog to enter it and the server crashed when he moved over it.
This is the debug crash report.
This is the script I made. (feel free to point out any other flaws I may have messed up. I've learned so much the last month but still very new. lol)
This is the debug crash report.
Code:
Server Crash Report
===================
JustUO Version 2.0, Build 5.0
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.34014
Time: 6/5/2015 12:18:14 AM
Mobiles: 2115
Items: 97338
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.ZeldaTeleporter.OnMoveOver(Mobile m) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Custom\Items\Zelda Teleport.cs:line 25
at Server.Mobile.Move(Direction d) in c:\Users\Forest\Desktop\trunk\Server\Mobile.cs:line 3268
at Server.Mobiles.BaseAI.DoMoveImpl(Direction d) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 2259
at Server.Mobiles.BaseAI.DoMove(Direction d, Boolean badStateOk) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 2217
at Server.Mobiles.BaseAI.DoMove(Direction d) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 2212
at Server.Mobiles.BaseAI.WalkRandom(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 2090
at Server.Mobiles.BaseAI.WalkRandomInHome(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps) in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 2437
at Server.Mobiles.BaseAI.DoActionWander() in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 980
at Server.Mobiles.AnimalAI.DoActionWander() in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\AnimalAI.cs:line 59
at Server.Mobiles.BaseAI.Think() in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 864
at Server.Mobiles.BaseAI.AITimer.OnTick() in c:\Users\Forest\Desktop\Ultima Online\Scripts\Mobiles\AI\BaseAI.cs:line 3095
at Server.Timer.Slice() in c:\Users\Forest\Desktop\trunk\Server\Timer.cs:line 401
at Server.Core.Main(String[] args) in c:\Users\Forest\Desktop\trunk\Server\Main.cs:line 638
This is the script I made. (feel free to point out any other flaws I may have messed up. I've learned so much the last month but still very new. lol)
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Accounting;
namespace Server.Items
{
public class ZeldaTeleporter : Item
{
[Constructable]
public ZeldaTeleporter() : base(0x1BC3)
{
Name = "Newbie Dungeon Teleporter";
Movable = false;
Visible = false;
}
public override bool OnMoveOver(Mobile m)
{
Account acct = (Account)m.Account;
bool ZeldaQuestStarter = Convert.ToBoolean(acct.GetTag("ZeldaQuestComplete"));
if (m.Player)
{
if (m.Holding != null)
{
m.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object.
return true;
}
else if (!ZeldaQuestStarter && m.Player)
{
m.Location = new Point3D( 6132, 1315, 15 );
m.Map = Map.Trammel;
m.PlaySound (510);
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
return true;
}
else
{
m.SendMessage( "You have done all you can do in the Newbie Dungeon. You are no longer allowed to access it on this account." );
return true;
}
}
return true;
}
public ZeldaTeleporter( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}