Resists on a Spellbook?

Blood and Honey

Citizen
Apr 7, 2020
16
1
3
I am trying to put resists on a spellbook, and can't figure out how. (I've tried looking at BaseJewel.cs and SpellBook.cs and mirroring all resist code lines but no luck)

Here are the errors I am getting associated with each line that is trying to add resists:

1589840113095.png

C#:
using System;

using Server.Engines.Craft;

namespace Server.Items

{
    public class CwepBookGladiator : Spellbook
    {
        public override bool IsArtifact { get { return true; } }

        public override int BasePhysicalResistance{ get{ return 5; } }     // <-- CAN'T GET RESISTS TO WORK

        [Constructable]
        public CwepBookGladiator()
            : base()
        {
            Hue = 2639;
            Name = "Gladiator's Handbook";
            Attributes.BonusStr = 10; 
            WeaponAttributes.ResistFireBonus = 10;     // <-- CAN'T GET RESISTS TO WORK
            Resistances.Fire = 10;     // <-- CAN'T GET RESISTS TO WORK
        }

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

    }

}
 

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,815
241
63
line 12 remove Overide, the prompt is telling you there's no "public virtual int BasePhysicalResistance" in the inherited script: Spellbook

public int BasePhysicalResistance{ get{ return 5; } } // should compile but not actually work

what might work better as a basic workaround is to use an armor script and change the itemid to that of a spellbook and then use the armor resistance properties
if you do that then you'll need to keep the above as override
 
  • Like
Reactions: Blood and Honey

Blood and Honey

Citizen
Apr 7, 2020
16
1
3
Hmm I'll keep after it and utilize the workaround in the meantime. It would be nice to add resists in the spellbook code to prevent some glitches with the workaround but either way I appreciate the help!
 
  • Like
Reactions: zerodowned

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,815
241
63
np and yes changing the itemID would cause issues. mainly with layers and equipping stuff and the book might not open or something else
 
  • Like
Reactions: Blood and Honey