Nytewyrm

Member
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:
		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
				}
			}
		}

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.
 

Attachments

  • PlayerMobile.cs
    111.4 KB · Views: 3
Last edited:
The class Playermobile inherits hasnt marked this property as virtual. So you can´t override whats not setted to be overridable.
 
Remove that and try it this way:

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
	}
}
 
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.
 
So this block is giving me the last problems of this script I am just not sure

Code:
		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 );
		}

Any help would be great this is final part of my problem and i dunno why.
 
ComputeMovementSpeed needs to be an 'int' so change the override to look something like this:
Code:
public override int ComputeMovementSpeed(Direction dir, bool checkTurning)
 
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
 
You learn nothing by quitting.

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

Code:
public override int ComputeMovementSpeed(Direction dir, bool checkTurning)
		{
			if (checkTurning && (dir & Direction.Mask) != (Direction & Direction.Mask))
			{
				return RunMount; // We are NOT actually moving (just a direction change)
			}

			TransformContext context = TransformationSpellHelper.GetContext(this);

			if (context != null && context.Type == typeof(ReaperFormSpell))
			{
				return WalkFoot;
			}

			bool running = ((dir & Direction.Running) != 0);

			bool onHorse = (Mount != null);
			
			AnimalFormContext animalContext = AnimalForm.GetContext(this);

			if (onHorse || (animalContext != null && animalContext.SpeedBoost))
			{
				return (running ? RunMount : WalkMount);
			}
			
			return (running ? RunFoot : WalkFoot);
		}

If this gives you errors, then post the errors and we can help you further. Giving up benefits no one.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back