I am installing Arianna's Quest that I downloaded with some quest package...

It is an old quest where Arianna gives you a magic jewelry box, and sends you to collect 3 items from her relatives. They each ask for something in return, of course. At the end of the quest you have the magic jewelry box, 3 pieces of jewelry, and 2 books of clues. When you double click the box it deletes the 3 pieces of jewelry and leaves you the special quest jewelry that Arriana wants. That leaves some junk in your bag - the jewelry box, and 2 books.

I looked at the code and see how they delete the 3 pieces of jewelry, and can add the box & books (just to clean up your backpack). As it is written all the items that are deleted are required to be in your pack to make the quest item. The problem is I don't think the books should be a required item. Here is the code where I added the books & box. Is there a way to make it delete the 2 books, if you have them, but still work and make the quest item if you do not have them?

Am I making any sense ha ha

Items "a", "b", and "c" were in the original script. I added items "d", "e", and "f". I want "e" and "f" to be optional. I tested this and it does work - I just don't want the books to be required. :)

I tried remarking out the if (e != null) for e & f. Then Visual Studio made me move the closing bracket for each of them above the else command. The script loaded fine, but when I double clicked the box the server crashed. So it is not quite right...

Code:
  public override void OnDoubleClick(Mobile m)

  {
  Item a = m.Backpack.FindItemByType(typeof(ArrianasDiamond));
  if (a != null)
  {
  Item b = m.Backpack.FindItemByType(typeof(ArrianasClips));
  if (b != null)
  {
  Item c = m.Backpack.FindItemByType(typeof(ArrianasHoops));
  if (c != null)
  {
  Item d = m.Backpack.FindItemByType(typeof(AncientJewelryBox));
  if (d != null)
  {
  Item e = m.Backpack.FindItemByType(typeof(GrandpaTamsJournal));
  if (e != null)
  {
  Item f = m.Backpack.FindItemByType(typeof(UncleJohnsBook));
  if (f != null)
  {
  m.AddToBackpack(new DiamondHoopEarrings());
  a.Delete();
  b.Delete();
  c.Delete();
  d.Delete();
  e.Delete();
  f.Delete();
  m.SendMessage("You Combine the knowledge of Arriana's ancestry into a Heirloom");
  this.Delete();
  }
  }
  else
  {
  m.SendMessage("You are missing something...");
  }
  }
  }
  }
  }
  }
 
But I just added those to the script because I want them deleted... I just want them to be optional... like some kind of 'or' statement.
I want items a-d to be required... items e & f are deleted if there - but are not required to be there...
 
In that case you can use this
Code:
public override void OnDoubleClick(Mobile m)
{
	Item a = m.Backpack.FindItemByType(typeof(ArrianasDiamond));
	if (a != null)
	{
		Item b = m.Backpack.FindItemByType(typeof(ArrianasClips));
		if (b != null)
		{
			Item c = m.Backpack.FindItemByType(typeof(ArrianasHoops));
			if (c != null)
			{
				Item d = m.Backpack.FindItemByType(typeof(AncientJewelryBox));
				if (d != null)
				{
					m.AddToBackpack(new DiamondHoopEarrings());
					a.Delete();
					b.Delete();
					c.Delete();
					d.Delete();
					Item e = m.Backpack.FindItemByType(typeof(GrandpaTamsJournal));
					if (e != null)
					{
						e.Delete();
					}
					Item f = m.Backpack.FindItemByType(typeof(UncleJohnsBook));
					if (f != null)
					{
						f.Delete();
					}
					m.SendMessage("You Combine the knowledge of Arriana's ancestry into a Heirloom");
					this.Delete();
				}
				else
				{
					m.SendMessage("You are missing something...");
				}
			}
		}
	}
}
 
Cool, thanks I will give that a try :)

~Edit~
Ok I tried it with all the items and it worked great - gave me the quest item and deleted all 6 items. Then I tried it but was missing one book. It still worked - gave me the quest item and deleted the 5 items. Then I tried it but was missing one of the 3 jewelry pieces. The double click did nothing. Which is mostly right - I did not get the "You are missing something..." message... but I can live with that :)
 
Last edited:
Well I went with the inital design of the method so .. :p
Anyway here is one that will give you the message if one item is missing not just the last (not tested but .. should do it ;) )
Code:
public override void OnDoubleClick(Mobile m)
{
	Item a = m.Backpack.FindItemByType(typeof(ArrianasDiamond));
	if (a != null)
	{
		Item b = m.Backpack.FindItemByType(typeof(ArrianasClips));
		if (b != null)
		{
			Item c = m.Backpack.FindItemByType(typeof(ArrianasHoops));
			if (c != null)
			{
				Item d = m.Backpack.FindItemByType(typeof(AncientJewelryBox));
				if (d != null)
				{
					m.AddToBackpack(new DiamondHoopEarrings());
					a.Delete();
					b.Delete();
					c.Delete();
					d.Delete();
					Item e = m.Backpack.FindItemByType(typeof(GrandpaTamsJournal));
					if (e != null)
					{
						e.Delete();
					}
					Item f = m.Backpack.FindItemByType(typeof(UncleJohnsBook));
					if (f != null)
					{
						f.Delete();
					}
					m.SendMessage("You Combine the knowledge of Arriana's ancestry into a Heirloom");
					this.Delete();
					return;
				}
			}
		}
	}
	m.SendMessage("You are missing something...");
}
 
Back