OP
Xeno
ServUO Version
Publish 57
Ultima Expansion
Time Of Legends
EDIT:
I ended up using ChatGTP 4.0 and was given better results. I got this to work. The only issue is that I can double click and use the potion even if not poisoned or low health. I know it is in this section that I need to fix it but not quite sure how.

C#:
public override void Drink(Mobile from)
{
    if (from.Poisoned || from.Hits < from.HitsMax)
    {
        if (from is PlayerMobile && from.Skills[SkillName.Alchemy].Base >= 100.0)
        {
            from.SendMessage("You feel a surge of vitality as the potion heals and cures you.");
        }

        from.CurePoison(from); // cure any poison
        from.Hits += Utility.RandomMinMax(45, 65); // heal for 45-65 health
        from.FixedParticles(0x375A, 9, 32, 5030, EffectLayer.Waist);
        from.PlaySound(0x1E0);

        BasePotion.PlayDrinkEffect(from);

        if (!Core.AOS)
        {
            from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
        }
    }
    else
    {
        from.SendMessage("You decide not to drink the potion right now.");
    }

    this.Consume();
}

It tells you that you decide not to drink the potion but right under that it says this.consume. I am guessing that I need something right under the send message line to tell it not to consume.
 

Attachments

  • medelatrial2.cs
    1.9 KB · Views: 1
Last edited:
First question. Is this only supposed to work if the player's Alchemy is GM?
IF so:
C#:
public override void Drink(Mobile from)
{
    if (from.Poisoned || from.Hits < from.HitsMax)
    {
        if (from is PlayerMobile && from.Skills[SkillName.Alchemy].Base >= 100.0)
        {
            from.SendMessage("You feel a surge of vitality as the potion heals and cures you.");

            from.CurePoison(from); // cure any poison

            from.Hits += Utility.RandomMinMax(45, 65); // heal for 45-65 health

            from.FixedParticles(0x375A, 9, 32, 5030, EffectLayer.Waist);

            from.PlaySound(0x1E0);

            BasePotion.PlayDrinkEffect(from);

            if (!Core.AOS)

            {

                from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);

            }

            this.Consume();
        }
        else
        {
            from.SendMessage("Your Alchemy skill is not high enough to use this potion.");
        }
    }
    else
    {
        from.SendMessage("You decide not to drink the potion right now.");
    }
}

But if it is supposed to work reguardless:
C#:
public override void Drink(Mobile from)
{
    if (from.Poisoned || from.Hits < from.HitsMax)
    {
        if (from is PlayerMobile && from.Skills[SkillName.Alchemy].Base >= 100.0) //This line is not needed if Alchemy doesn't have to be GM
            from.SendMessage("You feel a surge of vitality as the potion heals and cures you.");

        from.CurePoison(from); // cure any poison

        from.Hits += Utility.RandomMinMax(45, 65); // heal for 45-65 health

        from.FixedParticles(0x375A, 9, 32, 5030, EffectLayer.Waist);

        from.PlaySound(0x1E0);

        BasePotion.PlayDrinkEffect(from);

        if (!Core.AOS)

        {

            from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);

        }

        this.Consume();
    }
    else
    {
        from.SendMessage("You decide not to drink the potion right now.");
    }
}
 
To ne honest, I saw the alchemy portion there but did not pay attention to it since I was just trying to see if I could get my idea to come to life. I do not want or need the player to have alchemy to be able to use this potion. I am making a custom crafting idea and this is one of the items that will be made.

Works great, Thank you!
 
Last edited:
Back