So I'm going through quite a bit of problems. I have custom animals that require a minimum taming skill of 97.0, but we ran into a couple problems. Animal Loyalty, the pets listen but not for long their happiness seems to decrese at an increased rate. So i've been going through BaseCreature.cs



public virtual bool CheckControlChance( Mobile m )
{
if ( GetControlChance( m ) > Utility.RandomDouble() )
{
Loyalty += 1;
return true;
}

PlaySound( GetAngerSound() );

if ( Body.IsAnimal )
Animate( 10, 5, 1, true, false, 0 );
else if ( Body.IsMonster )
Animate( 18, 5, 1, true, false, 0 );

Loyalty -= 3;
return false;
}

public virtual bool CanBeControlledBy( Mobile m )
{
return ( GetControlChance( m ) > 0.0 );
}

public double GetControlChance( Mobile m )
{
return GetControlChance( m, false );
}

public virtual double GetControlChance( Mobile m, bool useBaseSkill )
{
if ( m_dMinTameSkill <= 29.1 || m_bSummoned || m.AccessLevel >= AccessLevel.GameMaster )
return 1.0;

double dMinTameSkill = m_dMinTameSkill;

if ( dMinTameSkill > -24.9 && Server.SkillHandlers.AnimalTaming.CheckMastery( m, this ) )
dMinTameSkill = -24.9;

int taming = (int)((useBaseSkill ? m.Skills[SkillName.AnimalTaming].Base : m.Skills[SkillName.AnimalTaming].Value ) * 10);
int lore = (int)((useBaseSkill ? m.Skills[SkillName.AnimalLore].Base : m.Skills[SkillName.AnimalLore].Value )* 10);
int bonus = 0, chance = 700;

if( Core.ML )
{
int SkillBonus = taming - (int)(dMinTameSkill * 10);
int LoreBonus = lore - (int)(dMinTameSkill * 10);

int SkillMod = 6, LoreMod = 6;

if( SkillBonus < 0 )
SkillMod = 28;
if( LoreBonus < 0 )
LoreMod = 14;

SkillBonus *= SkillMod;
LoreBonus *= LoreMod;

bonus = (SkillBonus + LoreBonus ) / 2;
}
else
{
int difficulty = (int)(dMinTameSkill * 10);
int weighted = ((taming * 4) + lore) / 5;
bonus = weighted - difficulty;

if ( bonus <= 0 )
bonus *= 14;
else
bonus *= 6;
}

chance += bonus;

if ( chance >= 0 && chance < 200 )
chance = 200;
else if ( chance > 990 )
chance = 990;

chance -= (MaxLoyalty - m_Loyalty) * 10;

return ( (double)chance / 1000 );
}
 
Last edited:
having same problem anybody make any headway on this ???
edit on 11/3/18 discovered they weren't feeding pets :( imagine that
 
Last edited:
i'm guessing based on the fact that it sounds like it the loyalty is decreasing rapidly that you mean this line:
https://github.com/ServUO/ServUO/blob/master/Scripts/Mobiles/Normal/BaseCreature.cs#L8408

since it is in the OnTick method which happens multiple times in a second or minute

along with the CheckControlChance method that you posted.

if you comment out both those lines I'm guessing it should achieve the result you're wanting without completing removing the loyalty decay
 
Back