ImaNewb

Member
ServUO Version
Publish Unknown
Ultima Expansion
None
Hello, I am trying to make a resource bag of potions but the expansion I'm using is set in UOR. Potions are non stackable so I can only get one of them to populate in a bag when I make the resource bag. Is there a way to add multiple non stackable items in the script without having to add the same item drop line multiple times? Here is the script.

C#:
using System;
using Server;
using Server.Items;

namespace Server.Items
{
    public class BagOfPots : Bag
    {
        [Constructable]
        public BagOfPots() : this(50)
        {
        }

        [Constructable]
        public BagOfPots( int amount )
        {
            DropItem( new GreaterAgilityPotion ( amount ) );
            DropItem( new GreaterCurePotion ( amount) );
            DropItem( new ExplosionPotion ( amount ) );
            DropItem( new GreaterHealPotion ( amount ) );
            DropItem( new GreaterPoisonPotion ( amount ) );
            DropItem( new GreaterStrengthPotion ( amount ) );
            DropItem( new NightSightPotion ( amount ) );
            DropItem( new TotalRefreshPotion  ( amount ) );
        }

        public BagOfPots( 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();
        }
    }
}
 
Last edited:
Use a for loop, but that can get ugly with lots of items and loops.
I understand its Ren. but if you aren't aiming at era accuracy (which this bag is not) then id recommend stackable pots.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back