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

Help with my script please.

Discussion in 'Script Support' started by Nytewyrm, Jun 5, 2014.

  1. Nytewyrm
    Offline

    Nytewyrm New Member

    Joined:
    Jun 3, 2014
    Messages:
    23
    Likes Received:
    0
    So i have been trying to figure out how to get some addon's to work with my shard, however i have ran into 2 of them that have the same exact problem. For my playermobile.cs file. I am no good at scripting i did add a () to it which made it sorta better so at the bottom i posted the whole script and the part where i think my problem is the problem lines are 1134, 1138 and 3490

    S0506: Line 1134: 'Server.Mobiles.PlayerMobile.Hidden.get': cannot override inherited member 'Server.Mobile.Hidden.get' because it is not marked virtual,abstract, or override

    CS0506: Line 1138: 'Server.Mobiles.PlayerMobile.Hidden.set': cannot override inherited member 'Server.Mobile.Hidden.set' because it is not marked virtual,abstract, or override

    This is where i think the problem is

    Code (C#):
    1.         public override bool Hidden
    2.         {
    3.             get
    4.             {
    5.                 return base.Hidden;
    6.             }
    7.             set
    8.             {
    9.                 base.Hidden = value;
    10.  
    11.                 RemoveBuff( BuffIcon.Invisibility );    //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set
    12.  
    13.                 if( !Hidden )
    14.                 {
    15.                     RemoveBuff( BuffIcon.HidingAndOrStealth );
    16.                 }
    17.                 else //if( !InvisibilitySpell.HasTimer( this ) )
    18.                 {
    19.                     BuffInfo.AddBuff( this, new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) ); //Hidden/Stealthing & You Are Hidden
    20.                 }
    21.             }
    22.         }
    23.  
    I have also attached my whole playermobile.cs file if anyone wants to see if they can figure out this problem i am no script master and can not so far when i add in the () it changes the output of the code.
     

    Attached Files:

    #1 Nytewyrm, Jun 5, 2014
    Last edited: Jun 5, 2014
  2. Crome969
    Offline

    Crome969 Member

    Joined:
    Jan 9, 2014
    Messages:
    195
    Likes Received:
    20
    The class Playermobile inherits hasnt marked this property as virtual. So you canĀ“t override whats not setted to be overridable.
     
  3. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    Remove that and try it this way:

    Code (C#):
    1.  
    2. public override void OnHiddenChanged()
    3. {
    4.     base.OnHiddenChanged();
    5.  
    6.     RemoveBuff(BuffIcon.Invisibility);
    7.     //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set
    8.  
    9.     if (!Hidden)
    10.     {
    11.         RemoveBuff(BuffIcon.HidingAndOrStealth);
    12.     }
    13.     else // if( !InvisibilitySpell.HasTimer( this ) )
    14.     {
    15.         BuffInfo.AddBuff(this, new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655));         //Hidden/Stealthing & You Are Hidden
    16.     }
    17. }
    18.  
     
  4. Nytewyrm
    Offline

    Nytewyrm New Member

    Joined:
    Jun 3, 2014
    Messages:
    23
    Likes Received:
    0
    Cool, Thank you Ravenwolfe that did work for those lines however im still stuck with the last line which is line 3490 the problem it is giving me is

    CS0508: Line 3483: 'Server.Mobile.PlayerMobile.ComputeMovementSpeed(server.direction, bool)': return type must be ' int' to match overridden member 'Server.mobile.ComputeMovementSpeed(Server.Direction, bool)'

    So would i just change out the bool part to int to override. Also can anyone tell me a good site or something i could use to learn scripting? if i get this part fixed ill be done messing around for a while i think.
     
  5. Nytewyrm
    Offline

    Nytewyrm New Member

    Joined:
    Jun 3, 2014
    Messages:
    23
    Likes Received:
    0
    So this block is giving me the last problems of this script I am just not sure

    Code (C#):
    1.         public override TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning )
    2.         {
    3.             if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
    4.                 return Mobile.RunMount; // We are NOT actually moving (just a direction change)
    5.  
    6.             TransformContext context = TransformationSpellHelper.GetContext( this );
    7.  
    8.             if ( context != null && context.Type == typeof( ReaperFormSpell ) )
    9.                 return Mobile.WalkFoot;
    10.  
    11.             bool running = ( (dir & Direction.Running) != 0 );
    12.  
    13.             bool onHorse = ( this.Mount != null );
    14.  
    15.             AnimalFormContext animalContext = AnimalForm.GetContext( this );
    16.  
    17.             if( onHorse || (animalContext != null && animalContext.SpeedBoost) )
    18.                 return ( running ? Mobile.RunMount : Mobile.WalkMount );
    19.  
    20.             return ( running ? Mobile.RunFoot : Mobile.WalkFoot );
    21.         }
    22.  
    Any help would be great this is final part of my problem and i dunno why.
     
  6. Kalamus
    Offline

    Kalamus Active Member

    Joined:
    Apr 24, 2013
    Messages:
    282
    Likes Received:
    32
    ComputeMovementSpeed needs to be an 'int' so change the override to look something like this:
    Code (C#):
    1. public override int ComputeMovementSpeed(Direction dir, bool checkTurning)
     
  7. Nytewyrm
    Offline

    Nytewyrm New Member

    Joined:
    Jun 3, 2014
    Messages:
    23
    Likes Received:
    0
    Thank you unfortunately that lead to a huge array of problems so i think its time to scrap those addons since im not a master scripter that knows how to make them work just yet. But thank you so much for your help
     
  8. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    You learn nothing by quitting.

    Kalamus is correct, this should be an int that is overridden in Mobile. It should look like this:

    Code (C#):
    1. public override int ComputeMovementSpeed(Direction dir, bool checkTurning)
    2.         {
    3.             if (checkTurning && (dir & Direction.Mask) != (Direction & Direction.Mask))
    4.             {
    5.                 return RunMount; // We are NOT actually moving (just a direction change)
    6.             }
    7.  
    8.             TransformContext context = TransformationSpellHelper.GetContext(this);
    9.  
    10.             if (context != null && context.Type == typeof(ReaperFormSpell))
    11.             {
    12.                 return WalkFoot;
    13.             }
    14.  
    15.             bool running = ((dir & Direction.Running) != 0);
    16.  
    17.             bool onHorse = (Mount != null);
    18.            
    19.             AnimalFormContext animalContext = AnimalForm.GetContext(this);
    20.  
    21.             if (onHorse || (animalContext != null && animalContext.SpeedBoost))
    22.             {
    23.                 return (running ? RunMount : WalkMount);
    24.             }
    25.            
    26.             return (running ? RunFoot : WalkFoot);
    27.         }
    If this gives you errors, then post the errors and we can help you further. Giving up benefits no one.
     
    • Agree Agree x 2
Similar Threads: Help script
Forum Title Date
Looking For Help Searching for scripter, possibly other help, for Ultima-based shard. Jan 10, 2017
Looking For Help Need Help Scripting Aug 21, 2016
Script Support Imbuing Script Help Aug 9, 2016
Script Support I'd tried to translate some text of servuo scripts and got problem,need help. Jul 5, 2016
Script Support I need a bit of help scripting my pvp server Jan 14, 2016
Script Support ServUO/Scripts/Services/ConPVP need help Dec 18, 2015
Script Support I need help with pot script Sep 27, 2015