Is there an existing script that creates skill gain bonuses in a specified area?
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;
}
}
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
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
Tell me what you are looking to accomplish.
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.
Overwrite your regions.xml with mine, or add this to yours.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>
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.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.
Try removing the priority. remove the red portionOne 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>
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>
We use essential cookies to make this site work, and optional cookies to enhance your experience.