Skill gain bonus area

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,771
225
Is there an existing script that creates skill gain bonuses in a specified area?
 

Vorspire

Vita-Nex: Core
Admin
ServUO Developer
Jul 29, 2013
1,145
250
32
United Kingdom
core.vita-nex.com
Shard Name
Ultima Shards: Multiverse
Donate
Donate money to this user
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
Reactions: zerodowned

PyrO

Well-Known Member
Jan 27, 2015
1,194
106
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
Reactions: zerodowned

RedBeard

Well-Known Member
May 19, 2013
382
74
48
Palm Beach Gardens, Florida USA
Shard Name
Virtus Imperium
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:
public static bool CheckSkill(Mobile from, Skill skill, object amObj, double chance)
        {
            if (from.Skills.Cap == 0)
                return false;
            //************* Halt Gains in Region Here if Skill above 80 ****************
           // if (from.Region == Region.Blackrock && skill.Base >= 80) //has to be set in regions.xml
            //if (from.Region.Name == "Blackrock Region" && skill.Base >= 80) //Custom Regions in a box method
          //  {
               // from.SendMessage("You can no longer gain in this skill on the Isle of Arete");
               // return false;
           // }
            //************** Make Gains Faster in Region if Skill under 80 *************
           // if (from.Region == Region.BlackrockRegion) // && skill.Base >= 80) //has to be set in regions.xml
            if (from.Region.IsPartOf(typeof(Regions.BlackrockRegion)))
            // if (from.Region.Name == "Blackrock Region" && skill.Base <= 80) //Custom Regions in a box method
            {
                bool success = (chance >= Utility.RandomDouble()); double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
                gc += (skill.Cap - skill.Base) / skill.Cap;
                gc /= 1.5;//25% Increase
                gc += (1.0 - chance) * (success ? 0.5 : (Core.AOS ? 0.0 : 0.2));
                gc /= 1.5;//25% Increase
                gc *= skill.Info.GainFactor;
                if (gc < 0.01)
                    gc = 0.01;
                if (from is BaseCreature && ((BaseCreature)from).Controlled)
                    gc *= 2;
                if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
                    Gain(from, skill);
                return success;
            }
            //******************* Make Gains Normal if not in Region *******************
            else
            {
                bool success = (chance >= Utility.RandomDouble()); double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
                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;
                if (gc < 0.01)
                    gc = 0.01;
                if (from is BaseCreature && ((BaseCreature)from).Controlled)
                    gc *= 2;
                if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
                    Gain(from, skill);
                return success;
            }
        }
Further down in SkillCheck.cs you'll find where Skill Gains can be adjusted
Code:
 public static void Gain(Mobile from, Skill skill)
        {
            if (from.Region.IsPartOf(typeof(Regions.Jail)))
                return;
            if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
                return;
            if (skill.SkillName == SkillName.Focus && from is BaseCreature)
                return;
            if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
            {
                int toGain = 1;
                #region Powerhour Testing
                if (PowerHour.On)   
                {
                    toGain = toGain * 2;
                    // Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
                }
                else if (!PowerHour.On) 
                {
                    toGain = toGain * 1;
                    // Console.WriteLine("This Is Your Total Gain:" + toGain); // Debug
                }
                #endregion
 
Last edited:

danielsheep

Member
Mar 19, 2018
15
0
40
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
I have finding scripts and advices for a week but nothing helpful.
Could you modify that script(in a box) for all ?
I tried several times before, my bad scripting could make it right.

In addition, xml spawner has a function 'skilltrigger' which look like controlling skill gain area. doesn't it?
I will wait for the positive reply.
Thanks always.
 

danielsheep

Member
Mar 19, 2018
15
0
40
Tell me what you are looking to accomplish.
I would like to make a region around of LUNA bank for boosting skill up(Skill gain bonus)
Both Xmlspawner and Custom region in a box don't have this fuctions.
That is why I ask you and I sincerely thank you if you can make it.
 

RedBeard

Well-Known Member
May 19, 2013
382
74
48
Palm Beach Gardens, Florida USA
Shard Name
Virtus Imperium
Skill Gain Region: Luna
luna skill region.jpg

Try this, it allows a 25% skill gain increase within the region. These scripts are based on the latest ServUO versions. Remember to backup all your original files before you overwrite. Then simply Drag & Drop. The thumbnail image will show the skill gain area outlined in red.

Please provide feedback, this wasn't tested.
 

Attachments

  • Like
Reactions: danielsheep

danielsheep

Member
Mar 19, 2018
15
0
40
Skill Gain Region: Luna
View attachment 14002

Try this, it allows a 25% skill gain increase within the region. These scripts are based on the latest ServUO versions. Remember to backup all your original files before you overwrite. Then simply Drag & Drop. The thumbnail image will show the skill gain area outlined in red.

Please provide feedback, this wasn't tested.
RedBeard, This script is compiling good.
Howerver, When players get the luna skill zone, nothing has been changed.
No message appeared.
Sould I add 'region.xml' into the oring script?
Thank you for your care :)
Post automatically merged:

Sorry, this script is working very good!
Thank you so much :)
 
