Aurastin

Member
I have a couple of questions regarding stats and skills.

How do I increase or decrease the starting stats on new characters?

Is it possible to limit how much skill gain is allowed in specific skills by profession?

Thanks
 
You can set specific skill caps for each skill and you can also set the stats you have in mind in the charactercreation.cs .
Additionally if you want to change the stat cap for each profession you would have to modify the skillcheck.cs
 
Ok I've looked in charactercreation.cs and found the part I think needs to be edited in order to change the starting Stats on a character. The problem is I am not sure what values I need to be changing. I tried changing the 90 : 80 to 100 : 80 and the result was all newly created characters started with 10 in every Stat.

Code:
private static void SetStats(Mobile m, NetState state, int str, int dex, int intel)
        {
            int max = state.NewCharacterCreation ? 90 : 80;

            FixStats(ref str, ref dex, ref intel, max);

            if (str < 10 || str > 60 || dex < 10 || dex > 60 || intel < 10 || intel > 60 || (str + dex + intel) != max)
            {
                str = 10;
                dex = 10;
                intel = 10;
            }

            m.InitStats(str, dex, intel);
        }
 
The reason why they are get set to 10 each is because of this part in the if
(str + dex + intel)!= max
Also I think the client itself has the stat point cap hard coded for character creation (I may be wrong) but you could always use something like statballs or call a gump on creation where they have to set their new stats
 
PyrO is correct, the character creation stat cap is limited by the client. Most shards that want to do this sort of thing just give a stat ball to the player when populating their backpack. I don't see one in our resources section though.
 
Alright, based on what I've learned here, I have decided to look for another way to allow new characters to start with slightly higher stats.

Right now I am considering is it possible to modify one of the following scripts to limit how much Stats can be changed on a new character. I have tried both options, and although a step in the right direction, not exactly what I am looking for.

1. A StatBall script, I shared to the Resources section. https://www.servuo.com/archive/statball.611/

2. TMSS 3.0 that is also under Resources. https://www.servuo.com/archive/tmss-3-0.446/
 
Aurastin I edited the statball script so it should be easier for you and the others to modify it.

Code:
using System;
using System.Collections;
using Server;
using Server.Prompts;
using Server.Mobiles;
using Server.Network;
using Server.Gumps;
using Server.Items;

namespace Server.Items
{ 
	public class StatBall : Item 
	{ 
		[Constructable] 
		public StatBall() : base( 0xE73 ) 
		{ 
           	Weight = 1.0;
            Hue = 39;
            Name = "a stat ball";
			LootType = LootType.Blessed;
			Movable = true;
		} 

		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( !IsChildOf( from.Backpack ) ) 
			{
	  			from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
				return;
			}
			else if ( from is PlayerMobile )
			{
				from.SendGump( new StatBallGump( (PlayerMobile)from, this ) );
			}
		} 
		
		public override bool DisplayLootType{ get{ return false; } }

		public StatBall( Serial serial ) : base( serial ) 
		{ 
		} 

		public override void Serialize( GenericWriter writer ) 
		{ 
			base.Serialize( writer ); 

			writer.Write( (int) 0 ); // version 
		} 

		public override void Deserialize( GenericReader reader ) 
		{ 
			base.Deserialize( reader ); 

			int version = reader.ReadInt(); 
		} 
	} 
}

namespace Server.Items
{
	public class StatBallGump : Gump
	{
		//-----------------
		// Edit to your liking or leave blank for default values
		//------------------------
		private int statcap;
		private int defaultStr;
		private int defaultDex;
		private int defaultInt;
		private int maxStr;
		private int maxDex;
		private int maxInt;
		
		//-----------------------

		private PlayerMobile m_From;
		private StatBall m_Ball;

		private int str;
		private int dex;
		private int intel;
		
				
		public StatBallGump( PlayerMobile from, StatBall ball ): base( 50, 50 )
		{
			m_From = from;
			m_Ball = ball;
			
			if(statcap <= 0)
			{
				statcap = m_From.StatCap;
			}
			if(defaultStr <= 0)
			{
				defaultStr = 50;
			}
			if(defaultDex <= 0)
			{
				defaultDex = 50;
			}
			if(defaultInt <= 0)
			{
				defaultInt = 50;
			}
			if(maxStr <= 0)
			{
				maxStr = 100;
			}
			if(maxDex <= 0)
			{
				maxDex = 100;
			}
			if(maxInt <= 0)
			{
				maxInt = 100;
			}

			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;
			this.AddPage(0);
			this.AddBackground(50, 50, 437, 215, 9200);
			this.AddLabel(200, 67, 1160, "Stat Ball Selection");
			this.AddLabel(114, 96, 1160, "Choose your Strength, Dexterity, and Intelligence");
			this.AddLabel(69, 156, 1152, "STR");
			this.AddLabel(213, 156, 1152, "DEX");
			this.AddLabel(353, 156, 1152, "INT");
			this.AddTextEntry(109, 156, 32, 20, 1359, 0, defaultStr.ToString());
			this.AddTextEntry(253, 156, 32, 20, 1359, 1, defaultDex.ToString());
			this.AddTextEntry(393, 156, 32, 20, 1359, 2, defaultInt.ToString());
			this.AddLabel(139, 156, 1152, " / " + maxStr.ToString());
			this.AddLabel(283, 156, 1152, " / " + maxDex.ToString());
			this.AddLabel(423, 156, 1152, " / " + maxInt.ToString());
			this.AddButton(405, 221, 238, 240, 4, GumpButtonType.Reply, 0);
			this.AddLabel(140, 200, 1152, "* Stat totals should equal " + statcap + " *");
		}

		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( m_Ball.Deleted )
				return;

						
            TextRelay s = info.GetTextEntry( 0 );
            try
            {
           		 str = Convert.ToInt32(s.Text);
            }
            catch
            {
                 m_From.SendMessage("Bad strength entry. A number was expected.");
            }
           
