hello people :) sorry if my question its too n00b. i wanna know is there is a function in OnDoubleClick or how to do this :

i wanna create an item that sends to to a determinate point of the map when you doble click it and autodestroys when is used...

autodestroy can be maked with Consume(); or item.Delete();?

but how i can make to teleport the players and party members to a specific area when the party member or leader clicks the object like perless keys? i dont want nothing special with gumps or something... just when they doble click teleport all party to X point of the actual map they are :D thx!!

this would be a very help for me.. thx guys
 
Last edited:
I just posted a quest in the resources area, The Ramayan. In it there is a ring that, on double click, will teleport you, then self deletes. But... it only teleports you. To move a whole party you may have to make an item that opens a temporary gate.

The teleport/delete ring:
C#:
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

                        if (from != null)
            {
                from.MoveToWorld(new Point3D(5256, 1839, 0), Map.Trammel);   
                this.Delete();
            }
 
Last edited:
hello tukaram :D thx for answer, ive made this.. i use the base of a potion for made a teleport potion and uses consume for autodelete it when user uses it :D... hey nice idea bro! i was thinking in same... can you give me an example on how to create a moongate that decays in X time? :) it would be very helpfull for me...
1590516946298.png
 
Here is a example from the UOBlackBox, It has 3 types of gates, 2 they enter and the one that appears at the destination, all with decay timers!

Code:
 //UO Black Box - By GoldDraco13
//1.0.0.97

using Server.Mobiles;
using System;

namespace Server.UOBlackBox
{
    class BlackBoxTravel : Item
    {
        public string Owner;

        private Map old_Map;
        private Map new_Map = Map.Trammel;

        private Point3D old_Location;
        private Point3D new_Location = new Point3D(1602, 1591, 20);

        private bool IsSpecial = false;

        private DeleteTimer deleteTimer;
        private static int deleteDelay = 10;

        private QuickDeleteTimer q_DeleteTimer;
        private static int q_DeleteDelay = 50;

        private SoundTimer soundTimer;
        private static int soundDelay = 50;

        private MoveTimer moveTimer;
        private static int moveDelay = 50;

        private RevealTimer revealTimer;
        private static int revealDelay = 500;

        Random rnd = new Random();
        private int hue;

        [Constructable]
        public BlackBoxTravel(string owner)
        {
            Name = "Black Box Portal";
            Owner = owner;

            Movable = false;
            ItemID = 0xF6C;
            Light = LightType.Circle300;

            old_Map = Map;
            old_Location = new Point3D(X, Y, Z);

            StartDeleteGate(this);

            StartingSound(this);
        }

        [Constructable]
        public BlackBoxTravel(string owner, Map map, int x, int y, int z, string pass)
        {
            Name = "Black Box Portal";
            Owner = owner;

            Movable = false;
            ItemID = 0xF6C;
            Light = LightType.Circle300;

            hue = Hue = rnd.Next(1, 1001);

            old_Map = Map;
            old_Location = new Point3D(X, Y, Z);

            new_Map = map;
            new_Location = new Point3D(x, y, z);

            if (ProperCMD(pass))
            {
                StartDeleteGate(this);
            }
            else
            {
                QuickDelete(this);
            }
            StartingSound(this);
        }

        [Constructable]
        public BlackBoxTravel(string owner, Map map, int x, int y, int z, string pass, bool isSpecial)
        {
            Name = "Black Box SoulStone";
            Owner = owner;

            IsSpecial = isSpecial;

            Movable = false;
            ItemID = 0x423F;
            Light = LightType.Circle300;

            int RandomEffect = rnd.Next(10);

            if (RandomEffect <= 1) //Fire
                Hue = 1260;
            if (RandomEffect == 2) //Ice
                Hue = 1266;
            if (RandomEffect == 3) //Toxic
                Hue = 1272;
            if (RandomEffect == 4) //Electric
                Hue = 1283;
            if (RandomEffect == 5) //Mist
                Hue = 1288;
            if (RandomEffect == 6) //Explosion
                Hue = 1174;
            if (RandomEffect == 7) //Stone
                Hue = 1177;
            if (RandomEffect >= 8) //Shiney
                Hue = 1287;

            old_Map = Map;
            old_Location = new Point3D(X, Y, Z);

            new_Map = map;
            new_Location = new Point3D(x, y, z);

            if (ProperCMD(pass))
            {
                StartDeleteGate(this);
            }
            else
            {
                QuickDelete(this);
            }
            StartingSound(this);
        }