Last edited:

RedBeard

Well-Known Member
May 19, 2013
382
74
48
Palm Beach Gardens, Florida USA
Shard Name
Virtus Imperium
RedBeard, This script is compiling good.
Howerver, When players get the luna skill zone, nothing has been changed.
No message appeared.
Sould I add 'region.xml' into the oring script?
Thank you for your care :)
Post automatically merged:

Sorry, this script is working very good!
Thank you so much :)
Overwrite your regions.xml with mine, or add this to yours.
Here is the part that needs to get added [@ line 2479]

<region type="LunaSkillRegion" priority="50" name="Luna">
<rect x="1011" y="515" width="8" height="19" />
<rect x="960" y="497" width="51" height="7" />
<rect x="952" y="504" width="16" height="13" />
<go x="1015" y="506" z="-70" />
<music name="tavern04" />
</region>
 
Last edited:

Dexter_Lexia

Moderator
ServUO Developer
Jul 3, 2014
3,995
175
43
Shard Name
Alexandria
Donate
Donate money to this user
Region.cs has a overridable Method called SkillGain(Mobile from), if this helps. This controls max skill gain and is 0.1 by default.
 
  • Like
Reactions: RedBeard

danielsheep

Member
Mar 19, 2018
15
0
40
Overwrite your regions.xml with mine, or add this to yours.
Here is the part that needs to get added [@ line 2479]

<region type="LunaSkillRegion" priority="50" name="Luna">
<rect x="1011" y="515" width="8" height="19" />
<rect x="960" y="497" width="51" height="7" />
<rect x="952" y="504" width="16" height="13" />
<go x="1015" y="506" z="-70" />
<music name="tavern04" />
</region>
I think this script might release the Luna guard zone. Guard doesn't appeard when player say "GUARD".
It could be useful for casting agressive magic spells.
But I would like to maintain the guard system.
Could you help little more?
Thanks.
 

RedBeard

Well-Known Member
May 19, 2013
382
74
48
Palm Beach Gardens, Florida USA
Shard Name
Virtus Imperium
I think this script might release the Luna guard zone. Guard doesn't appeard when player say "GUARD".
It could be useful for casting agressive magic spells.
But I would like to maintain the guard system.
Could you help little more?
Thanks.
Guards don't appear just because you call them. Drop an ancient wyrm or other evil creature there and see if guards whack it when it aggros a player.
 
Last edited:

danielsheep

Member
Mar 19, 2018
15
0
40
Guards don't appear just because you call them. Drop an ancient wyrm or other evil creature there and see if guards whack it when it aggros a player.
One of our players released his pet(a Giant beetle) at the Luna bank.
Then the giant beetle atacked a player near him. But guards doen't come.
 

RedBeard

Well-Known Member
May 19, 2013
382
74
48
Palm Beach Gardens, Florida USA
Shard Name
Virtus Imperium
One of our players released his pet(a Giant beetle) at the Luna bank.
Then the giant beetle atacked a player near him. But guards doen't come.
Try removing the priority. remove the red portion

<region type="LunaSkillRegion" priority="50" name="Luna">
<rect x="1011" y="515" width="8" height="19" />
<rect x="960" y="497" width="51" height="7" />
<rect x="952" y="504" width="16" height="13" />
<go x="1015" y="506" z="-70" />
<music name="tavern04" />
</region>
 

danielsheep

Member
Mar 19, 2018
15
0
40
Try removing the priority. remove the red portion

<region type="LunaSkillRegion" priority="50" name="Luna">
<rect x="1011" y="515" width="8" height="19" />
<rect x="960" y="497" width="51" height="7" />
<rect x="952" y="504" width="16" height="13" />
<go x="1015" y="506" z="-70" />
<music name="tavern04" />
</region>
Thank you so much Refbeard.
It was much easier because your help.
Have a great day! :)
 

danielsheep

Member
Mar 19, 2018
15
0
40
Try removing the priority. remove the red portion

<region type="LunaSkillRegion" priority="50" name="Luna">
<rect x="1011" y="515" width="8" height="19" />
<rect x="960" y="497" width="51" height="7" />
<rect x="952" y="504" width="16" height="13" />
<go x="1015" y="506" z="-70" />
<music name="tavern04" />
</region>
Removing red portion you mentioned is working for this. It was nothing to be changed.
Any other advises?