1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Animal Loyalty HELP

Discussion in 'Script Support' started by xolilpeepxo, Oct 11, 2018.

  1. xolilpeepxo
    Offline

    xolilpeepxo New Member

    Joined:
    Mar 6, 2018
    Messages:
    5
    Likes Received:
    0
    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 );
    }
     
    #1 xolilpeepxo, Oct 11, 2018
    Last edited: Oct 11, 2018
  2. Neshoba
    Offline

    Neshoba Member

    Joined:
    Feb 1, 2016
    Messages:
    274
    Likes Received:
    15
    having same problem anybody make any headway on this ???
    edit on 11/3/18 discovered they weren't feeding pets :( imagine that
     
    #2 Neshoba, Oct 15, 2018
    Last edited: Nov 3, 2018
  3. Milva
    Offline

    Admin Moderator

    Joined:
    Mar 3, 2013
    Messages:
    3,926
    Likes Received:
    433
  4. zerodowned
    Offline

    Moderator ServUO Developer

    Joined:
    Jun 28, 2014
    Messages:
    1,730
    Likes Received:
    196
    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
     
Similar Threads: Animal Loyalty
Forum Title Date
Script Support FS taming bod system dont show animals needed. Dec 6, 2018
Archived Bug Reports Animal lore Gump bug Oct 6, 2018
Archived Bug Reports Animal Taming problems after latest SVN changes Jul 28, 2018
Bug Reports Tameable animals not spawning Jul 16, 2018
Archived Bug Reports Animal Training menu in EC Jul 12, 2018
Archived Bug Reports Animal Training - Poisoning and Poison Breath - publish 100 Jul 9, 2018
Archived Bug Reports Animal taming StatLossAfterTame doesn't work Jun 25, 2018