Help with making quest doable only once.

Candy Apple

Well-Known Member
Nov 14, 2016
269
25
45
Hi again I was wondering where I should add in the script to make the quest to be done only once? I am using Ilutzio's Questmaker 1.1 and there is nothing in there to set it. I will send a .cs So that I might see where and how to do this and thanks again. Awsome day to you..
 

Attachments

GoldDraco13

Silver Donator
Aug 1, 2014
182
157
47
Canada
mycy4.com
Donate
Donate money to this user
At the top, it is a stand alone variable, so after the class is declared, look for similar lines and place it with them, doesn't matter exactly as long as it is in the body of the class and not in a method!
Post automatically merged:

Code:
//not here

public class Name
{
//place here

     void override something ()
     {
     //not here
      }
}

//not here
 

Candy Apple

Well-Known Member
Nov 14, 2016
269
25
45
At the top, it is a stand alone variable, so after the class is declared, look for similar lines and place it with them, doesn't matter exactly as long as it is in the body of the class and not in a method!
Post automatically merged:

Code:
//not here

public class Name
{
//place here

     void override something ()
     {
     //not here
      }
}

//not here
Oh wow I am so not good at this :( could you show me in the above Bella.cs so I will know for sure please and ty. Im still a bit of a noob..
 

GoldDraco13

Silver Donator
Aug 1, 2014
182
157
47
Canada
mycy4.com
Donate
Donate money to this user
Line 18

Code:
/* This file was created with
Ilutzio's Questmaker. Enjoy! */
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
namespace Server.Mobiles
{
    [CorpseName("Bella's Corpse")]
    public class Bella : Mobile
    {
        public override bool DoneOnce { get { return true; } } //put it here
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public Bella()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new BellaEntry(from, this));
        }

        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();
        }

        public class BellaEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public BellaEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
                {
                    ///////////gump name
                    if (!mobile.HasGump(typeof(BellaQuestGump)))
                    {
                        mobile.SendGump(new BellaQuestGump(mobile));
                    }
                }
            }
        }

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

            if (mobile != null)
            {

                ///////////item to be dropped
                if (dropped is CowPatty)
                {
                    if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFarmStuffBag());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There you go now go enjoy farm life.", mobile.NetState);


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
 

Visam

Well-Known Member
Mar 19, 2015
256
44
47
This quest isn't using the quest system so I don't believe this will work. The only way I know to get it to work (prolly others who knows) is by using xml spawners account tag system. It would be added like this:

C#:
/* This file was created with
Ilutzio's Questmaker. Enjoy! */

using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using Server.Accounting; //Visam Added to get the account

namespace Server.Mobiles
{
    [CorpseName("Bella's Corpse")]
    public class Bella : Mobile
    {
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public Bella()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new BellaEntry(from, this));
        }

        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();
        }

        public class BellaEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public BellaEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
                {
                        if (!mobile.HasGump(typeof(BellaQuestGump)))
                        {
                            mobile.SendGump(new BellaQuestGump(mobile));
                        }
                }
            }
        }

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            Mobile m = from;
            PlayerMobile mobile = m as PlayerMobile;
          
            Account acct=(Account)from.Account; //Visam added to get the account of the current char
            bool BagOfFarmStuffBagRecieved = Convert.ToBoolean(acct.GetTag("BagOfFarmStuffBagRecieved")); //Visam added to add true/false value for checking if it's been done

            if (mobile != null)
            {
                ///////////item to be dropped
                if (dropped is CowPatty && !BagOfFarmStuffBagRecieved) //Visam added account tag check
                {
                    if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFarmStuffBag());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There you go now go enjoy farm life.", mobile.NetState);
                    acct.SetTag( "BagOfFarmStuffBagRecieved", "true" ); // Visam add a tag to the player showing the quest has been completed


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
Edits are marked with //Visam explanation
 
Last edited:
  • Like
Reactions: GoldDraco13

Candy Apple

Well-Known Member
Nov 14, 2016
269
25
45
Line 18

Code:
/* This file was created with
Ilutzio's Questmaker. Enjoy! */
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
namespace Server.Mobiles
{
    [CorpseName("Bella's Corpse")]
    public class Bella : Mobile
    {
        public override bool DoneOnce { get { return true; } } //put it here
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public Bella()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new BellaEntry(from, this));
        }

        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();
        }

        public class BellaEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public BellaEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
                {
                    ///////////gump name
                    if (!mobile.HasGump(typeof(BellaQuestGump)))
                    {
                        mobile.SendGump(new BellaQuestGump(mobile));
                    }
                }
            }
        }

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

            if (mobile != null)
            {

                ///////////item to be dropped
                if (dropped is CowPatty)
                {
                    if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFarmStuffBag());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There you go now go enjoy farm life.", mobile.NetState);


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
--------------------------------------------------------------------------------
Ok this is what I did and got this below :p Not sure what that means???

ServUO - [http://www.servuo.com] Version 0.5, Build 6437.20990
Publish 54
Core: Optimizing for 4 64-bit processors
RandomImpl: CSPRandom (Software)
Errors:
+ Quests/1MYQuest/40ThievesQuest/PrincessJasmineQuest.cs:
CS0115: Line 17: 'Server.Mobiles.PrincessJasmine.DoneOnce': no suitable meth
od found to override
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Attachments

Visam

Well-Known Member
Mar 19, 2015
256
44
47
The following line will not work with this type of quest. It isn't using the quest system that uses it so it will throw errors.
public override bool DoneOnce{ get{ return true; } }

This one should work. It uses XML Spawners account tag system to set a tag on the players account to show if it's been done before or not.
The changes I made are marked with //Visam

C#:
//Candy Apple
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
namespace Server.Mobiles
using Server.Accounting; //Visam Added to get the account
{
    [CorpseName("Princess Jasmine's Corpse")]
    public class PrincessJasmine : Mobile
    {
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public PrincessJasmine()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new PrincessJasmineEntry(from, this));
        }

        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();
        }

        public class PrincessJasmineEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public PrincessJasmineEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
                
                Item a = mobile.Backpack.FindItemByType(typeof (AladdinsSupplyBag));   // This check keeps them from getting multiple bags at once.
            if (a == null)
        mobile.AddToBackpack(new AladdinsSupplyBag());
    
                {
                    ///////////gump name
                    if (!mobile.HasGump(typeof(PrincessJasmineQuestGump)))
                    {
                        mobile.SendGump(new PrincessJasmineQuestGump(mobile));
                    }
                }
            }
        }

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

            Account acct=(Account)from.Account; //Visam added to get the account of the current char
            bool BagOfFortyThievesSuitRecieved = Convert.ToBoolean(acct.GetTag("BagOfFortyThievesSuitRecieved")); //Visam added to add true/false value for checking if it's been done

            if (mobile != null)
            {

                ///////////item to be dropped
                if (dropped is FullAladdinsBag && !BagOfFortyThievesSuitRecieved) //Visam added account tag check
                {
                    //if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFortyThievesSuit());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Thank you for your help!.", mobile.NetState);
                    acct.SetTag( "BagOfFortyThievesSuitRecieved", "true" ); // Visam add a tag to the player showing the quest has been completed


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
 

Candy Apple

Well-Known Member
Nov 14, 2016
269
25
45
The following line will not work with this type of quest. It isn't using the quest system that uses it so it will throw errors.
public override bool DoneOnce{ get{ return true; } }

This one should work. It uses XML Spawners account tag system to set a tag on the players account to show if it's been done before or not.
The changes I made are marked with //Visam

C#:
//Candy Apple
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
namespace Server.Mobiles
using Server.Accounting; //Visam Added to get the account
{
    [CorpseName("Princess Jasmine's Corpse")]
    public class PrincessJasmine : Mobile
    {
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public PrincessJasmine()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new PrincessJasmineEntry(from, this));
        }

        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();
        }

        public class PrincessJasmineEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public PrincessJasmineEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
                
                Item a = mobile.Backpack.FindItemByType(typeof (AladdinsSupplyBag));   // This check keeps them from getting multiple bags at once.
            if (a == null)
        mobile.AddToBackpack(new AladdinsSupplyBag());
    
                {
                    ///////////gump name
                    if (!mobile.HasGump(typeof(PrincessJasmineQuestGump)))
                    {
                        mobile.SendGump(new PrincessJasmineQuestGump(mobile));
                    }
                }
            }
        }

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

            Account acct=(Account)from.Account; //Visam added to get the account of the current char
            bool BagOfFortyThievesSuitRecieved = Convert.ToBoolean(acct.GetTag("BagOfFortyThievesSuitRecieved")); //Visam added to add true/false value for checking if it's been done

            if (mobile != null)
            {

                ///////////item to be dropped
                if (dropped is FullAladdinsBag && !BagOfFortyThievesSuitRecieved) //Visam added account tag check
                {
                    //if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFortyThievesSuit());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Thank you for your help!.", mobile.NetState);
                    acct.SetTag( "BagOfFortyThievesSuitRecieved", "true" ); // Visam add a tag to the player showing the quest has been completed


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
--------------------------------------------------------------------------------

Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Quests/1MYQuest/40ThievesQuest/PrincessJasmineQuest.cs:
CS1514: Line 12: { expected
CS0116: Line 15: A namespace cannot directly contain members such as fields
or methods
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Visam

Well-Known Member
Mar 19, 2015
256
44
47
Sorry put the first edit a line below where it should have been. Try this.
C#:
//Candy Apple
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using Server.Accounting; //Visam Added to get the account

namespace Server.Mobiles
{
    [CorpseName("Princess Jasmine's Corpse")]
    public class PrincessJasmine : Mobile
    {
        public virtual bool IsInvulnerable { get { return true; } }

        [Constructable]
        public PrincessJasmine()
        {

            ///////////STR/DEX/INT
            InitStats(31, 41, 51);

            ///////////name
            Name = "Bella";

            ///////////title
            Title = "The Farmer";

            ///////////sex. 0x191 is female, 0x190 is male.
            Body = 0x191;

            ///////////skincolor
            Hue = Utility.RandomSkinHue();

            ///////////Random hair and haircolor
            Utility.AssignRandomHair(this);

            ///////////clothing and hues
            AddItem(new Server.Items.FancyShirt(Utility.RandomRedHue()));
            AddItem(new Server.Items.Skirt(Utility.RandomNeutralHue()));
            AddItem(new Server.Items.Sandals(Utility.RandomGreenHue()));

            ///////////immortal and frozen to-the-spot features below:
            Blessed = true;
            CantWalk = true;

            ///////////Adding a backpack
            Container pack = new Backpack();
            pack.DropItem(new Gold(250, 300));
            pack.Movable = false;
            AddItem(pack);
        }

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

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);
            list.Add(new PrincessJasmineEntry(from, this));
        }

        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();
        }

        public class PrincessJasmineEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;
            public PrincessJasmineEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;
               
                Item a = mobile.Backpack.FindItemByType(typeof (AladdinsSupplyBag));   // This check keeps them from getting multiple bags at once.
            if (a == null)
        mobile.AddToBackpack(new AladdinsSupplyBag());
   
                {
                    ///////////gump name
                    if (!mobile.HasGump(typeof(PrincessJasmineQuestGump)))
                    {
                        mobile.SendGump(new PrincessJasmineQuestGump(mobile));
                    }
                }
            }
        }

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

            Account acct=(Account)from.Account; //Visam added to get the account of the current char
            bool BagOfFortyThievesSuitRecieved = Convert.ToBoolean(acct.GetTag("BagOfFortyThievesSuitRecieved")); //Visam added to add true/false value for checking if it's been done

            if (mobile != null)
            {

                ///////////item to be dropped
                if (dropped is FullAladdinsBag && !BagOfFortyThievesSuitRecieved) //Visam added account tag check
                {
                    //if (dropped.Amount != 15)
                    {
                        this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "There's not the right amount here!", mobile.NetState); return false;
                    }
                    dropped.Delete();

                    ///////////the reward
                    mobile.AddToBackpack(new Gold(2000));
                    mobile.AddToBackpack(new BagOfFortyThievesSuit());

                    ///////////thanks message
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Thank you for your help!.", mobile.NetState);
                    acct.SetTag( "BagOfFortyThievesSuitRecieved", "true" ); // Visam add a tag to the player showing the quest has been completed


                    return true;
                }
                else if (dropped is Whip)
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, 1054071, mobile.NetState); return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "I have no need for this...", mobile.NetState);
                }
            }
            return false;
        }
    }
}
 
  • Like
Reactions: Candy Apple