            TextRelay d = info.GetTextEntry( 1 );
            try
            {
           		 dex = Convert.ToInt32(d.Text);
            }
            catch
            {
                 m_From.SendMessage("Bad dexterity entry. A number was expected.");
            }
           
            TextRelay i = info.GetTextEntry( 2 );
            try
            {
           		 intel = Convert.ToInt32(i.Text);
            }
            catch
            {
                 m_From.SendMessage("Bad intelligence entry. A number was expected.");
            }
			
			if ( str > 0 && dex > 0 && intel > 0 )
			{
//	Uncomment the line line below, and add a comment to the line under it to use a defined number instead of the standard Stat Cap
//				if ( ( ( str + dex + intel ) > Cap ) || ( ( str + dex + intel ) < Cap ) || ( str < 10 ) || ( dex < 10 ) || ( intel < 10 ) )
				if ( ( ( str + dex + intel ) > statcap ) || ( ( str + dex + intel ) < statcap ) || ( str < 10 ) || ( dex < 10 ) || ( intel < 10 ) || ( str > maxStr ) || ( dex > maxDex ) || ( intel > maxInt ) )
					m_From.SendMessage( "Your choice totals are invalid.  Please try again!" );
					
				else
				{
					m_From.RawStr = str;
					m_From.RawDex = dex;
					m_From.RawInt = intel;
			
					m_Ball.Delete();
				}
			}
		}				
	}
}
 
It looks like around line 66 you added an area for edits... what is the syntax for changing values?
 
You simply set the values to what you like there.
Example:
private int statcap = 200;
Now they can only spend 200 points ^^
 
I had just changed lines 107- 115... it seemed to work... I will try it in the marked area 66 - 72... :)

~Edit~
Hey that worked. Easy. Thanks.
I did 600 as a test... Worked great. Now to figure out real numbers.
private int statcap=600;
private int defaultStr;
private int defaultDex;
private int defaultInt;
private int maxStr=200;
private int maxDex=200;
private int maxInt=200;
 
Last edited:
Hehe I implemented that area at line 89+ so you could use the default values of the statball script simply by add them, if you wished to have them differently you could set them in the top area.
 
No problem :) but I also added the max value on the gump itself, because it did sound like you would not want the default cap for those either :p
 
No problem :) but I also added the max value on the gump itself, because it did sound like you would not want the default cap for those either :p

Exactly! And more than likely I would have come right back asking how to fix that too.
 
Aurastin I edited the statball script so it should be easier for you and the others to modify it.

Feedback on this. I gave the updated StatBall a try and it now works exactly like I was looking for. I like how the different values can be easily changed depending on how one wishes to implement it.

Great work! Would you mind updating the StatBall I posted in resources with this change? Or with your permission, I can do so, and I will attribute your work.

https://www.servuo.com/archive/statball.611/
 
Sure go ahead and do so, just make sure that you keep the original author mentioned since I just edited it
 
Where exactly do I place this in the Master directory, and do I need to tell the program to load this script?
 
Noticed nobody identified where you would set the skill caps. Anyone have a line of code to add or can point me in the direction of where in CharacterCreation you modify it?
 
I would do it inside the EventSink_CharacterCreated in the CharacterCreation.cs. Like so for example.
Also I would place it befor the character gets moved.
Code:
newChar.Skills[SkillName.EvalInt].Cap = 150.0;
 
I would do it inside the EventSink_CharacterCreated in the CharacterCreation.cs. Like so for example.
Also I would place it befor the character gets moved.
Code:
newChar.Skills[SkillName.EvalInt].Cap = 150.0;

Exactly what I needed, thanks man.

Milva, thank you also for your links!
 
You can check this link https://www.servuo.com/threads/tutorial-for-how-to-change.1347/
believe zerodowned also has information in tutorials

I would do it inside the EventSink_CharacterCreated in the CharacterCreation.cs. Like so for example.
Also I would place it befor the character gets moved.
Code:
newChar.Skills[SkillName.EvalInt].Cap = 150.0;

I guess this question is going to be aimed at both of you since you each have a part of the equation, so to speak.

First, PyrO, your fix worked perfectly, I went through and got every skill all setup and for new character, it's no longer a problem. However for our current players, we still have yet to see a way to implement that.
Hence the quoting of you, Milva. In your earlier post, you showed how to change different skill caps via global commands. Could you think of a way I could implement the code PyrO showed into a [global command so I can just fix everyones skill caps? Thinking if not I might just see about adding it into PlayerMobile.cs with some tweaks.
 
you could add it once to the playermobiles deserialization (at the end) and restart. After that remove it and restart it again and it is set for all players.

Thats one option at least :)
 
Or :) why not just do the global command for each skill changed? You can also write out each command in Notepad- (copy and paste) then ctrl C for each command to paste in game Ctrl V in game- just do this for each one should go fast
 
Or :) why not just do the global command for each skill changed? You can also write out each command in Notepad- (copy and paste) then ctrl C for each command to paste in game Ctrl V in game- just do this for each one should go fast

Not to sound like Noob #1 here but how would you structure the command?
Would it be [global set Skills[SkillName.Alchemy].Cap 150 where playermobile
 
It's been a while but try this [global set SkillsCap Alchemy 150 where playermobile
if the command is wrong it will tell you :)
 
If you want to global set skullcap or statcap for those characters created before your change- it would be [global set skillscap xxxx where playermobile
xxxx being adding the number of your skullcap. same for statcap
 
if you read just above that it states this is for new characters only lol
was hoping for a way around setting each one individually
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back