the_hopkins
Wanderer
[RunUO 2.0 RC2] - Another Customizable SkillCheck.cs
A while back I downloaded a customizable skillcheck.cs by Goury that let you set the rate of skill gain individually for each skill. Upon starting fresh with RC2, I was going to install it, but saw that some people were having problems with stat gain. Devinticus released a version for RC2, but the rar file is corrupt, and some people were saying they were having trouble with stat gain on that one as well anyway. Plus Goury's original version altered the base GainFactor of the skills to change the rate of gain. I have no idea if anything else relies upon GainFactor, but I don't like the idea of changing it, so I decided to rewrite the script myself.
This one uses an array to store the skill gain rates rather than changing GainFactor. It doesn't have quite as complex a calculation system as Goury's, actually sticking to the original formula for the most part.
The changes are all in SkillCheck.cs:
Find:
Directly underneath add:
Find:
and add the following directly beneath:
Find:
Replace with:
Find:
Replace with:
And you're done. I've included a modded distro SkillCheck.cs, as well as an Excel file to make it easier to visualize what changing the values will do for you. Apologies for the ugliness of the spreadsheet; visual design is definitely not one of my talents. You can edit any of the variables introduced in this mod to see what results the changes have. They're the red text on a blue background. The spreadsheet is locked to prevent accidental changes to the formulas; only those variables that you can set in Skillcheck.cs may be edited. If you're going to make changes to the formulas in SkillCheck.cs and would like to update the spreadsheet to see your changes, simply unprotect it. The password is "password" (no quotes).
I just compiled and started my shard with no errors on a skillcheck.cs that I modded from distro following the above directions. Nevertheless, I haven't tested that one extensively (my default skillcheck.cs is rather heavily modded), so please don't hate me if you have errors. Particularly, if you've made any changes, any changes at all to the default RunUO installation, DON'T DRAG AND DROP THE INCLUDED SKILLCHECK.CS OVER YOUR OLD ONE. In addition, if you don't have RunUO 2.0 RC2, then DON'T DRAG AND DROP THE INCLUDED SKILLCHECK.CS OVER YOUR OLD ONE.
I highly recommend also adding the changes made at this post as well, for even greater customizable goodness. I've made a few changes to his code, but I don't want to hijack his mod, so I won't post it here. It's definitely worth looking at, though.
A while back I downloaded a customizable skillcheck.cs by Goury that let you set the rate of skill gain individually for each skill. Upon starting fresh with RC2, I was going to install it, but saw that some people were having problems with stat gain. Devinticus released a version for RC2, but the rar file is corrupt, and some people were saying they were having trouble with stat gain on that one as well anyway. Plus Goury's original version altered the base GainFactor of the skills to change the rate of gain. I have no idea if anything else relies upon GainFactor, but I don't like the idea of changing it, so I decided to rewrite the script myself.
This one uses an array to store the skill gain rates rather than changing GainFactor. It doesn't have quite as complex a calculation system as Goury's, actually sticking to the original formula for the most part.
The changes are all in SkillCheck.cs:
Find:
Code:
public class SkillCheck
{
private static readonly bool AntiMacroCode = !Core.ML; //Change this to false to disable anti-macro code
public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes( 5.0 ); //How long do we remember targets/locations?
public const int Allowance = 3; //How many times may we use the same location/target for gain
private const int LocationSize = 5; //The size of eeach location, make this smaller so players dont have to move as far
Code:
[COLOR="Olive"] private static double[] SkillGainRate = new double[55];
private static double SkillDivider1 = 10;
private static double SkillDivider2 = 5;
private static double StrDivider = 8;
private static double DexDivider = 8;
private static double IntDivider = 8;
[/COLOR]
Code:
public static void Initialize()
{
Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation );
Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation );
Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget );
Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget );
Code:
[COLOR="Olive"] //Scales gain rates proportionally
SkillGainRate[0] = 1.0;// Alchemy = 0,
SkillGainRate[1] = 1.0;// Anatomy = 1,
SkillGainRate[2] = 1.0;// AnimalLore = 2,
SkillGainRate[3] = 1.0;// ItemID = 3,
SkillGainRate[4] = 1.0;// ArmsLore = 4,
SkillGainRate[5] = 1.0;// Parry = 5,
SkillGainRate[6] = 1.0;// Begging = 6,
SkillGainRate[7] = 1.0;// Blacksmith = 7,
SkillGainRate[8] = 1.0;// Fletching = 8,
SkillGainRate[9] = 1.0;// Peacemaking = 9,
SkillGainRate[10] = 1.0;// Camping = 10,
SkillGainRate[11] = 1.0;// Carpentry = 11,
SkillGainRate[12] = 1.0;// Cartography = 12,
SkillGainRate[13] = 1.0;// Cooking = 13,
SkillGainRate[14] = 1.0;// DetectHidden = 14,
SkillGainRate[15] = 1.0;// Discordance = 15,
SkillGainRate[16] = 1.0;// EvalInt = 16,
SkillGainRate[17] = 1.0;// Healing = 17,
SkillGainRate[18] = 1.0;// Fishing = 18,
SkillGainRate[19] = 1.0;// Forensics = 19,
SkillGainRate[20] = 1.0;// Herding = 20,
SkillGainRate[21] = 1.0;// Hiding = 21,
SkillGainRate[22] = 1.0;// Provocation = 22,
SkillGainRate[23] = 1.0;// Inscribe = 23,
SkillGainRate[24] = 1.0;// Lockpicking = 24,
SkillGainRate[25] = 1.0;// Magery = 25,
SkillGainRate[26] = 1.0;// MagicResist = 26,
SkillGainRate[27] = 1.0;// Tactics = 27,
SkillGainRate[28] = 1.0;// Snooping = 28,
SkillGainRate[29] = 1.0;// Musicianship = 29,
SkillGainRate[30] = 1.0;// Poisoning = 30
SkillGainRate[31] = 1.0;// Archery = 31
SkillGainRate[32] = 1.0;// SpiritSpeak = 32
SkillGainRate[33] = 1.0;// Stealing = 33
SkillGainRate[34] = 1.0;// Tailoring = 34
SkillGainRate[35] = 1.0;// AnimalTaming = 35
SkillGainRate[36] = 1.0;// TasteID = 36
SkillGainRate[37] = 1.2;// Tinkering = 37
SkillGainRate[38] = 1.0;// Tracking = 38
SkillGainRate[39] = 1.0;// Veterinary = 39
SkillGainRate[40] = 1.0;// Swords = 40
SkillGainRate[41] = 1.0;// Macing = 41
SkillGainRate[42] = 1.0;// Fencing = 42
SkillGainRate[43] = 1.0;// Wrestling = 43
SkillGainRate[44] = 1.0;// Lumberjacking = 44
SkillGainRate[45] = 0.6;// Mining = 45
SkillGainRate[46] = 1.0;// Meditation = 46
SkillGainRate[47] = 1.0;// Stealth = 47
SkillGainRate[48] = 1.0;// RemoveTrap = 48
SkillGainRate[49] = 1.0;// Necromancy = 49
SkillGainRate[50] = 1.0;// Focus = 50
SkillGainRate[51] = 1.0;// Chivalry = 51
SkillGainRate[52] = 1.0;// Bushido = 52
SkillGainRate[53] = 1.0;// Ninjitsu = 53
SkillGainRate[54] = 1.0;// SpellWeaving = 54
[/COLOR]
Code:
gc += ( skill.Cap - skill.Base ) / skill.Cap;
gc /= 2;
gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );
gc /= 2;
gc *= skill.Info.GainFactor;
Code:
[COLOR="Olive"] gc += ( skill.Cap - skill.Base ) / skill.Cap;
gc /= SkillDivider1;
gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );
gc /= SkillDivider2;
gc *= SkillGainRate[skill.Info.SkillID];
[/COLOR]
Code:
if ( from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Str );
else if ( from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Dex );
else if ( from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Int );
Code:
[COLOR="Olive"] if ( from.StrLock == StatLockType.Up && (info.StrGain / StrDivider) > Utility.RandomDouble() )
GainStat( from, Stat.Str );
else if ( from.DexLock == StatLockType.Up && (info.DexGain / DexDivider) > Utility.RandomDouble() )
GainStat( from, Stat.Dex );
else if ( from.IntLock == StatLockType.Up && (info.IntGain / IntDivider) > Utility.RandomDouble() )
GainStat( from, Stat.Int );
[/COLOR]
And you're done. I've included a modded distro SkillCheck.cs, as well as an Excel file to make it easier to visualize what changing the values will do for you. Apologies for the ugliness of the spreadsheet; visual design is definitely not one of my talents. You can edit any of the variables introduced in this mod to see what results the changes have. They're the red text on a blue background. The spreadsheet is locked to prevent accidental changes to the formulas; only those variables that you can set in Skillcheck.cs may be edited. If you're going to make changes to the formulas in SkillCheck.cs and would like to update the spreadsheet to see your changes, simply unprotect it. The password is "password" (no quotes).
I just compiled and started my shard with no errors on a skillcheck.cs that I modded from distro following the above directions. Nevertheless, I haven't tested that one extensively (my default skillcheck.cs is rather heavily modded), so please don't hate me if you have errors. Particularly, if you've made any changes, any changes at all to the default RunUO installation, DON'T DRAG AND DROP THE INCLUDED SKILLCHECK.CS OVER YOUR OLD ONE. In addition, if you don't have RunUO 2.0 RC2, then DON'T DRAG AND DROP THE INCLUDED SKILLCHECK.CS OVER YOUR OLD ONE.
I highly recommend also adding the changes made at this post as well, for even greater customizable goodness. I've made a few changes to his code, but I don't want to hijack his mod, so I won't post it here. It's definitely worth looking at, though.