RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Help with armour sets system

MrBurston

Traveler
ok i have a set system that gives bonus str,dex,int when a full set is equipped but!

im having a problem when it comes to bonus resists (cold,physical,fire,energy)

heres the mod code

Code:
#region Header
// File:        ResistModBonus.cs
// Author:        Vorspire
// License:        The MIT License (MIT)
// Copyright:    (c) 2013, Vita-Nex | http://www.vita-nex.com
//
// Created:        10/04/2012 @ 03:58
// Edited:        01/13/2013 @ 03:48
#endregion
 
#region References
using System;
 
using Server;
 
#endregion
 
namespace VitaNex.Modules.EquipmentSets
{
    public class ResistSetMod : EquipmentSetMod
    {
        private TimeSpan _Duration = TimeSpan.Zero;
        private int _Offset;
        private ResistanceType _Resist = ResistanceType.All;
 
        public ResistSetMod()
            : this(1)
        { }
 
        public ResistSetMod(int partsReq)
            : this(partsReq, true)
        { }
 
        public ResistSetMod(int partsReq, bool display)
            : this(partsReq, display, ResistanceType.All)
        { }
 
        public ResistSetMod(int partsReq, bool display, ResistanceType Resist)
            : this(partsReq, display, Resist, 1)
        { }
 
        public ResistSetMod(int partsReq, bool display, ResistanceType Resist, int offset)
            : this(partsReq, display, Resist, offset, TimeSpan.Zero)
        { }
 
        public ResistSetMod(int partsReq, bool display, ResistanceType Resist, int offset, TimeSpan duration)
            : base("Resist-Mod", String.Empty, partsReq, display)
        {
            _Resist = Resist;
            _Offset = offset;
            _Duration = duration;
 
            InvalidateBlurb();
        }
 
        public ResistSetMod(GenericReader reader)
            : base(reader)
        { }
 
        [CommandProperty(EquipmentSets.Access)]
        public virtual ResistanceType Resist
        {
            get { return _Resist; }
            set
            {
                _Resist = value;
                InvalidateBlurb();
            }
        }
 
        [CommandProperty(EquipmentSets.Access)]
        public virtual int Offset
        {
            get { return _Offset; }
            set
            {
                _Offset = value;
                InvalidateBlurb();
            }
        }
 
        [CommandProperty(EquipmentSets.Access)]
        public virtual TimeSpan Duration
        {
            get { return _Duration; }
            set
            {
                _Duration = value;
                InvalidateBlurb();
            }
        }
 
        public virtual string InternalName { get { return String.Format("{0} [{1}][{2}][{3}]", Name, _Resist, _Offset, (int)_Duration.TotalSeconds); } }
 
        public virtual void InvalidateBlurb()
        {
            string ResistName = String.Empty;
 
            switch (_Resist)
            {
                case ResistanceType.All:
                    ResistName = "All Resists";
                    break;
                case ResistanceType.BaseFireResistance:
                    ResistName = "Fire";
                    break;
                case ResistanceType.BasePoisonResistance:
                    ResistName = "Poison";
                    break;
                case ResistanceType.BaseEnergyResistance:
                    ResistName = "Energy";
                    break;
                case ResistanceType.BaseColdResistance:
                    ResistName = "Cold";
                    break;
                case ResistanceType.BasePhysicalResistance:
                    ResistName = "Physical";
                    break;
            }
 
            if (_Duration > TimeSpan.Zero)
            {
                Blurb = String.Format(
                    "Increases {0} By {1} for {2}",
                    ResistName,
                    _Offset,
                    new DateTime(_Duration.Ticks).ToString("hh:mm:ss"));
            }
            else
            {
                Blurb = String.Format("Increases {0} By {1}", ResistName, _Offset);
            }
        }
 
        public override void OnActivate(Mobile m, EquipmentSetPart[] equipped)
        {
            string name = InternalName;
 
            if (m.GetResistMod(name) == null)
            {
                m.AddResistMod(new ResistMod(_Resist, name, _Offset, _Duration));
            }
        }
 
