Help with errors on my playermobile file

Discussion in 'Script Support' started by InSanEMonK, Mar 20, 2017.

  1. InSanEMonK

    InSanEMonK Squire

    Messages:
    3
  2. Hammerhand

    Hammerhand Knight

    Messages:
    8,614
    Did you by any chance modify your PlayerMobile? Add in edits for a system or something?
  3. InSanEMonK

    InSanEMonK Squire

    Messages:
    3
    Well yes I do have someone helping me but he got confused here I can paste my file here if you like I think it may be edited but I am not sure.

    Attached Files:

  4. Hammerhand

    Hammerhand Knight

    Messages:
    8,614
    Yeah, yours is modified alright.
    1st, the government system is added in, at least partially.
    2nd, the section with the errors on 1188 & 1192 is different from a stock 2.4
    Yours
    Code:
            [CommandProperty( AccessLevel.GameMaster )]
            public override bool Hidden
            {
                get
                {
                    return base.Hidden;
                }
                set
                {
                    base.Hidden = value;
    
                    RemoveBuff( BuffIcon.Invisibility );    //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set
    
                    if( !Hidden )
                    {
                        RemoveBuff( BuffIcon.HidingAndOrStealth );
                    }
                    else// if( !InvisibilitySpell.HasTimer( this ) )
                    {
                        BuffInfo.AddBuff( this, new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );    //Hidden/Stealthing & You Are Hidden
                    }
                }
            }
    Stock
    Code:
            public override void OnHiddenChanged()
            {
                base.OnHiddenChanged();
    
                RemoveBuff(BuffIcon.Invisibility);    //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set
    
                if (!Hidden)
                {
                    RemoveBuff(BuffIcon.HidingAndOrStealth);
                }
                else// if( !InvisibilitySpell.HasTimer( this ) )
                {
                    BuffInfo.AddBuff(this, new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655));    //Hidden/Stealthing & You Are Hidden
                }
            }
    3rd, the error on 3673 shows differences from a stock 2.4 as well.
    Yours
    Code:
            #region Fastwalk Prevention
            private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
            private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.4 ); // Fastwalk prevention will become active after 0.4 seconds
    
            private DateTime m_NextMovementTime;
    
            public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } }
    
            public override TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning )
            {
                if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
                    return Mobile.RunMount;    // We are NOT actually moving (just a direction change)
    
                TransformContext context = TransformationSpellHelper.GetContext( this );
    
                if ( context != null && context.Type == typeof( ReaperFormSpell ) )
                    return Mobile.WalkFoot;
    
                bool running = ( (dir & Direction.Running) != 0 );
    
                bool onHorse = ( this.Mount != null );
    
                AnimalFormContext animalContext = AnimalForm.GetContext( this );
    
                if( onHorse || (animalContext != null && animalContext.SpeedBoost) )
                    return ( running ? Mobile.RunMount : Mobile.WalkMount );
    
                return ( running ? Mobile.RunFoot : Mobile.WalkFoot );
            }
    
            public static bool MovementThrottle_Callback( NetState ns )
            {
                PlayerMobile pm = ns.Mobile as PlayerMobile;
    
                if ( pm == null || !pm.UsesFastwalkPrevention )
                    return true;
    
                if ( pm.m_NextMovementTime == DateTime.MinValue )
                {
                    // has not yet moved
                    pm.m_NextMovementTime = DateTime.Now;
                    return true;
                }
    
                TimeSpan ts = pm.m_NextMovementTime - DateTime.Now;
    
                if ( ts < TimeSpan.Zero )
                {
                    // been a while since we've last moved
                    pm.m_NextMovementTime = DateTime.Now;
                    return true;
                }
    
                return ( ts < FastwalkThreshold );
            }
    
            #endregion
    Stock
    Code:
            #region Fastwalk Prevention
            private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
            private static int FastwalkThreshold = 400; // Fastwalk prevention will become active after 0.4 seconds
    
            private long m_NextMovementTime;
            private bool m_HasMoved;
    
            public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } }
    
            public override int ComputeMovementSpeed( Direction dir, bool checkTurning )
            {
                if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
                    return Mobile.RunMount;    // We are NOT actually moving (just a direction change)
    
                TransformContext context = TransformationSpellHelper.GetContext( this );
    
                if ( context != null && context.Type == typeof( ReaperFormSpell ) )
                    return Mobile.WalkFoot;
    
                bool running = ( (dir & Direction.Running) != 0 );
    
                bool onHorse = ( this.Mount != null );
    
                AnimalFormContext animalContext = AnimalForm.GetContext( this );
    
                if( onHorse || (animalContext != null && animalContext.SpeedBoost) )
                    return ( running ? Mobile.RunMount : Mobile.WalkMount );
    
                return ( running ? Mobile.RunFoot : Mobile.WalkFoot );
            }
    
            public static bool MovementThrottle_Callback( NetState ns )
            {
                PlayerMobile pm = ns.Mobile as PlayerMobile;
    
                if ( pm == null || !pm.UsesFastwalkPrevention )
                    return true;
    
                if ( !pm.m_HasMoved )
                {
                    // has not yet moved
                    pm.m_NextMovementTime = Core.TickCount;
                    pm.m_HasMoved = true;
                    return true;
                }
    
                long ts = pm.m_NextMovementTime - Core.TickCount;
    
                if ( ts < 0 )
                {
                    // been a while since we've last moved
                    pm.m_NextMovementTime = Core.TickCount;
                    return true;
                }
    
                return ( ts < FastwalkThreshold );
            }
    
            #endregion
    There are also several areas of coding that are missing from yours that are present in a stock 2.4.
  5. Hammerhand

    Hammerhand Knight

    Messages:
    8,614
    Your PlayerMobile actually matches up with RunUO ver 2.2, which is probably due to edits for the Government system. The error areas show as identical to 2.2.
    Oh, in the future, to make it easier for us to read console errors, right click on top border of the console, scroll down & click on Edit then click on Select All. Then click on the top border again, go to Edit & select Copy. Then just paste that into the code box on here. Its the section with the smiley, picture, film & piece of paper at the top of the text box where you type the message. Click on the right hand icon that looks like a piece of paper & select code. Much easier to read than a screen shot.
    Last edited: Mar 20, 2017

Share This Page