ServUO BaseCreature.cs
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
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:
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!
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:
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.