        private bool ProperCMD(string pass)
        {
            if (pass != "BBCMD72")
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        private void StartDeleteGate(BlackBoxTravel gate)
        {
            if (gate != null)
            {
                deleteTimer = new DeleteTimer(gate);
                deleteTimer.Start();
            }
        }

        private void QuickDelete(BlackBoxTravel gate)
        {
            if (gate != null)
            {
                q_DeleteTimer = new QuickDeleteTimer(gate);
                q_DeleteTimer.Start();
            }
        }

        private void StartingSound(BlackBoxTravel gate)
        {
            if (gate != null)
            {
                soundTimer = new SoundTimer(gate);
                soundTimer.Start();
            }
        }

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

        public override void OnDoubleClick(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;

            if (pm == null)
                return;

            if (!IsSpecial)
            {
                if (m.InRange(GetWorldLocation(), 1))
                    OnMoveOver(m);
                else
                    m.SendLocalizedMessage(500446); // That is too far away.
            }
            else
            {
                OnMoveOver(m);
            }
        }

        public override bool OnMoveOver(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;

            if (pm != null)
            {
                if (IsSpecial)
                {
                    pm.Hidden = true;

                    if (Hue == 1260) //Fire
                        Effects.SendLocationEffect(old_Location, old_Map, 0x3709, 30);
                    if (Hue == 1266) //Ice
                        Effects.SendLocationEffect(old_Location, old_Map, 0x37CC, 40);
                    if (Hue == 1272) //Toxic
                        Effects.SendLocationEffect(old_Location, old_Map, 0x374A, 17);
                    if (Hue == 1283) //Electric
                        Effects.SendBoltEffect(pm);
                    if (Hue == 1288) //Mist
                        Effects.SendLocationEffect(old_Location, old_Map, 0x3728, 13);
                    if (Hue == 1174) //Explosion
                        Effects.SendLocationEffect(old_Location, old_Map, 0x36BD, 10);
                    if (Hue == 1177) //Stone
                        Effects.SendLocationEffect(old_Location, old_Map, 0x37C4, 31);
                    if (Hue == 1287) //Shiny
                        Effects.SendLocationEffect(old_Location, old_Map, 0x375A, 30);

                    revealTimer = new RevealTimer(pm);
                    revealTimer.Start();
                }
                else
                {
                    Effects.SendLocationEffect(old_Location, old_Map, 0x3728, 13);
                }
                StartTravel(pm, this);
                    return true;
            }
            else
            {
                return false;
            }
        }

        private void StartTravel(PlayerMobile pm, BlackBoxTravel BBT)
        {
            if (new_Map == null || new_Map == Map.Internal)
                return;

            if (pm != null && BBT != null)
            {
                moveTimer = new MoveTimer(pm, BBT);
                moveTimer.Start();
            }
        }

        private void StartSound(BlackBoxTravel BBT)
        {
            foreach (Mobile player in World.Mobiles.Values)
            {
                PlayerMobile pm = player as PlayerMobile;

                if (pm != null && BBT != null)
                {
                    if (pm.Map == BBT.Map)
                    {
                        if (pm.X > (BBT.X - 20) && pm.X < (BBT.X + 20))
                        {
                            if (pm.Y > (BBT.Y - 20) && pm.Y < (BBT.Y + 20))
                            {
                                if (BBT.IsSpecial)
                                {
                                    if (Hue == 1260) //Fire
                                    {
                                        pm.PlaySound(855);
                                    }
                                    if (Hue == 1266) //Ice
                                    {
                                        pm.PlaySound(20);
                                    }
                                    if (Hue == 1272) //Toxic
                                    {
                                        pm.PlaySound(1140);
                                    }
                                    if (Hue == 1283) //Electric
                                    {
                                        pm.PlaySound(41);
                                        Effects.SendBoltEffect(pm);
                                    }
                                    if (Hue == 1288) //Mist
                                    {
                                        pm.PlaySound(252);
                                    }
                                    if (Hue == 1174) //Explosion
                                    {
                                        pm.PlaySound(519);
                                    }
                                    if (Hue == 1177) //Stone
                                    {
                                        pm.PlaySound(515);
                                    }
                                    if (Hue == 1287) //Shiny
                                    {
                                        pm.PlaySound(492);
                                    }
                                }
                                else
                                {
                                    pm.PlaySound(0x20F);
                                }
                            }
                        }
                    }
                }
            }
        }

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

            writer.Write(0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();
        }

        private class MoveTimer : Timer
        {
            private readonly PlayerMobile pm;
            private readonly BlackBoxTravel i_Gate;

            public MoveTimer(PlayerMobile player, BlackBoxTravel gate) : base(TimeSpan.FromMilliseconds(moveDelay))
            {
                pm = player;
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                pm.MoveToWorld(i_Gate.new_Location, i_Gate.new_Map);

                if (i_Gate.IsSpecial)
                {
                    Point3D point3D = new Point3D(pm.X, pm.Y, pm.Z);

                    if (i_Gate.Hue == 1260) //Fire
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x3709, 30);
                    if (i_Gate.Hue == 1266) //Ice
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x37CC, 40);
                    if (i_Gate.Hue == 1272) //Toxic
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x374A, 17);
                    if (i_Gate.Hue == 1283) //Electric
                        Effects.SendBoltEffect(pm);
                    if (i_Gate.Hue == 1288) //Mist
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x3728, 13);
                    if (i_Gate.Hue == 1174) //Explosion
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x36BD, 10);
                    if (i_Gate.Hue == 1177) //Stone
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x37C4, 31);
                    if (i_Gate.Hue == 1287) //Shiny
                        Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x375A, 30);
                }
                else
                {
                    BlackBoxTravelEnd i_BlackBoxEnd = new BlackBoxTravelEnd(i_Gate.hue, pm.Name);

                    i_BlackBoxEnd.MoveToWorld(i_Gate.new_Location, i_Gate.new_Map);
                    Effects.SendLocationEffect(i_Gate.new_Location, i_Gate.new_Map, 0x3728, 13);
                }
                i_Gate.StartSound(i_Gate);

                if (i_Gate.IsSpecial)
                {
                    i_Gate.Delete();
                }
                Stop();
            }
        }

        private class RevealTimer : Timer
        {
            private readonly PlayerMobile pm;

            public RevealTimer(PlayerMobile player) : base(TimeSpan.FromMilliseconds(revealDelay))
            {
                pm = player;
            }

            protected override void OnTick()
            {
                pm.Hidden = false;
                Stop();
            }
        }

        private class SoundTimer : Timer
        {
            private readonly BlackBoxTravel i_Gate;

            public SoundTimer(BlackBoxTravel gate) : base(TimeSpan.FromMilliseconds(soundDelay))
            {
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                i_Gate.StartSound(i_Gate);
                Stop();
            }
        }

        private class QuickDeleteTimer : Timer
        {
            private readonly BlackBoxTravel i_Gate;

            public QuickDeleteTimer(BlackBoxTravel gate) : base(TimeSpan.FromMilliseconds(q_DeleteDelay))
            {
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                i_Gate.Delete();
                Stop();
            }
        }

        private class DeleteTimer : Timer
        {
            private readonly BlackBoxTravel i_Gate;

            public DeleteTimer(BlackBoxTravel gate) : base(TimeSpan.FromSeconds(deleteDelay))
            {
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                i_Gate.StartSound(i_Gate);
                i_Gate.Delete();
                Stop();
            }
        }
    }

    class BlackBoxTravelEnd : Item
    {
        public string Owner;

        private DeleteTimer deleteTimer;
        private static int deleteDelay = 10;

        private SoundTimer soundTimer;
        private static int soundDelay = 50;

        [Constructable]
        public BlackBoxTravelEnd(int hue, string owner)
        {
            Name = "Black Box Portal Exit";
            Owner = owner;

            Movable = false;
            ItemID = 0xF6C;
            Hue = hue;
            Light = LightType.Circle300;

            StartDeleteGate(this);

            StartingSound(this);
        }

        private void StartDeleteGate(BlackBoxTravelEnd gate)
        {
            if (gate != null)
            {
                deleteTimer = new DeleteTimer(gate);
                deleteTimer.Start();
            }
        }

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

        public override bool OnMoveOver(Mobile m)
        {
            return false;
        }

        private void StartingSound(BlackBoxTravelEnd gate)
        {
            if (gate != null)
            {
                soundTimer = new SoundTimer(gate);
                soundTimer.Start();
            }
        }

        private void StartSound(BlackBoxTravelEnd BBT)
        {
            foreach (Mobile player in World.Mobiles.Values)
            {
                PlayerMobile pm = player as PlayerMobile;

                if (pm != null && BBT != null)
                {
                    if (pm.Map == BBT.Map)
                    {
                        if (pm.X > (BBT.X - 20) && pm.X < (BBT.X + 20))
                        {
                            if (pm.Y > (BBT.Y - 20) && pm.Y < (BBT.Y + 20))
                            {
                                pm.PlaySound(0x20F);
                            }
                        }
                    }
                }
            }
        }

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

            writer.Write(0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();
        }

        private class SoundTimer : Timer
        {
            private readonly BlackBoxTravelEnd i_Gate;

            public SoundTimer(BlackBoxTravelEnd gate) : base(TimeSpan.FromMilliseconds(soundDelay))
            {
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                i_Gate.StartSound(i_Gate);
                Stop();
            }
        }

        private class DeleteTimer : Timer
        {
            private readonly BlackBoxTravelEnd i_Gate;

            public DeleteTimer(BlackBoxTravelEnd gate) : base(TimeSpan.FromSeconds(deleteDelay))
            {
                i_Gate = gate;
            }

            protected override void OnTick()
            {
                i_Gate.StartSound(i_Gate);
                i_Gate.Delete();
                Stop();
            }
        }
    }
}
 
Never tried a gate with an item, I use the XML Spawner. Someone shared this code a while back:
orc/ATTACH/<xmldeathaction/action/@moongate/target/(3501,2573,14)/targetmap/trammel/ATTACH/temporaryquestobject,,1 (kill skeleton, get a 1 minute gate)

I love the XML Spawners, they are very powerful and easy to modify. I use them for gates, paragons, mini-champs...
 
Never tried a gate with an item, I use the XML Spawner. Someone shared this code a while back:
orc/ATTACH/<xmldeathaction/action/@moongate/target/(3501,2573,14)/targetmap/trammel/ATTACH/temporaryquestobject,,1 (kill skeleton, get a 1 minute gate)

I love the XML Spawners, they are very powerful and easy to modify. I use them for gates, paragons, mini-champs...

I guess it'll depend if they want to code a moongate or use a system to spawn one via xml. I always prefer coding myself!
 
i find the solution guys :D i just used the starroom gate to generate a new temporal gate, then generate an object via clicking an item and move it with m.movetoworld()

thx for answer me guys :D u help me alot!!!
 
Back