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!

Making Skill Gain Faster for One Skill than Others

This should be easy. Well that is what I thought until I started tinkering with it.

I am trying to make the skill gain for Healing faster that the usual speed set for the other skills (up to 80.0) and then be like all other skills after that.

I have been trying to do this with an edit to SkillCheck.cs and have tried many variations.

Does anyone see why I should be getting this error?

Here is the pesky error I get:

Code:
Errors:
 + Misc/SkillCheck.cs:
    CS1002: Line 184: ; expected

and . . here is the snip of SkillCheck.cs where the problem occurs:

Code:
public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance )
{
if ( from.Skills.Cap == 0 )
return false;

bool success = ( chance >= Utility.RandomDouble() );double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
gc += ( skill.Cap - skill.Base ) / skill.Cap;

// Change here  1 = exceedingly fast 10 = exceedingly slow

gc /= 2.50;

gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );

gc /= 2.50;

gc *= skill.Info.GainFactor;

if ( gc < 0.01 )
gc = 0.01;

if ( from is BaseCreature && ((BaseCreature)from).Controlled )
gc *= 2;

//**********************************************
// Try to make Healing Fast up to 80
// Line #184 Follows:
If (from.skill.Healing && from.skill.Base < 80.0)
Gain( from, skill );

return success;

//**********************************************

if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
Gain( from, skill );

return success;
}

As always - sharper eyes than mine appreciated.

Thx
 

Thagoras

Sorceror
bool success = ( chance >= Utility.RandomDouble() );double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
This looks all wrong.

( chance >= Utility.RandomDouble() ); <--- Um...what are you trying to do here? >= would be used in an If statement or some other thing where you're comparing variables. And more importantly, a bool can only be true or false.

Perhaps you tried to delete something or something got accidentally and you took out more than you wanted.

edit: derr....I should have checked the skillcheck.cs before commenting.
 
Another item you might consider: your "if" in line 184 is capitalized, and shouldn't be.

Well *doh* that helped but now I am getting this one.

Code:
Errors:
+ Misc/SkillCheck.cs:
    CS0117: Line 184: 'Server.Skill' does not contain a definition for 'Healing'

from this edit:

Code:
//**********************************************
// Try to make Healing Fast up to 80

if ( from.Alive && skill.Healing && skill.Base < 80.0 )
Gain( from, skill );

return success;

//**********************************************
 

Warmaster

Sorceror
It seems that it's not liking the term "Healing". I'm not certain of the syntax that is used and I'm not at my pc to check right now. I'd suggest you go back through your server.skills file to see exactly what the appropriate call would be. Maybe it's as simple as "skill.Heal". Again, I'm not certain of this though.
 
Yes this is a pesky syntax thing I'm sure.

Thx Thagoras but this gives me the identical error

Code:
//**********************************************
// Try to make Healing Fast up to 80

if ( from.Alive && skill.SkillName == Skill.Healing && skill.Base < 80.0 )
Gain( from, skill );

return success;

//**********************************************

I will look for skills file to see if I can learn anything there.

*bows*
 
Maybe?

if ( from.Alive && (skill.SkillName == SkillName.Healing) && skill.Base < 80.0 )

Bingo! Thank you Thagoras (Syntax is often a struggle of mine).

That compiled and also worked great. If anyone else wants to use this (for Healing or for other skills) you have to remove the "return success;" where I had it and put it at the end in order to allow the other skills a chance to increase as well.

Here is the code snip:

Code:
public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance )
{
if ( from.Skills.Cap == 0 )
return false;

bool success = ( chance >= Utility.RandomDouble() );
double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
gc += ( skill.Cap - skill.Base ) / skill.Cap;

// Change here  1 = exceedingly fast 10 = exceedingly slow

gc /= 2.50;

gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );

// Also change here  1 = exceedingly fast 10 = exceedingly slow

gc /= 2.50;

gc *= skill.Info.GainFactor;

if ( gc < 0.01 )
gc = 0.01;

if ( from is BaseCreature && ((BaseCreature)from).Controlled )
gc *= 2;

//**********************************************
// Make Healing Fast up to 80

if ( from.Alive && (skill.SkillName == SkillName.Healing) && skill.Base < 80.0 )
Gain( from, skill );

//**********************************************

if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
Gain( from, skill );

return success;

}
 
Top