ServUO Version
Publish 57
Ultima Expansion
Endless Journey
So trying to use animal loyalty in basecreature to show the level under the animal however it only displays it as an int, is there a way to convert that to text and also does anyone know the level at which each stage drops?
 
So for anyone curious or runs into the same problem as me, I was able to find a piece of code in the Pet Training Gump, of which I took and changed to show the loyalty of the creature :)

C#:
list.Add(1060659, "Loyalty\t{0}", ((this.m_Loyalty == 0) ? 1061643 : 1049595 + (this.m_Loyalty / 10)));
 
Where did you end up putting this? Do you have screenshots showing the results? I'm still in the process of fixing the pet loyalty timers...Pets are just abandoning owners after an hour or even before sometimes.
 
In the AddNameProperties of BaseCreature.cs, note I do have some other mods in here as well.
1648938502816.png
C#:
        public override void AddNameProperties(ObjectPropertyList list)
        {
            base.AddNameProperties(list);
            
            #region FS:ATS Edits
            if ( this.Tamable == true && FSATS.EnablePetBreeding == true )
            {
                bool nolevel = false;
                Type typ = this.GetType();
                string nam = typ.Name;

                foreach ( string check in FSATS.NoLevelCreatures )
                {
                      if ( check == nam )
                            nolevel = true;
                }

                if ( nolevel != true )
                {
                    if ( this.Female == true )
                        list.Add( 1060658, "Gender\tFemale" );
                    else
                        list.Add( 1060658, "Gender\tMale" );

                    #region Iomega0318 FS Edits
                    if ( this.Controlled == false )
                        list.Add( 1060659, "Max Level\t{0}", this.MaxLevel );
                    else
                    {
                        list.Add(1060659, "Level\t{0}/{1}", this.m_Level, this.MaxLevel);
                        list.Add(1060659, "Loyalty\t{0}", ((this.m_Loyalty == 0) ? 1061643 : 1049595 + (this.m_Loyalty / 10)));
                    }
                    #endregion
                }
            }
            #endregion

            if (Controlled && !String.IsNullOrEmpty(EngravedText))
            {
                list.Add(1157315, EngravedText); // <BASEFONT COLOR=#668cff>Branded: ~1_VAL~<BASEFONT COLOR=#FFFFFF>
            }

            if (Core.ML)
            {
                if (DisplayWeight)
                {
                    list.Add(TotalWeight == 1 ? 1072788 : 1072789, TotalWeight.ToString()); // Weight: ~1_WEIGHT~ stones
                }

                if (m_ControlOrder == OrderType.Guard)
                {
                    list.Add(1060659, "Status\tGuarding"); //list.Add(1080078); // guarding
                }
            }

            if (Summoned && !IsAnimatedDead && !IsNecroFamiliar && !(this is Clone))
            {
                list.Add(1060659, "Status\tSummoned"); //list.Add(1049646); // (summoned)
            }
            else if (Controlled && Commandable)
            {
                if (this is BaseHire)
                {
                    list.Add(1060659, "Status\tHired"); //list.Add(1062030); // (hired)
                }
                else if (IsBonded) //Intentional difference (showing ONLY bonded when bonded instead of bonded & tame)
                {
                    list.Add(1060659, "Status\tBonded"); //list.Add(1049608); // (bonded)
                }
                else
                {
                    list.Add(1060659, "Status\tTame"); //list.Add(502006); // (tame)
                }
            }

            if (IsSoulbound)
            {
                list.Add(1159188); // <BASEFONT COLOR=#FF8300>Soulbound<BASEFONT COLOR=#FFFFFF>
            }

            if (IsAmbusher)
                list.Add(1155480); // Ambusher
        }
 
  • Like
Reactions: Cad
Back