Hello,

I am looking to add some minor bonuses to some lesser used skills that have PvE application only. I'm not really sure where to begin with this in the code.

Here is my aim:

Anatomy skill provide an additional bonus of +1% Damage Reduction *PvE Only* per 10 points of skill. So at 100 Anatomy the player would receive a total 10% damage reduction from all PvE damage taken.

I'm really unsure how to make this happen. I've tried looking at some other Absorb/Damage reduction code, and looked at the anatomy skill but nothing makes sense yet - so any help would really be appreciated as I'm assuming it won't be an easy solution.

Thanks in advance!
 
I think you can do a mod on BaseCreature.cs
Maybe like this,not sure about the multiplier.
If it works,is an example you get a 10% damage reduction when you have 100.0 anatomy.You can add an mod more skill points like you want,10.0,20.0,30.0,etc...

C#:
public override void AlterMeleeDamageTo( Mobile to, ref int damage )
        {
            if ( to is PlayerMobile  )
            {
                Playermobile creature = (PlayerMobile)to;
                
                if( creature.Skills[SkillName.Anatomy].Base >= 100.0 )
                {
                    damage = damage / 0.010;  // Not sure about the multiplier
                }
             }
         base.AlterMeleeDamageTo( to, ref damage );
         }
public override void AlterSpellDamageTo( Mobile to, ref int damage )
        {
            if ( to is PlayerMobile  )
            {
                PlayerMobile creature = (Playermobile)to;
                
                if( creature.Skills[SkillName.Anatomy].Base >= 100.0 )
                {
                    damage = damage / 0.010;  // Not sure about the multiplier
                }
             }
         base.AlterSpellDamageTo( to, ref damage );
         }
 
This looks amazing! This would be exactly what I'm after. I tried inserting the provided code into BaseCreature.cs in various locations throughout the file but each time I was given various errors - does it belong in a specific place in the file? Here is the area I assumed to place it with the other AlterSpellDamageTo and AlterMeleeDamageTo code, and the errors associated at the bottom. The circled Red is the only thing I added to the code: 1590180160752.png
 
Humm,let me see,im using and older repo,pub 54,but see if you have this on the top of your script:

C#:
using System;
using Server;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Spells;
using Server.Misc;
using Server.Engines.CannedEvil;
This is from a standalone creature.
If the problem is cause im using an older repo,i hope anyone can update this code for you mate.
Post automatically merged:

And i see you got it twice "spelldamageto",delete the small one
 
Last edited:
Hmm I am using repo pub 57. Here is the top of BaseCreature.cs: 1590186432935.png
Post automatically merged:

I blanked out the other 2 lines of code that said "AlterSpellDamageTo" and "AlterMeleeDamageTo". Cut down a couple errors but I'm still suck at these 7 errors 1590189511163.png
 
Last edited:
You can not override a method from within the same class, so both the methods you are trying to add are invalid as is, you need to just add to the two methods directly.

The Playermobile error is Syntax, should be PlayerMobile

The covert double to int is caused by the Multiplier, you are left with a decimal, but need a int which takes whole numbers only! You'll need to covert the double to int before sending it out of the method!
 
Back