Rex

Grandmaster
I'm looking for info on what to use for this.

I'd like to create a command that a staff person can use to "tell" something to 1 player only. A kind of private message just for them that shows up as text above an item in game, but can only be seen by the targeted player.

I've looked through the various Sendmessage, LocalOverheadMessage etc options and can't find anything that will fit this.

Does anyone have any idea?

The way it would work is the staff member would type, "[tell1 This is the message" and then get a target crosshair click on the player they want to see the message, then they get another target and then they click on an item on the ground. The item then has an overhead message that says "This is the message".
 
You would need to create a command that does:
1) Get the message (probably via the command arguments)
2) Target a player,
3) Target an item,
4) Use: item.LabelTo(player, "message");

If you want it to be over a player's head, then you can take a look at PrivateOverheadMessage, or something like that.
 
could you not just use the message from who menu to pop up the scroll gump and the message would be presented?
 
Certainly could! But the point of this new command would be to add additional functionality to the staff as a tool that can be used to give private hints to certain players while in a roleplay scenario.
 
I am am at work so I can't test this atm but it should work.

Type [pvtmsg "message" then target the player to send it to.
 

Attachments

  • PvtMsg.cs
    1.3 KB · Views: 8
PvtMsg.cs was pretty close to what i wanted. I was able to extend the script a bit to get the right functionality.
Thank you very much.
 
First off I coded the message to show up at any Item, Mobile, StaticTarget or LandTarget. When i use the command, first target myself, then target the end target (any Item, Mobile, StaticTarget or LandTarget) it works perfectly. However, there seems to be some sort of issue in that if i use the command on a player and then the end target(any Item, Mobile, StaticTarget or LandTarget) the message seems to show up in the wrong spot, and also not in the same wrong spot. I can't really figure it out. Sometimes its a couple tiles off, 1south 1 east, other times its in a completely different direction, 5north 2 west.
I'll include my working script so maybe someone can look into it.

Again the functionality I'm looking for is a staff member types a message, targets a player, then targets something else which "appears" to say the message.

https://dl.dropboxusercontent.com/u/5608436/Error_LabelTo.webm

Code:
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Commands;
using Server.Network;
using Server.Items;
using VitaNex.Targets;

namespace Server.Commands
{
    public class StaffMsg
    {
        public static void Initialize()
        {
            CommandSystem.Register("say1", AccessLevel.GameMaster, new CommandEventHandler(StaffMsg_OnCommand));
            CommandSystem.Register("s1", AccessLevel.GameMaster, new CommandEventHandler(StaffMsg_OnCommand));
        }

        [Usage("say1 [message]")]
        [Description("Send a private message to a player at an item location")]
        private static void StaffMsg_OnCommand(CommandEventArgs e)
        {
            String msg = "";
            if (e.Length >= 1)
                msg = e.ArgString;
            e.Mobile.Target = new MobileTarget( e.Mobile, msg);
        }
    }

    public class MobileTarget : Target
    {
        public Mobile Owner { get; private set; }
        public Mobile mTarget { get; private set; }
        public String mymsg { get; private set; }
        public MobileTarget( Mobile owner, String msg)
            : base(-1, false, TargetFlags.None)
        {
            Owner = owner;
            mymsg = msg;
        }

        protected override void OnTarget(Mobile Owner, object targeted)
        {
            //base.OnTarget(Owner, targeted);

            if (targeted is Mobile)
            {
                mTarget = (Mobile)targeted;
                Owner.Target = new ItemTarget(mTarget, mymsg);
            }
        }
    }

    public class ItemTarget : Target
    {
        public Mobile mTarg { get; private set; }
        public String mymsg { get; private set; }
        public Item mItem { get; private set; }
        public ItemTarget( Mobile mTarget, String msg)
            : base(-1, true, TargetFlags.None)
        {
            mymsg = msg;
            mTarg = mTarget;
        }

        protected override void OnTarget(Mobile from, object targeted)
        {
            IPoint3D p = targeted as IPoint3D;
            PointSay pSay = new PointSay();
            pSay.Name = "";
            if (p == null)
                return;
            Map map = from.Map;
            if (map == null)
                return;
            pSay.MoveToWorld(new Point3D(p), map);
            pSay.Z = pSay.Z + 4;
            if (targeted is Mobile)//target is Mobile
            {
                Mobile m_target = (Mobile)targeted;
                if (m_target != null)
                {
                    pSay.LabelTo(mTarg, mymsg);
                }
            }
            if (targeted is Item) //target is regular Item
            {
                Item m_target = (Item)targeted;
                if (m_target != null)
                {
                    pSay.LabelTo(mTarg, mymsg);
                }
            }
            if (targeted is StaticTarget)//target is Static item
            {
                StaticTarget m_target = (StaticTarget)targeted;
                if (m_target != null)
                {
                    pSay.LabelTo(mTarg, mymsg);
                }
            }
            if (targeted is LandTarget)//target is land (static tiles)
            {
                LandTarget m_target = (LandTarget)targeted;
                if (m_target != null)
                {
                    pSay.LabelTo(mTarg, mymsg);
                }
            }
            UseDelaySystem.AddContext(from, DelayContextType.Point, TimeSpan.FromSeconds(5));
        }
    }
    #region Pointing Say Spot
    public class PointSay : Item
    {
        public PointSay()
            : base(0x0001)//this item doesn't draw any art in game.
        {
            Movable = false;
            Timer.DelayCall(TimeSpan.FromSeconds(4.0), new TimerCallback(Delete));
        }
        public override bool DisplayWeight { get { return false; } }//removing weight label
        public PointSay(Serial serial) : base(serial) { }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
    #endregion
}
 
UseDelaySystem.AddContext(from, DelayContextType.Point, TimeSpan.FromSeconds(5));

Mine won't run because of that line. I commented it out and ran it, works the same as you said but if I target the player then the item my message comes up in the lower left, same spot every time.
 
Last edited:
Ok, it appears I also don't need that part:
Code:
UseDelaySystem.AddContext(from, DelayContextType.Point, TimeSpan.FromSeconds(5));
 
I tried making the pSay item a regular item so you could see it, the item is going in the right place but the label is way off. Not sure why that is.
 
Mine repeats the position every time so it's really just a matter of adjusting the XYZ location to get it so the label is right. You won't be targeting yourself so you just need to focus on player/item location.
 
Is there any other method that creates a private message to 1 player besides PrivateOverheadMessage or LabelTo?
 
LabelTo is the only way I know of attaching the message to the object but I am a novice when it comes to the system and what it can do.
 
IIRC there's Mobile.SendMessage which I think will send to the lower left kind of like skill gain do, in classic client neways.
 
IIRC there's Mobile.SendMessage which I think will send to the lower left kind of like skill gain do, in classic client neways.

Yeah all of that works fine but what we are trying to do is get the message to show up above the item that is clicked so it draws attention to the item.
 
I've attached the concept my server uses for this, not the same thing for sure, however the quest arrow I think is a nice way to do it.
 

Attachments

  • NoticeClue.cs
    2.9 KB · Views: 13
I think i know. The item is invisible right? If it is, then it will surely appear to the very left like a sendmessage.
As the client have no access to the item, it can't stick the name anywhere.
Try with a visible item.
 
What the script I use will do is put an arrow pointing at the location, kind of like when you use the tracking skill.
 
I think i know. The item is invisible right? If it is, then it will surely appear to the very left like a sendmessage.
As the client have no access to the item, it can't stick the name anywhere.
Try with a visible item.

We have tried making the item visible, it makes no difference on the location of the LabelTo message.
What the script I use will do is put an arrow pointing at the location, kind of like when you use the tracking skill.

The quest arrow script might work but I am guessing it will do the same thing. The script is designed for a staff member to enter the message command then target a player followed by an item on the ground. It works fine if I target myself as the player, the notice appears on the item like it should. But if I target the player and the item the message appears off location. And it moves around depending on the location of the player. It shouldn't move because it's a LabelTo attached to the item.
 
The client should have access to the item "PointSay" as it does generate an item. The itemID i used is this:
base(0x0001)//this item doesn't draw any art in game.
which is in UOfiddler as a "nodraw" item. which is what I'd like, an item that doesn't show up to the client. If i change the itemID to something else like base(0x0003) then the item that shows up is half of the Ankh thing. The ankh shows up in the exact correct position, yet the LableTo still is in some other spot.

https://dl.dropboxusercontent.com/u/5608436/Error_LabelTo2.webm

it seems to be some relation between the Staff using the command and the PointSay item location.
 
The client should have access to the item "PointSay" as it does generate an item. The itemID i used is this:
base(0x0001)//this item doesn't draw any art in game.
which is in UOfiddler as a "nodraw" item. which is what I'd like, an item that doesn't show up to the client. If i change the itemID to something else like base(0x0003) then the item that shows up is half of the Ankh thing. The ankh shows up in the exact correct position, yet the LableTo still is in some other spot.

https://dl.dropboxusercontent.com/u/5608436/Error_LabelTo2.webm

it seems to be some relation between the Staff using the command and the PointSay item location.

It's kinda weird though, the staff can move around and it won't change, most of the time. But if the player moves it seems to follow him but not exactly in the same spot. It's almost like a dynamically placed tooltip finding a spot it can fit. Take the player and move around the backpack in a circle and watch how it acts.
 
Well, couldn't figure out how to get the message on the item but I figured out another way. Use this script and the included item to drop an item that is visible only to the staff and targeted player. It also sends a private overhead message to the player. [say1 Hey, grab that item that was highlighted!

Code:
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Commands;
using Server.Network;
using Server.Items;
using VitaNex.Targets;
namespace Server.Commands
{
    public class StaffMsg
    {
        public static void Initialize()
        {
            CommandSystem.Register("say1", AccessLevel.GameMaster, new CommandEventHandler(StaffMsg_OnCommand));
            CommandSystem.Register("s1", AccessLevel.GameMaster, new CommandEventHandler(StaffMsg_OnCommand));
        }
        [Usage("say1 [message]")]
        [Description("Send a private message to a player at an item location")]
        private static void StaffMsg_OnCommand(CommandEventArgs e)
        {
            String msg = "";
            if (e.Length >= 1)
                msg = e.ArgString;
            e.Mobile.Target = new MobileTarget( e.Mobile, msg);
        }
    }
    public class MobileTarget : Target
    {
        public Mobile Owner { get; private set; }
        public Mobile mTarget { get; private set; }
        public String mymsg { get; private set; }
        public MobileTarget( Mobile owner, String msg)
            : base(-1, false, TargetFlags.None)
        {
            Owner = owner;
            mymsg = msg;
        }
        protected override void OnTarget(Mobile Owner, object targeted)
        {
            if (targeted is Mobile)
            {
                mTarget = (Mobile)targeted;
                Owner.SendMessage("Target the item");
                Owner.Target = new ItemTarget(mTarget, mymsg);
            }
        }
    }
    public class ItemTarget : Target
    {
        public Mobile mTarg { get; private set; }
        public String mymsg { get; private set; }
        public Item mItem { get; private set; }
        public ItemTarget( Mobile mTarget, String msg)
            : base(-1, true, TargetFlags.None)
        {
            mymsg = msg;
            mTarg = mTarget;
        }
        protected override void OnTarget(Mobile from, object targeted)
        {
            IPoint3D p = targeted as IPoint3D;
            if (p == null)
                return;

            Map map = mTarg.Map;
            if (map == null)
                return;

            Item tItem = new InvisibleTile2(mTarg.Name);
            tItem.MoveToWorld(new Point3D(p), map);

            Item mytarg = (Item)targeted;
            mTarg.LocalOverheadMessage( MessageType.Emote, 43, true, mymsg );
        }
    }
}
 

Attachments

  • InvisibleTile2.cs
    1.3 KB · Views: 4

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back