1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skill gain bonus area

Discussion in 'General Discussion' started by zerodowned, Dec 16, 2017.

  1. zerodowned
    Offline

    Moderator ServUO Developer

    Joined:
    Jun 28, 2014
    Messages:
    1,608
    Likes Received:
    190
    Is there an existing script that creates skill gain bonuses in a specified area?
     
  2. Vorspire
    Offline

    Vorspire Vita-Nex: Core
    Admin ServUO Developer

    Joined:
    Jul 29, 2013
    Messages:
    928
    Likes Received:
    165
    The best thing I've found for this is to just modify the Custom Regions (In A Box) Region Controller to support a new property for this reason, otherwise you could implement something in BaseRegion that loads a value from the Regions.xml
     
    • Like Like x 1
  3. PyrO
    Online

    PyrO Active Member

    Joined:
    Jan 27, 2015
    Messages:
    772
    Likes Received:
    39
    You could also look at the new haven beginner quests how they handle the accelerated skill gain unless you just want to increase the gain chance. Then I guess I would do that in the SkillCheck.cs (I think)
     
    • Like Like x 1
  4. RedBeard
    Offline

    RedBeard Active Member

    Joined:
    May 19, 2013
    Messages:
    370
    Likes Received:
    73
    I made one based on skill-chance-> here is method using older Svn scripts <Sept. 2014> if anyone interested.
    SkillCheck.cs (Showing both region methods)
    Code (C#):
    1.  
    2. public static bool CheckSkill(Mobile from, Skill skill, object amObj, double chance)
    3.         {
    4.             if (from.Skills.Cap == 0)
    5.                 return false;
    6.             //************* Halt Gains in Region Here if Skill above 80 ****************
    7.            // if (from.Region == Region.Blackrock && skill.Base >= 80) //has to be set in regions.xml
    8.             //if (from.Region.Name == "Blackrock Region" && skill.Base >= 80) //Custom Regions in a box method
    9.           //  {
    10.                // from.SendMessage("You can no longer gain in this skill on the Isle of Arete");
    11.                // return false;
    12.            // }
    13.             //************** Make Gains Faster in Region if Skill under 80 *************
    14.            // if (from.Region == Region.BlackrockRegion) // && skill.Base >= 80) //has to be set in regions.xml
    15.             if (from.Region.IsPartOf(typeof(Regions.BlackrockRegion)))
    16.             // if (from.Region.Name == "Blackrock Region" && skill.Base <= 80) //Custom Regions in a box method
    17.             {
    18.                 bool success = (chance >= Utility.RandomDouble()); double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
    19.                 gc += (skill.Cap - skill.Base) / skill.Cap;
    20.                 gc /= 1.5;//25% Increase
    21.                 gc += (1.0 - chance) * (success ? 0.5 : (Core.AOS ? 0.0 : 0.2));
    22.                 gc /= 1.5;//25% Increase
    23.                 gc *= skill.Info.GainFactor;
    24.                 if (gc < 0.01)
    25.                     gc = 0.01;
    26.                 if (from is BaseCreature && ((BaseCreature)from).Controlled)
    27.                     gc *= 2;
    28.                 if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
    29.                     Gain(from, skill);
    30.                 return success;
    31.             }
    32.             //******************* Make Gains Normal if not in Region *******************
    33.             else
    34.             {
    35.                 bool success = (chance >= Utility.RandomDouble()); double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
    36.                 gc += (skill.Cap - skill.Base) / skill.Cap;
    37.                 gc /= 2;
    38.                 gc += (1.0 - chance) * (success ? 0.5 : (Core.AOS ? 0.0 : 0.2));
    39.                 gc /= 2;
    40.                 gc *= skill.Info.GainFactor;
    41.                 if (gc < 0.01)
    42.                     gc = 0.01;
    43.                 if (from is BaseCreature && ((BaseCreature)from).Controlled)
    44.                     gc *= 2;
    45.                 if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
    46.                     Gain(from, skill);
    47.                 return success;
    48.             }
    49.         }
    50.  
    Further down in SkillCheck.cs you'll find where Skill Gains can be adjusted
    Code (C#):
    1.  
    2.  public static void Gain(Mobile from, Skill skill)
    3.         {
    4.             if (from.Region.IsPartOf(typeof(Regions.Jail)))
    5.                 return;
    6.             if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
    7.                 return;
    8.             if (skill.SkillName == SkillName.Focus && from is BaseCreature)
    9.                 return;
    10.             if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
    11.             {
    12.                 int toGain = 1;
    13.                 #region Powerhour Testing
    14.                 if (PowerHour.On)  
    15.                 {
    16.                     toGain = toGain * 2;
    17.                     // Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
    18.                 }
    19.                 else if (!PowerHour.On)
    20.                 {
    21.                     toGain = toGain * 1;
    22.                     // Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
    23.                 }
    24.                 #endregion
    25.  
     
    #4 RedBeard, Jan 14, 2018
    Last edited: Jan 14, 2018
    • Two Thumbs Up Two Thumbs Up x 2
Similar Threads: Skill gain
Forum Title Date
Archived Bug Reports Crafting Skill gain on Repair Nov 23, 2017
Archived Bug Reports Lobster traps should allow you to gain fishing skill Oct 16, 2017
Archived Bug Reports Pet skill gain seems to be bugged when trying to gain back over 100 in a skill May 13, 2017
Archived Bug Reports Chivalry Skill Gain Problem Jan 16, 2017
Archived Bug Reports Missing Fishing Skill Gains Aug 20, 2016
Archived Bug Reports Seems like skill gains are disabled on my server? Jun 18, 2016
Script Support Imbuing not allowing skill gain May 21, 2016