ExX

Member
I had this really old script for a pack of npcs that I love. I am trying to update it to ServUO. I fixed a lot of the issues on compile but this one stumps me. At first I was getting ComputeSkillTotal errors and through research I read that it was changed to SkillsTotal so I made that change in the script but I am getting a new error and I am unsure how to use the method. To be honest I am not even sure what that code is supposed to do. I've learned an insane amount in the last month I have been here but this is a bit over my head. This is the error.

Code:
Errors:
    CS1955: Line 142: Non-invocable member 'Server.Mobile.SkillsTotal' cannot be
 used like a method.
    CS1955: Line 143: Non-invocable member 'Server.Mobile.SkillsTotal' cannot be
 used like a method.
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

the actual code that is erroring is this.

int theirTotal = PlayerMobile.SkillsTotal( m );
int ourTotal = PlayerMobile.SkillsTotal( this );

But here is the entire method if it helps.

Code:
public override void OnDeath( Container c )
		{
			base.OnDeath( c );

			Mobile m = FindMostRecentDamager( false );

			if ( m != null && m.Player )
			{
				bool gainedPath = false;

				int theirTotal = PlayerMobile.SkillsTotal( m );
				int ourTotal = PlayerMobile.SkillsTotal( this );

				int pointsToGain = 1 + ((theirTotal - ourTotal) / 50);

				if ( pointsToGain < 1 )
					pointsToGain = 1;
				else if ( pointsToGain > 4 )
					pointsToGain = 4;

				if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
				{
					if ( gainedPath )
						m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
					else
						m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.

					m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
					m.PlaySound( 0x1F7 );
				}
			}
		}
 
Skills are of type double and not of type int (at least in runuo). I would try changing those to double and see if that solves your problem.
 
Thanks for the suggestion but I get the same error. That it can't be used like a method.
 
double theirTotal = m.SkillsTotal;
double ourTotal = this.SkillsTotal;

That is how I would do this. SkillsTotal is a variable within the mobile script and not a method. Sorry I did not look closely at it the first time (dog distraction).

this is assuming that part of the core is the same as what I have.
 
Thank you much. That got rid of that error, and I fixed another one that popped up right below it that also had int. but in the same over-ride i posted I am now getting an error with this line of code.

if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )

the error is
Errors:
CS1502: Line 155: The best overloaded method match for 'Server.VirtueHelper.
Award(Server.Mobile, Server.VirtueName, int, ref bool)' has some invalid argumen
ts
CS1503: Line 155: Argument 3: cannot convert from 'double' to 'int'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

There doesnt seem to be an int that i can change to double?
 
int theirTotal = (int)(m.SkillsTotal);
int ourTotal = (int)(this.SkillsTotal);

int pointsToGain = (int)(1 + ((theirTotal - ourTotal) / 50));

What these should do is force an explicit conversion from a double to an int. This should drop everything after the decimal point. Looking at what you are doing I doubt that is much of an issue as you are looking to kind of ball park some values for point awards.
 
Thank you so much, that worked and I was able to get it to load with the fixed I did as well. Mucho appreceated!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back