john burns

Citizen
ServUO Version
Publish 58
Ultima Expansion
Endless Journey
Watching an old 80s cartoon called "Dungeons and Dragons", I seen a chest on an episode that would allow people to travel to different locations and worlds. So I thought how wonderful and dangerous for the players if there was a chest that would send a player to a specified map location when it is double clicked. I started with a lantern script, modified a lot, tried adding the random locations and *BOOM*, nothing mixed well and I am seeking help.

Using newest repo, I tried.

ERROR - -
/root/ServUO/Scripts/_Customs/ChestToSomewhere.cs(22,29): error CS0544: 'ChestToSomewhere.OnDoubleClick': cannot override because 'Item.OnDoubleClick(Mobile)' is not a property [/root/ServUO/Scripts/Scripts.csproj]

ChestToSomewhere.cs:
using System;

namespace Server.Items
{
    public class ChestToSomewhere : Item
    {
        [Constructable]
        public ChestToSomewhere()
            : base(0xA25)
        {
            Name = "Chest to Somewhere";
            Light = LightType.Circle100;
            Weight = 2.0;
            //LootType = Blessed
        }

        public ChestToSomewhere(Serial serial)
            : base(serial)
        {
        }

        public override int OnDoubleClick
        {
            set
            {
                switch ( Utility.Random( 2 ))
                {
                    case 0: new MapEntry("Britain", new Point3D(1434, 1699, 2), Map.Trammel ); break; //Location Information
                    case 1: new MapEntry("Britain", new Point3D(1434, 1699, 2), Map.Trammel ); break; //Location Information
                }
            }
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
}
 

Quasar

Citizen
use this as your base, its already in your server and works so should not be too difficult.
 

Attachments

  • TeleportRope.cs
    1.7 KB · Views: 2

arvoreen

Citizen
I would brush up on some C# basics to be honest, it looks like you're getting methods and properties confused with each other. Not trying to be mean or condescending, but it would help you immensely in the long run.

*edit: I didn't read the whole thing, but this looks like it might be useful to help: https://vegibit.com/c-methods-and-properties/
 

PyrO

Moderator
C#:
        public override int OnDoubleClick
        {
            set
            {
                switch ( Utility.Random( 2 ))

remove the set and the unneeded { } from the set