OnDragDrop will not work for me

PigPen

Citizen
Okay . . it's time for me to get a scripting lesson. I have worked on this for several hours and I'm sure the obvious is eluding me.

I have an OnDragDrop section in one of my Quest Givers. Everything complies but it does not 'fully' work.

I want the QG to give an Overhead message depending on what the player drops. The problem is . . no Overhead message is given.

Here is the OnDragDrp section:
Code:
        public override bool OnDragDrop( Mobile from, Item dropped )
        {               
            if ( dropped is GobannusScale )
            {
                GobannusScale scale = dropped as GobannusScale;

                if (scale.Amount == 5000 )
                {
                    scale.Delete();
                    from.AddToBackpack(new SelfRepairDeed());

                    this.PrivateOverheadMessage( MessageType.Regular, 1153, false, "Thank you. The Self Repair Deed is in your backpack.", this.NetState );
                }
                else
                {
                    this.PrivateOverheadMessage( MessageType.Regular, 1153, false, "For a Self Repair deed drop 5000 'Special Scales'. No more and No less.", this.NetState );
                }
            }
            else
            {
                    this.PrivateOverheadMessage( MessageType.Regular, 1153, false, "Don't drop things on me unless they are 'Special Scales'.", this.NetState );
            }
            return false;
        }

Can someone please tell me what I'm missing?

Many Thanks
 
Last edited:
Did u try setting the private overhead message variables to true by chance?
C#:
        public override bool OnDragDrop( Mobile from, Item dropped )
        {             
            if ( dropped is GobannusScale )
            {
                GobannusScale scale = dropped as GobannusScale;

                if (scale.Amount == 5000 )
                {
                    scale.Delete();
                    from.AddToBackpack(new SelfRepairDeed());

                    this.PrivateOverheadMessage( MessageType.Regular, 1153, true, "Thank you. The Self Repair Deed is in your backpack.", this.NetState );
                }
                else
                {
                    this.PrivateOverheadMessage( MessageType.Regular, 1153, true, "For a Self Repair deed drop 5000 'Special Scales'. No more and No less.", this.NetState );
                }
            }
            else
            {
                    this.PrivateOverheadMessage( MessageType.Regular, 1153, true, "Don't drop things on me unless they are 'Special Scales'.", this.NetState );
            }
            return false;
        }
Post automatically merged:

1153 is also the hue of the text, u can change that to whatever color u perfer most
 
Last edited:

PigPen

Citizen
Thank you for your reply.

So I tried using . . .

this.PrivateOverheadMessage( MessageType.Regular, 1153, true, "Thank you. The Self Repair Deed is in your backpack.", this.NetState );

. . . as you suggested but the result is the same. No message appears (overhead or otherwise).

It remains a challenge and a mystery

Should I be using something other then 'this' ??
 

Tukaram

Squire
I do not use the 2nd 'this' (this.NetState), I use 'moblie.NetState'.
Here is my sample I work from in my quest template:

C#:
                else if (dropped is QuestFindItem)
                        {
                            this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState);
                            return false;
                        }
                        else
                        {
                            this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Oh, this is not what I am looking for.", mobile.NetState);
                        }
                    }
                    return false;
 

PigPen

Citizen
Thank you both . . you set me on the right track.

Initially the suggestions did not work with the 'OnDragDrop' that I posted above but they made me realize . . I was not getting a message displayed because the script was not able to establish whose or what Netspace. I needed to connect "mobile.NetState" with something that was not being set out in my 'OnDragDrop'.

So . . for anyone else with this problem here is the 'OnDragDrop' that I got working for me. Note the first two lines where the connection is established.

Code:
        public override bool OnDragDrop( Mobile from, Item dropped )
        { 
            Mobile m = from;
            PlayerMobile mobile = m as PlayerMobile;

            if (mobile != null)
            {
                if ( dropped is GobannusScale )
                {
                    GobannusScale scale = dropped as GobannusScale;
                    if (scale.Amount == 5000 )
                    {
                        scale.Delete();
                        from.AddToBackpack(new SelfRepairDeed());
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Thank you. The Self Repair Deed is in your backpack.", mobile.NetState);
                        return false;
                    }
                    else
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Sorry. For a Self Repair deed drop 5000 'Special Scales'. No more and No less.", mobile.NetState);
                        return false;
                    }
                }
                else
                {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Sorry. I only accept 'Special Scales' for a Self Repair deed", mobile.NetState);
                        return false;
                }
                return false;
            }
            return false;
        }

I would never have got this working without your help (love this community) and on this one my thanks especially go out to Tukaram.

*bows*
 
Tukaram had also helped me out a few weeks ago with adding wands to the Lich's drop table. He's a smart man when it comes to C#, that's forsure