        public override void OnDeactivate(Mobile m, EquipmentSetPart[] equipped)
        {
            string name = InternalName;
 
            if (m.GetResistMod(name) != null)
            {
                m.RemoveResistMod(name);
            }
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            int version = writer.SetVersion(0);
 
            switch (version)
            {
                case 0:
                    {
                        writer.WriteFlag(_Resist);
                        writer.Write(_Offset);
                        writer.Write(_Duration);
                    }
                    break;
            }
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
 
            switch (version)
            {
                case 0:
                    {
                        _Resist = reader.ReadFlag<ResistanceType>();
                        _Offset = reader.ReadInt();
                        _Duration = reader.ReadTimeSpan();
                    }
                    break;
            }
        }
    }
}

and heres the error i get (see uploaded file)
 

Attachments

  • error.png
    40.7 KB · Views: 4

ThatDudeJBob

Sorceror
Take a look at the Virtue Armor Set.
  • Compassion Arms
  • Honesty Gorget
  • Honor Legs
  • Humility Cloak
  • Justice Breastplate
  • Sacrifice Sollerets
  • Spirituality Helm
  • Valor Gauntlets
C#:
        [Constructable]
        public ValorGauntlets()
            : base(0x2B0C)
        {
            this.LootType = LootType.Blessed;
            this.Weight = 4.0;
            this.SetHue = 0;
            this.Hue = 0x226;
         
            this.SetSelfRepair = 5;
         
            this.SetPhysicalBonus = 5;
            this.SetFireBonus = 5;
            this.SetColdBonus = 5;
            this.SetPoisonBonus = 5;
            this.SetEnergyBonus = 5;
        }
 
        public ValorGauntlets(Serial serial)
            : base(serial)
        {
        }
 
        public override int LabelNumber
        {
            get
            {
                return 1075238;
            }
        }// Gauntlets of Valor (Virtue Armor Set)
        public override SetItem SetID
        {
            get
            {
                return SetItem.Virtue;
            }
        }
        public override int Pieces
        {
            get
            {
                return 8;
            }
        }
        public override int BasePhysicalResistance
        {
            get
            {
                return 6;
            }
        }
        public override int BaseFireResistance
        {
            get
            {
                return 6;
            }
        }
        public override int BaseColdResistance
        {
            get
            {
                return 8;
            }
        }
        public override int BasePoisonResistance
        {
            get
            {
                return 9;
            }
        }
        public override int BaseEnergyResistance
        {
            get
            {
                return 6;
            }
        }
 

MrBurston

Traveler
I have got the stat mod working (str,dex,int)

Would anyone be able to modify it for me to work with all resistances? (physical,fire,poison,cold,energy)

If anyone can, credits will be given on the server website once it goes live.
 

Attachments

  • StatModBonus.cs
    3.7 KB · Views: 1
  • Mobile.cs
    255.3 KB · Views: 0

Vorspire

Knight
In order to add resistances to the VNc Equipment Sets module, you have to create a new EquipmentSetMod, take a look at StatSetMod, copy it and rename it to ResistanceSetMod for a starting point - make necessary edits to support resistances instead of stats.

C#:
public class StatSetMod : EquipmentSetMod

Then you can use it in the set definitions.

The major advantage to the Equipment Sets module is that you don't have to edit individual items to include them in the set.
With the stock ML sets, you have to edit each piece and make sure their applicable set bonuses are exactly the same.
These are two completely different systems.
 

MrBurston

Traveler
I started by copying the statmodbonus.sc and replaced all the "stat" text with Resistance

change str,dex,int to physical,fire,poison and added 2 more for Cold,Energy.

I then duplicated the stat bits within Mobile.cs and changed them to Resistance.

but will still getting

'server.mobile' does not contain a definition for GetResistanceMod, even tho i had added it to mobile.cs
 

Vorspire

Knight
If you edited Mobile.cs - you'll have to recompile your core before that error will go away, since the new code doesn't exist in the currently compiled RunUO.exe
 

MrBurston

Traveler
Ahhhh. that is where I was going wrong then. I shall re-compile and try again then. Thanks Vorspire, will try and post back with an update.
 

MrBurston

Traveler
For some reason the compiler wont let me recompile for framework 4.0

I get "2 was unexpected at this time" and the compiler closes
 

MrBurston

Traveler
check out the images,

compiler > Option > Error
 

Attachments

  • compiler.png
    55.6 KB · Views: 4
  • option.png
    5.4 KB · Views: 5
  • error.png
    15.9 KB · Views: 4
Top