jayates

Member
I got a nice idea. It's a small crate that suppossedly cooks your Fish Steaks! It only gives out reg fish steaks though. I've got 3 different types set and it still only gives out regular ole' fish steaks... sheesh. Can someone take a look at the script and see why... cause i'm lost here. Thank you.

namespace Server.Items
{
public class FishInstaOven : Item
{
public override string DefaultName { get { return "Little Bit Fish Box"; }}

[Constructable]
public FishInstaOven() : base(2473) //small crate
{
Movable = false;
Hue = 2615;
}

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

private int CheckGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}

public override void OnDoubleClick(Mobile p)
{
var success = false;

if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RawFishSteak), 48, true, null, CheckGrouping)))
{
p.AddToBackpack(new FishSteak(48));
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigHalibutSteak), 48, true, null, CheckGrouping)))
{
p.AddToBackpack(new HalibutFishSteak(48));
}
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigFlukeSteak), 48, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlukeFishSteak(48));
}

if (success)
{
p.SendMessage(89, "You recieve 48 cooked Fish Steaks!");
p.Say ("Sizzle... sizzle... sizzle");
//Delete();
}
else
{
p.SendMessage(89, "This can only cook raw fish steaks... and 48 at once!");
}
}

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

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
 
Awesome, It's fixed and works great! Thank you for your help! But, I have a question is there a way to make this work "only" by having fish oil in my pack too for each instance? Here's my script:
namespace Server.Items
{
public class FishInstaOven : Item
{
public override string DefaultName { get { return "Little Bit Fish Box"; }}

[Constructable]
public FishInstaOven() : base(2473) //small crate
{
Movable = false;
Hue = 2615;
}

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

private int CheckGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}

public override void OnDoubleClick(Mobile p)
{
var success = false;

if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigHalibutSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new HalibutFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigSalmonSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new SalmonFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigTroutSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new TroutFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigParrotFishSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new ParrotFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RawRedSnapperSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new RedSnapperFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigMahiSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new MahiFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigFlukeSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlukeFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RawFishSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new FishSteak(12));
}

if (success)
{
p.SendMessage(89, "You recieve 12 cooked Fish Steaks!");
p.Say ("Sizzle... sizzle... sizzle");
Effects.PlaySound(p.Location, p.Map, 0x04B); // lever sound
//Delete();
}
else
{
p.SendMessage(89, "This can only cook raw fish steaks... and 12 at once!");
}
}

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

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
 
I added in a bit of code to where the Fish Oven has to have oil to produce the cooked fish steaks but, it doesn't recognise the bit of added in code. Can someone take a look at it? Here's the script:
namespace Server.Items
{
public class FishInstaOven : Item
{
public override string DefaultName { get { return "Little Bit Fish Box"; }}

[Constructable]
public FishInstaOven() : base(2473) //small crate
{
Movable = false;
Hue = 2615;
}

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

private int CheckGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}

public override void OnDoubleClick(Mobile p)
{
////added code////
Container pack = p.Backpack;

Item[] items = pack.FindItemsByType( typeof( FlaskOfOil ) );

if (items != null && items.Length > 0)
{
foreach (Item item in items)
item.Consume();
//// added code end////
}
var success = false;

if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigHalibutSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new HalibutFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigSalmonSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new SalmonFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigTroutSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new TroutFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigParrotFishSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new ParrotFishSteak(12));
}
//BigRedSnapperSteak
else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RawRedSnapperSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new RedSnapperFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigMahiSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new MahiFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(BigFlukeSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new FlukeFishSteak(12));
}

else if ((success = p.Backpack.ConsumeTotalGrouped(typeof(RawFishSteak), 12, true, null, CheckGrouping)))
{
p.AddToBackpack(new FishSteak(12));
}

if (success)
{
p.SendMessage(89, "You recieve 12 cooked Fish Steaks!");
p.Say ("Sizzle... sizzle... sizzle");
Effects.PlaySound(p.Location, p.Map, 0x04B); // lever sound
//Delete();
}
else
{
p.SendMessage(89, "This can only cook raw fish steaks... and 12 at once!");
}
}

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

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
Post automatically merged:

Sorry, I realised I need to reword the problem: The oven excepts the oil and the steaks, np. What i'm wanting it to do is if the oil ain't present in your pack then it won't produce the steaks.
 
Last edited:

Active Shards

Donations

Total amount
$80.00
Goal
$1,000.00
Back