TheGodfather

Is the Mob Aggro range always so huge on ServUO? If i wanted to make it so you needed to be way closer to a mob to get aggro, where would I go about looking for that?

Also is there a way to slow regen on mobs during combat?


Thanks!
 
ServUO BaseCreature.cs
Code:
        public const int DefaultRangePerception = 16;
        public const int OldRangePerception = 10;

        public BaseCreature(AIType ai, FightMode mode, int iRangePerception, int iRangeFight, double dActiveSpeed, double dPassiveSpeed)
        {
            if (iRangePerception == OldRangePerception)
            {
                iRangePerception = DefaultRangePerception;
            }

ServUO reference monster:
public GiantSpider() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)

RunUO
Code:
public const int DefaultRangePerception = 16;
        public const int OldRangePerception = 10;

        public BaseCreature(AIType ai,
            FightMode mode,
            int iRangePerception,
            int iRangeFight,
            double dActiveSpeed,
            double dPassiveSpeed)
        {
            if ( iRangePerception == OldRangePerception )
                iRangePerception = DefaultRangePerception;

RunUO reference monster:
public GiantSpider() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I guessed you took RunUO as a reference for the range, but from what i could read, it seems to be the same.

I think you could simply comment those lines:
Code:
if (iRangePerception == OldRangePerception)
{
	iRangePerception = DefaultRangePerception;
}
Then they should have a different range when they respawn, which means you either have to let the current living creatures die naturally, or respawning them so the changes reflect.

Also, before respawning everything, test if it worked! :p
And make sure to do a backup save with the date/time and reason, to ensure you have no issues afterward.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

As for the regeneration, i would suggest you to take a look at RegenRates.cs
I would also take a look at the SpellHelper.cs for the in combat part, it has that:
Code:
        private static readonly TimeSpan CombatHeatDelay = TimeSpan.FromSeconds(30.0);
        private static readonly bool RestrictTravelCombat = true;

        public static bool CheckCombat(Mobile m)
        {
            if (!RestrictTravelCombat)
                return false;

            for (int i = 0; i < m.Aggressed.Count; ++i)
            {
                AggressorInfo info = m.Aggressed[i];

                if (info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay)
                    return true;
            }

            if (Core.Expansion == Expansion.AOS)
            {
                for (int i = 0; i < m.Aggressors.Count; ++i)
                {
                    AggressorInfo info = m.Aggressors[i];

                    if (info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay)
                        return true;
                }
            }

            return false;
        }

Which you could adapt to your code, so you could check if the creature has aggressors and aggresses anything, so be sur eto check if the creature is a BaseCreature and that it's !m.Player.
Avoid using the SpellHelper class in the regen class, to avoid mixing spells with something that isn't a spell.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I'm not entirely sure if those are the best solution, perhaps there are better alternatives, but atleast it's a start.
I hope it helped. Do not hesitate if you have difficulties or questions.
 
Im new to all this and would like to make certain monsters regen faster then normal i know its a public override but i can seem to find a monster that regs more then others to compair scripts
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back