Tukaram

Member
I found a quest online and was playing around with it. The reward is a "bag of strength". It is a 10 item, white, bag with no apparent additional properties. From reading the script I get the idea they are trying to make whatever you put in the bag have no weight.

Can someone take a look at the code and see what is it supposed to do/how do we make it work? :)

Code:
using System;

namespace Server.Items
{
  public class BagOfStrength : Bag
  {
  [Constructable]
     public BagOfStrength() : this(10)  // create a 10 item bag by default
     {
     }
     
     [Constructable]
     public BagOfStrength(int maxitems) : base()
     {
       Weight = 0.0;
       MaxItems = maxitems;
       Name = "Bag of Strength";
       Hue = 1153;
     }

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

     public override void GetProperties( ObjectPropertyList list )
  {

  base.GetProperties(list);

  list.Add( 1060658, "Item capacity\t{0}", MaxItems ); // ~1_val~: ~2_val~

  if(TotalWeight != 0)
  Timer.DelayCall( TimeSpan.Zero, new TimerCallback( InvalidateProperties ) );

  //TotalWeight = 0;

  }
  }
}
 
That is what I thought too from reading the script... but when I put items in it the weight stays normal. I was trying to see why it does not work - and how to fix it :)
 
I can email you our script if you give me your email.

I'm not a scripter so I can't debug it for you, but I can send you one that works.

I'm uploading the file as well as the quest we use to obtain the bag.

Hopefully I did this correctly and you'll see the files here.
 

Attachments

  • BagofStrength.cs
    1.1 KB · Views: 51
  • FrenziedBull.cs
    1.9 KB · Views: 19
  • Gastin.cs
    3.8 KB · Views: 18
  • GastinGump.cs
    3.3 KB · Views: 18
  • PrizedLeather.cs
    853 bytes · Views: 18
Last edited:
You could go ahead and upload it also to your post Dezzie :) Just click on edit and then More Options, Or post this in custom releases
 
Very cool, thanks. I see the problem with the one I downloaded. The one I downloaded has "public class BagOfStrength : Bag" This one is " public class BagOfStrength : BackpackOfReduction". Other than that they are virtually the same script. Many thanks :)
 
I would really like to be able to use this quest, because we are remaking a old server we used to play on and one of the quests was this. Well I think the bag of reduction does not work correctly with the new repo. It loads right but if you put a item in it, it just deletes the item... lol...

Does anyone have a fix for this? Or using it currently with a newer repo that can post the updates to it?

Thanks so much!
 
Try this one. It is compatible with the latest ServUO.

This version includes a chance that the bag will become degraded through use. This is done through a "number of flaws" in the bag, which will lower the effectiveness of the weight reduction by 1% per flaw. This random effect is checked each time an item is placed or dropped into the bag. The degradation % increases the chance of further degradation.

3 types of materials can be defined (at the top of the script) to heal the bag. Regular material will heal 1% per amount used. Better material will heal 1.5% per amount, and best material 2%. Healing materials are consumed when dropped onto (not into) the bag.

If you are using this with the above mentioned quest, you might want to make the best repair material the PrizedLeather. The default materials are HealPotion, StrengthPotion, and GreaterHealPotion.
 

Attachments

  • BagOfHolding.cs
    5.2 KB · Views: 40
Try this one. It is compatible with the latest ServUO.

This version includes a chance that the bag will become degraded through use. This is done through a "number of flaws" in the bag, which will lower the effectiveness of the weight reduction by 1% per flaw. This random effect is checked each time an item is placed or dropped into the bag. The degradation % increases the chance of further degradation.

3 types of materials can be defined (at the top of the script) to heal the bag. Regular material will heal 1% per amount used. Better material will heal 1.5% per amount, and best material 2%. Healing materials are consumed when dropped onto (not into) the bag.

If you are using this with the above mentioned quest, you might want to make the best repair material the PrizedLeather. The default materials are HealPotion, StrengthPotion, and GreaterHealPotion.

I did end up finding a way to fix it, thanks so much for posting this. It looks interesting for sure!
 
Thanks Lokai, that looks great, I'm going to add it to my server. I like the idea that of the flaws and healing the bag.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back