Opywang

Member
I've got a bag that drop 5 recipe, but it's too small, and it takes forever to find the rare recipe so I want to increase the amount that drop in a bag instead of 5 it'll be 50.

I've tried this, and it didn't work so if anybody got any idea how to fix them then it'll be wonderful!
DropItem( Reward.FletcherRecipe(10));
DropItem(Reward.TailorRecipe(10));
DropItem(Reward.SmithRecipe(10));
DropItem(Reward.TinkerRecipe(10));
DropItem(Reward.CarpRecipe(10));




//Redsnow
using System;
using Server;
using Server.Items;
using Server.Engines.Quests;
using Reward = Server.Engines.Quests.BaseReward;

namespace Server.Items
{
public class Recipebag : Bag
{
[Constructable]
public Recipebag(): this(1)
{
//Movable = true;
Hue = 1163;
Name = "Random Recipe bag";
}

[Constructable]
public Recipebag( int amount )
{

DropItem( Reward.FletcherRecipe());
DropItem(Reward.TailorRecipe());
DropItem(Reward.SmithRecipe());
DropItem(Reward.TinkerRecipe());
DropItem(Reward.CarpRecipe());

}

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

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

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}
}
}
 
O.K. well I've solve the problem all I had to do was copy, and paste this 10 times, but if anybody know a better way I'll still appreciate it lol.
 
I think this would be the better way ;)

Code:
[Constructable]
public Recipebag(): this(1)
{
}

[Constructable]
public Recipebag( int amount )
{
	Hue = 1163;
	Name = "Random Recipe bag";
	for(int i = 0; i < amount; i++)
	{
		DropItem(Reward.FletcherRecipe());
		DropItem(Reward.TailorRecipe());
		DropItem(Reward.SmithRecipe());
		DropItem(Reward.TinkerRecipe());
		DropItem(Reward.CarpRecipe());
	}
}
 
O.K. it fail what did you mean? This is the error, and this is the new notepad I tried to add.

https://gyazo.com/9bf5f289f2ca537c1e3e01228412c2f8


Code (C#):
[Constructable]
public Recipebag2(): this(1)
{
}

[Constructable]
public Recipebag2( int amount )
{
Hue = 1163;
Name = "Random Recipe bag";
for(int i = 0; i < amount; i++)
{

DropItem(Reward.TinkerRecipe(100));

}
}
 
Can you show the whole item file? since there is something wrong with it. Like you wrote namespace without a name and I dont know. :D
 
Try
Code:
       [Constructable]
   public Recipebag2(): this(50)
        {
      Hue = 1163;
        }
      [Constructable]
  public Random Recipe Bag( int amount )
       {
           int i;
           for ( i = 0; i < 50; i++ )
           {
              DropItem(Reward.FletcherRecipe());
              DropItem(Reward.TailorRecipe());
              DropItem(Reward.SmithRecipe());
              DropItem(Reward.TinkerRecipe());
              DropItem(Reward.CarpRecipe());
           }

       }
 
That will not work at all.
Thats not how you write a constructor, nor is moving Hue into the default Constructor a good choice if it still calls the one with the amount that would be called in every case.
 
LOL, you didnt write in the namespace, thats why you got the errors. Those posting the code probably assumed you'd figure that out. You may have been too busy critiquing his constructor methods.
 
@Dexter_Lexia you mean me? ^^

Because in that case you wouldnt need a namespace to compile, Random Recipe Bag is not the class name and is invalid since it is 3 words, he removed the amount variable from the loop, no hues on custom amounts and the bag is not named anymore.

I am not trying to make him feel bad, just stating it is faulty code.

What I suspect is happening to @Opywang is that he added the "Code (C#):" and that he actually posted the whole randomrecipebag.cs there
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back