RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Dynamic Race/Class System.

EchoEcho

Sorceror
Race/Class System *Dynamic* v2.0

Update
Wednesday September 28 / 2005, 9:12AM PST


Some people seem to be having issues with the "Young" protection for vetern players using the stone. So now a function has been added to override it:
-Young_F in the [props of the RCChest. If this is set to false, ANY player, Young or not will be reset (They will lose their Skills, Stats and Items in their backpack). Default is True. If you do not want Veterns to lose their stuff when using the stone, keep it on true.

Here is what EVERYONE has been asking for: TITLES!!!!

In the RaceControl there is Race_Title (default false)
In the ClassControl there is Class_Title (default false)

If Race_Title is true, then a player will be "Bob the Elf" after using the stone.
If Class_Title is true, then a player will be "Bob the Warrior" after using the stone.
If both are true, then a player will be "Bob the Elf Warrior" after using the stone.

Finally, this is IMPORTANT
***PlayerMobile no longer needs to be editted. If your is edited, remove the edits for the RC System***

Once again IF YOU HAVE EDITED YOUR PLAYERMOBILE FOR THIS SYSTEM, REMOVE THE EDIT.

Thanks for A_Li_N for a way to remove the PlayerMobile edits and keep full functionality.


UPDATE
Thursday August 25 / 2005, 8:23PM PST


- New Spellbook.cs Provided, No Longer editted for AllSpells.
- Added Staff_Login Property to the RCChest. If set to False, A Staff member can now operate without an RCControl as long as Staff_Login is set to false.
***IMPORTANT, The PlayerMobile.cs Edit has changed slightly for this feature. Please Update PlayerMobile.cs See Below for new Addition to PlayerMobile.***
- Update.cs Has been removed from the main rar file. It is now provided seperatly for those who need it.


*UPDATE* VERSION 2.0 RELEASED!
- Saturday August 6 / 2005

*IMPORTANT FOR THOSE WITH VERSIONS 1.3 AND OLDER*
Inorder to bring your system up to speed with version 2.0, you MUST run the ****[Update**** command after upgrading to version 2.0 This will ensure all features of version 2.0 work properly.
****AFTER USING [Update YOU MUST DELETE Update.cs in the /Commands folder of the RC System. Using [Update twice will MESS UP YOUR SYSTEM****


Now on to the new Goodies:

Addition 1: ShapeShifting

[Editss : This command allows you to add and remove shapeshifts for each race. When adding a Shapeshift you must enter

- A Name for the Shapeshift
- A Body Value for the Shapeshift
- *Optional* A Hue for the Shapeshift

There is a Maximum of 5 shapeshift forms per Race.

[sc : This is the command used by Players to Shapeshift.

If a Players Race has NO shapeshift forms, they will get a message saying they cannot shapeshift

If a Players Race has ONE shapeshift form they will simply transform back and forth between the shapeshift and normal form

If a Players Race has more than one shapeshift they get a Gump listing their Shapeshift choices.

Addition 2: Restricted Armors and Weapons

This Update requires editing BaseWeapon.cs and BaseArmor.cs, There is one small addition to each, clearly marked by comments. If you have an already modified BaseWeapon or BaseAmor, simply copy and paste the edits from my supplied scripts to your scripts using Winmerge or something similar.

In each Class Bag there is now "<Class Name> Restricted Armors" and
"<Class Name> Restricted Weapons" Bags. Any Armors in the Restricted Armors Bag, and any Weapons in the Restricted Weapons Bags will be unusable by that Class. To make them useable again, remove the item from the bag.

A Restricted Armor or Weapon will send a message to the player who tries to equip it stating it is restricted.

Addition 3: Restricted Spellbooks

I did my Best to make this system easily compatible with AllSpells without making it a required system. So here goes:

For Those WITH or WITHOUT AllSpells:

I have provided my SpellBook.cs, it has one very minor addition. If yours is already edited, simply copy and paste this addition into your SpellBook.cs. This Handles All OSI SpellBooks.

For Those WITH AllSpells:

First of all, the UseRestrictions bool in the AllSpells script should be set to False so as not to conflict with this system.

The addition I made to SpellBook.cs needs to be added to all SpellBook files in AllSpells for them to work with the system.

EXAMPLE: Copy and Paste the addition from SpellBook.cs to the OnDoubleClick Method ClericSpellBook.cs this will make Cleric spellbooks work with the system. Repeat this for all AllSpells Books you want to work with this system.

How the System Works:

[Loadsb : This Command loads a SpellbookType into the system, simply type the command and click on a Spellbook. The system starts empty, so any books you want added to the system must be added using this command. The spellbook targeted by [Loadsb WILL BE DELETED. A Spellbooktype can only be loaded into the system once. Once loaded a spellbook cannot be removed from the system.

[restrictsb : This command controls which spellbooks are restricted to which class. Spellbooks can be restricted and unrestricted at ANYTIME. The gumps are fairly straight forward on how to Restrict and Unrestrict Spellbooks.

When a player goes to use a Restricted Spellbook for their class they recieve a message stating the Spellbook is restricted.

Addition 4: Safetly Changing the Name of a Race, Class or BonusPack

This is for those who wanted to change names without causing problems.

Now, you can change the name of a Race, Class or BonusPack by using [props on the Orb of the Name you wish changed and changing the Name property.

****IMPORTANT**** After changing the name in [props you MUST use this command:
[syncnames : This will adjust the settings on Bags and RCCONTROLS to the new name for that Race/Class/BonusPack.

-----------------------------------------------------------------------------------------------------
Version 1.0-2.0 Information:

*UPDATE*
- [RCclean command added, cleans out any ClassOrbs, RaceOrbs and BonusPack Orbs that are created due to crashing while a create menu is open.
- [Racehues command added, allows hues on any current Race to be editted, added or removed.
- Race Item Bags added, work the same way as Class Item bags and Bonus Pack Item Bags.
- Various Bug Fixes
- Tuesday July 26/2005 7:29pm PST


*UPDATE*
- Body and Hair Hue menues have undergone a fix/upgrade
- Sunday July 24/2005 11:52pm PST


*URGENT UPDATE CONTAINING [removerace, [removeclass BUG FIXES*
- Sunday July 24/ 2005 9:41pm PST


The Dynamic Race/Class system is a script system I developed from scratch to provide administrators with a simple, highly customizable race/class system that can be implemented at anytime without a shard wipe.

Here are some key features:

- To add anything or change anything in the system, You NEVER have to edit code.
- Races and Classes can be added at ANYTIME, without even rebooting the server.
- VERY minimal editing of Distro scripts will ensure that there is no chance of a Playermobile wipe after install
- Almost every aspect of the system allows for customization.
- "Bonus Packs" to further the class choices for players (More information to follow below.
- ALL commands and item properties are admin access level for protection


Manual on operation: How the System Works.

Overall Commands:

[RCbegin : This command initiates the Race/Class system. An RCChest is created where the Administrator says the command. The RCChest is an invisible Chest metal chest that houses all the Items nescessary to operate the Race/Class system.

[RCremove : This command removes the race system from your shard, including all items involved with the race system.

[props on the RCChest that are customizable:

Active: (Default False) the Active property sets whether or not the system is active. An inactive system does not send new players to the Race Stone and does not utilize Stat caps based on Class.

Start_Map: (Default Trammel) this is the map that the Race stone is located on. All new players and all current players who have not used the race stone will be sent to this map upon login.

Start_X, Start_Y, Start_Z: (Default Center of Britain) these control the coordinates of the race stone. New players and current players who have not used the stone will be sent to this location upon login.

In order for new players and Players who have not used the race stone to be sent to the race stone, the Activate property on the RCChest must be set to True;

Creating a new Race:

First of all, when [RCbegin is used, an item called a RaceControl is created inside the RCChest, this item is essential for the correct operation of the race system.

[props on the Race Control that are customizable:

Set_Location: (default false) this determines whether players are sent to the location specified during Race creation after using the race stone. If set to true, all players who choose a certain race will be sent to a specific location specified for that race.

Race Creation Commands:

[addrace : This command opens the Gump to create a Race, when creating a race, you must enter the following information:

- Race Name
- Race Description
- Starting Map
- Starting Coordinates
- 1 - 10 Body Hues for the Race
- 1 - 10 Hair Hues for the Race

After creating a Race, a Race Orb will be creating in the RACES bag contained in the RCChest, the properties on a Race Orb should not be modified, however if Needed, the Description can be safetly modified.

[removerace : Removes the race and sends all players who were that race back to the Race stone on their next login.

[restrictclass : Allows up to 5 classes to be restricted from a certain race. Classes can be restricted and unrestricted at any time using this command.


Creating a new Class:

Once again, when [RCbegin is used, a ClassControl is generated, this Classcontrol controls many aspects of the systems Class system.

[props on the Class Control that are customizable:

Default_Cap: (Default 40.0) This is the skill cap that all Non-Primary, Non-Secondary, Non-Tertiary and Non-Restricted skills are set to.

Secondary_Cap: (Default 80.0) This is the cap all Secondary skills are set to.

Tertiary_Cap: (Default 70.0) This is the cap all Tertiary skills are set to.

Amount_Start_Skills: (Default 3) This is how many skills a new player will be allowed to pick to be set to a certain value upon using the Race stone. These skills replace the skills selected by the Player during OSI character creation.

Start_Skills_Value: (Default 50.0) This is the value the starting skills are set to.

Stat_Cap: (Default 300) This is the overall stat cap that for all players.

Equip_Players: (Default True) This determines whether or not the system strips a new player and re-equips them based on the class they choose.

Class Creation Commands:

[addclass : This opens the gump for creating a new class.

Page one of addclass gump:

- Class Name
- Class Description
- Starting Strength, Dexterity and Intelligence values for the Class
- Strength, Dexterity and Intelligence Caps for the Class

Page two of addclass gump:

- Select Up to 10 Primary Skill Caps for the Class to start with. The Cap Value is entered in the "Value" field. When you have entered all the Primary Caps you wish, click done.

Page three of addclass gump:

- Enter the amount (1 - 10) of Secondary skills a player choosing this class can pick.

Page four of addclass gump:

- Enter the amount (1 - 10) of Tertiary skills a player shoosing this class can pick.

Page five of addclass gump:

- Choose up to 10 Skills to Restricted (Set to a 0.0 Cap) for this class.

Once added, a Bag named "<Class Name> Class" will be generated inside the CLASSES bag in the RCChest. A Class Orb for the class with be generated inside the bag, aswell as Two more bags called "<Class Name> Equips" and "<Class Name> Items", these bags are for the following:

If Equip_Players is set to true in the Class Control, first all items currently on the Player and in their backpack will be deleted, then all items in the "<Class Name> Equips" Bag will be equipped onto a new player who selects this class and all items contained in the "<Class Name> Items" bag will be added to the new players backpack.

[removeclass : Removes the selected class and sends any player who was that class back to the race stone upon their next login.


Bonus Packs:

Bonus Packs are an optional feature that allows admins to create addition sets of skills that a player may choose by sacrificing Secondary Skill Points. (Like Chef skills, Spellcrafting Skills, ect)

Bonus Pack Commands:

[addbp : Opens the Add Bonus Pack Gump

Page one of addbonuspack gump:

- Enter the Name of the Bonus Pack
- Enter the amount of Secondary skills that choosing the Bonus Pack will cost

Page two of addbonuspack gump:

- Select up to 5 skills and values for the Bonus Pack.

Once created a Bonus Pack's info is Stored in a BonusPack Orb, which is Generated inside the BONUSPACKS bag, inside the CLASSES bag, inside the RCChest.

Like Classes, a bonuspack also has a bag called "<BonusPack Name> Items" which contained items to be added to a new players backpack if they select this Bonus Pack.

[removebp : Removes a selected BonusPack and sends all players who chose that bonus pack back to the race stone upon their next login.


Installation:

Step One: Download The Script Files and Unzip into your Custom Directory

* The ONLY distro files that are modified are SkillCheck.cs, BaseWeapon.cs, BaseArmor.cs and SpellBook.cs*

And now you are all set to Use the Dynamic Race/Class system.

I would like to thank the members of the RunUO community who have made many wonderfull scripts, which I studied greatly to learn many things in creating this System.
 

Attachments

  • Update.cs
    3.9 KB · Views: 1,207
  • RaceClassSystem.rar
    65.2 KB · Views: 1,469

Marak

Sorceror
Nice one mate, going to give it a go as soon as i get a chance, this will make things a lot easier to play with.
 

Killamus

Knight
Very, Very nice. I will be using this on my shard, fo sho. I am confused on one thing, the Bonus pack. So, if you add that, someone can give up secondary skills (Gained or cap?) to insta-gain some other skill, or does it just lower the skill? Please clarify. But, good script my man.
 

EchoEcho

Sorceror
When a Player is setting up their class, they come to a menu with the Bonus Packs.

As an example, say a Player has chosen a Paladin, and their skills are set up for Paladins, and they get to choose 3 Secondary skills to go with their Primary Paladin skills.

However, They also wish to be a chef, which is a Bonus Pack the admin has added.

So if they GIVE UP their Secondary Skill Caps, they get a set of Skill Caps for a chef, such as 100 cooking, 100 camping, ect.

By choosing the Bonus Pack, they no longer get 3 Skills set to an 80,0 Cap, but the 2 Chef skills set to a 100 cap, and any items set up for the Chef bonus pack.
 

kirax2

Wanderer
I haven't had a chance to try it out yet, but I'm very impressed with the design. Thanks very much for this, it looks nifty. ^_^

-Janice
aka kirax2
 

EchoEcho

Sorceror
What are some features people are looking for in a Race/Class system?

I am looking to expand the functionality of the system, and since I have no shard of my own, I am looking for some feedback from those who have used the system.
 

Alis

Wanderer
Actually i am improving the same script yours but if you want you could use the idea ; contact me from my AIM MSN ICQ OR YAHOO ... im allways online on all of them ..
 

EchoEcho

Sorceror
Additions for the Next Update (Or future):

- Built in Shapeshift System
- SpellBook Restricting based on Class
- Item Restricting based on Class
- Premier Classes (Advanced Classes, details still under development


If anyone has any other things they would want to see in a Race/Class System, please feel free to suggest.
 

LNM_TNB

Wanderer
Here are the errors I'm getting:

Code:
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 341, column 4) The type or n
amespace name 'ClassOrb' could not be found (are you missing a using directive o
r an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 342, column 4) The type or n
amespace name 'RCChest' could not be found (are you missing a using directive or
 an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 343, column 4) The type or n
amespace name 'RCCONTROL' could not be found (are you missing a using directive
or an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 354, column 49) The type or
namespace name 'RCCONTROL' could not be found (are you missing a using directive
 or an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0103: (line 357, column 5) The name 'rc'
 does not exist in the class or namespace 'Server.Misc.SkillCheck'
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 360, column 15) The type or
namespace name 'ClassOrb' could not be found (are you missing a using directive
or an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0103: (line 361, column 6) The name 'c_o
rb' does not exist in the class or namespace 'Server.Misc.SkillCheck'
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 362, column 10) The type or
namespace name 'c_orb' could not be found (are you missing a using directive or
an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 367, column 15) The type or
namespace name 'RCChest' could not be found (are you missing a using directive o
r an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0103: (line 368, column 7) The name 'che
st' does not exist in the class or namespace 'Server.Misc.SkillCheck'
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 369, column 11) The type or
namespace name 'chest' could not be found (are you missing a using directive or
an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 370, column 16) The type or
namespace name 'c_orb' could not be found (are you missing a using directive or
an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 371, column 16) The type or
namespace name 'c_orb' could not be found (are you missing a using directive or
an assembly reference?)
 - Error: Scripts\Misc\SkillCheck.cs: CS0246: (line 372, column 16) The type or
namespace name 'c_orb' could not be found (are you missing a using directive or
an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

Here is my skillscheck.cs:

Code:
using System;
using Server;
using Server.Mobiles;

namespace Server.Misc
{
public class SkillCheck
{
private const bool AntiMacroCode = false; //Change this to false to disable anti-macro code

public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes( 5.0 ); //How long do we remember targets/locations?
public const int Allowance = 3; //How many times may we use the same location/target for gain
private const int LocationSize = 5; //The size of eeach location, make this smaller so players dont have to move as far
private static bool[] UseAntiMacro = new bool[]
{
// true if this skill uses the anti-macro code, false if it does not
false,// Alchemy = 0,
false,// Anatomy = 1,
false,// AnimalLore = 2,
false,// ItemID = 3,
false,// ArmsLore = 4,
false,// Parry = 5,
false,// Begging = 6,
false,// Blacksmith = 7,
false,// Fletching = 8,
false,// Peacemaking = 9,
false,// Camping = 10,
false,// Carpentry = 11,
false,// Cartography = 12,
false,// Cooking = 13,
false,// DetectHidden = 14,
false,// Discordance = 15,
false,// EvalInt = 16,
false,// Healing = 17,
false,// Fishing = 18,
false,// Forensics = 19,
false,// Herding = 20,
false,// Hiding = 21,
false,// Provocation = 22,
false,// Inscribe = 23,
false,// Lockpicking = 24,
false,// Magery = 25,
false,// MagicResist = 26,
false,// Tactics = 27,
false,// Snooping = 28,
false,// Musicianship = 29,
false,// Poisoning = 30,
false,// Archery = 31,
false,// SpiritSpeak = 32,
false,// Stealing = 33,
false,// Tailoring = 34,
false,// AnimalTaming = 35,
false,// TasteID = 36,
false,// Tinkering = 37,
false,// Tracking = 38,
false,// Veterinary = 39,
false,// Swords = 40,
false,// Macing = 41,
false,// Fencing = 42,
false,// Wrestling = 43,
false,// Lumberjacking = 44,
false,// Mining = 45,
false,// Meditation = 46,
false,// Stealth = 47,
false,// RemoveTrap = 48,
false,// Necromancy = 49,
false,// Focus = 50,
false,// Chivalry = 51
};

public static void Initialize()
{
Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation );
Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation );

Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget );
Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget );

//*********EDIT THESE LINES TO SET THE BASE PERCENT CHANCE TO GAIN FOR EACH INDIVIDUAL SKILL***********************//
//This Table used to set the base chance to gain skill between 40 and 70
//for instance .15 would be a 15% chance to gain in the particular skill
SkillInfo.Table[0].GainFactor = .25;// Alchemy = 0, 
SkillInfo.Table[1].GainFactor = .05;// Anatomy = 1, 
SkillInfo.Table[2].GainFactor = .05;// AnimalLore = 2, 
SkillInfo.Table[3].GainFactor = .05;// ItemID = 3, 
SkillInfo.Table[4].GainFactor = .05;// ArmsLore = 4, 
SkillInfo.Table[5].GainFactor = .05;// Parry = 5, 
SkillInfo.Table[6].GainFactor = .05;// Begging = 6, 
SkillInfo.Table[7].GainFactor = .25;// Blacksmith = 7, 
SkillInfo.Table[8].GainFactor = .25;// Fletching = 8, 
SkillInfo.Table[9].GainFactor = .05;// Peacemaking = 9, 
SkillInfo.Table[10].GainFactor = .05;// Camping = 10, 
SkillInfo.Table[11].GainFactor = .25;// Carpentry = 11, 
SkillInfo.Table[12].GainFactor = .25;// Cartography = 12, 
SkillInfo.Table[13].GainFactor = .25;// Cooking = 13, 
SkillInfo.Table[14].GainFactor = .05;// DetectHidden = 14, 
SkillInfo.Table[15].GainFactor = .05;// Discordance = 15, 
SkillInfo.Table[16].GainFactor = .05;// EvalInt = 16, 
SkillInfo.Table[17].GainFactor = .05;// Healing = 17, 
SkillInfo.Table[18].GainFactor = .25;// Fishing = 18, 
SkillInfo.Table[19].GainFactor = .05;// Forensics = 19, 
SkillInfo.Table[20].GainFactor = .05;// Herding = 20, 
SkillInfo.Table[21].GainFactor = .05;// Hiding = 21, 
SkillInfo.Table[22].GainFactor = .05;// Provocation = 22, 
SkillInfo.Table[23].GainFactor = .25;// Inscribe = 23, 
SkillInfo.Table[24].GainFactor = .25;// Lockpicking = 24, 
SkillInfo.Table[25].GainFactor = .05;// Magery = 25, 
SkillInfo.Table[26].GainFactor = .05;// MagicResist = 26, 
SkillInfo.Table[27].GainFactor = .05;// Tactics = 27, 
SkillInfo.Table[28].GainFactor = .25;// Snooping = 28, 
SkillInfo.Table[29].GainFactor = .05;// Musicianship = 29, 
SkillInfo.Table[30].GainFactor = .25;// Poisoning = 30 
SkillInfo.Table[31].GainFactor = .05;// Archery = 31 
SkillInfo.Table[32].GainFactor = .05;// SpiritSpeak = 32 
SkillInfo.Table[33].GainFactor = .25;// Stealing = 33 
SkillInfo.Table[34].GainFactor = .25;// Tailoring = 34 
SkillInfo.Table[35].GainFactor = .05;// AnimalTaming = 35 
SkillInfo.Table[36].GainFactor = .05;// TasteID = 36 
SkillInfo.Table[37].GainFactor = .05;// Tinkering = 37 
SkillInfo.Table[38].GainFactor = .05;// Tracking = 38 
SkillInfo.Table[39].GainFactor = .05;// Veterinary = 39 
SkillInfo.Table[40].GainFactor = .05;// Swords = 40 
SkillInfo.Table[41].GainFactor = .05;// Macing = 41 
SkillInfo.Table[42].GainFactor = .05;// Fencing = 42 
SkillInfo.Table[43].GainFactor = .05;// Wrestling = 43 
SkillInfo.Table[44].GainFactor = .05;// Lumberjacking = 44 
SkillInfo.Table[45].GainFactor = .25;// Mining = 45 
SkillInfo.Table[46].GainFactor = .05;// Meditation = 46 
SkillInfo.Table[47].GainFactor = .25;// Stealth = 47 
SkillInfo.Table[48].GainFactor = .05;// RemoveTrap = 48 
SkillInfo.Table[49].GainFactor = .05;// Necromancy = 49 
SkillInfo.Table[50].GainFactor = .05;// Focus = 50 
SkillInfo.Table[51].GainFactor = .05;// Chivalry = 51
}

public static bool Mobile_SkillCheckLocation( Mobile from, SkillName skillName, double minSkill, double maxSkill )
{
Skill skill = from.Skills[skillName];

if ( skill == null )
return false;

double value = skill.Value;

if ( value < minSkill )
return false; // Too difficult
else if ( value >= maxSkill )
return true; // No challenge

double chance = (value - minSkill) / (maxSkill - minSkill);

Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize );
return CheckSkill( from, skill, loc, chance );
}

public static bool Mobile_SkillCheckDirectLocation( Mobile from, SkillName skillName, double chance )
{
Skill skill = from.Skills[skillName];

if ( skill == null )
return false;

if ( chance < 0.0 )
return false; // Too difficult
else if ( chance >= 1.0 )
return true; // No challenge

Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize );
return CheckSkill( from, skill, loc, chance );
}

public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance )
{
if ( from.Skills.Cap == 0 )
return false;

bool success = ( chance >= Utility.RandomDouble() );

//**********EDIT THESE LINES FOR MODIFICATIONS TO BASE PERCENTAGE AT DIFFERENT SKILL LEVELS************************//
double LowSkillMod = .20; // percent added to skill gain for skill between 0 - 40
double BaseSkillGain = skill.Info.GainFactor; // base percent to gain at skill between 40 - 70 set in table above.
double HighSkillMod = .10; // percent subtracted from base gain for skill between 70 - 100
double AboveGmSkillMod = .5; // percent subtracted from base gain for skill over 100
//Example: Player Skill is 85.3 - We would take the 15% base chance and subtract 8% - Player now has a 7% chance to gain.
//************************************************** ************************************************** *************//

double ComputedSkillMod = 100; // holds the percent chance to gain after checking players skill

if ( skill.Base < 40.1 ) 
ComputedSkillMod = BaseSkillGain + LowSkillMod; 
else if ( skill.Base < 70.1 ) 
ComputedSkillMod = BaseSkillGain; 
else if ( skill.Base < 100.1 ) 
ComputedSkillMod = BaseSkillGain - HighSkillMod; 
else if ( skill.Base > 100.0 ) 
ComputedSkillMod = BaseSkillGain - AboveGmSkillMod; 

if ( ComputedSkillMod < 0.01 ) 
ComputedSkillMod = 0.01;

//following line used to see chance to gain ingame
//from.SendMessage( "Your chance to gain {0} is {1}",skill.Name, ComputedSkillMod );

if ( from is BaseCreature && ((BaseCreature)from).Controled )
ComputedSkillMod *= 2;

if ( from.Alive && ( ( ComputedSkillMod >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) ) 
Gain( from, skill ); 

return success;
}

public static bool Mobile_SkillCheckTarget( Mobile from, SkillName skillName, object target, double minSkill, double maxSkill )
{
Skill skill = from.Skills[skillName];

if ( skill == null )
return false;

double value = skill.Value;

if ( value < minSkill )
return false; // Too difficult
else if ( value >= maxSkill )
return true; // No challenge

double chance = (value - minSkill) / (maxSkill - minSkill);

return CheckSkill( from, skill, target, chance );
}

public static bool Mobile_SkillCheckDirectTarget( Mobile from, SkillName skillName, object target, double chance )
{
Skill skill = from.Skills[skillName];

if ( skill == null )
return false;

if ( chance < 0.0 )
return false; // Too difficult
else if ( chance >= 1.0 )
return true; // No challenge

return CheckSkill( from, skill, target, chance );
}

private static bool AllowGain( Mobile from, Skill skill, object obj )
{
if ( from is PlayerMobile && AntiMacroCode && UseAntiMacro[skill.Info.SkillID] )
return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
else
return true;
}

public enum Stat { Str, Dex, Int }

public static void Gain( Mobile from, Skill skill )
{
if ( from.Region is Regions.Jail )
return;

if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet )
return;

if ( skill.SkillName == SkillName.Focus && from is BaseCreature )
return;

if ( skill.Base < skill.Cap && skill.Lock == SkillLock.Up )
{
int toGain = 1;

if ( skill.Base <= 10.0 )
toGain = Utility.Random( 4 ) + 1;

Skills skills = from.Skills;

if ( ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap )
{
for ( int i = 0; i < skills.Length; ++i )
{
Skill toLower = skills[i];

if ( toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain )
{
toLower.BaseFixedPoint -= toGain;
break;
}
}
}

if ( (skills.Total + toGain) <= skills.Cap )
{
skill.BaseFixedPoint += toGain;
}
}

if ( skill.Lock == SkillLock.Up )
{
SkillInfo info = skill.Info;

//*****EDIT THIS LINE TO MAKE STATS GAIN FASTER, NUMBER MUST BE BETWEEN 0.00 and 1.00, THIS IS ADDED TO THE CHANCE TO GAIN IN A STAT********//
double StatGainBonus = .25; //Extra chance to gain in stats. Left at 0 would be default runuo gains.
//************************************************** ************************************************** **************************************//

if ( from.StrLock == StatLockType.Up && ((info.StrGain / 33.3) + StatGainBonus) > Utility.RandomDouble() )
{ 
if( info.StrGain != 0 )
GainStat( from, Stat.Str );
}
else if ( from.DexLock == StatLockType.Up && ((info.DexGain / 33.3) + StatGainBonus) > Utility.RandomDouble() )
{
if( info.DexGain != 0 )
GainStat( from, Stat.Dex );
}
else if ( from.IntLock == StatLockType.Up && ((info.IntGain / 33.3) + StatGainBonus) > Utility.RandomDouble() )
{
if( info.IntGain != 0 ) 
GainStat( from, Stat.Int );
}
//following line used to show chance to gain stats ingame
//from.SendMessage( "Str: {0} Dex: {1} Int: {2}",((info.StrGain / 33.3) + StatGainBonus),((info.DexGain / 33.3) + StatGainBonus),((info.IntGain / 33.3) + StatGainBonus) );
}
}

public static bool CanLower( Mobile from, Stat stat )
{
switch ( stat )
{
case Stat.Str: return ( from.StrLock == StatLockType.Down && from.RawStr > 10 );
case Stat.Dex: return ( from.DexLock == StatLockType.Down && from.RawDex > 10 );
case Stat.Int: return ( from.IntLock == StatLockType.Down && from.RawInt > 10 );
}

return false;
}
/*EDITED FOR ECHO RACE CLASS SYSTEM*/

		public static bool CanRaise( Mobile from, Stat stat )
		{
			
			ClassOrb c_orb = null;
			RCChest chest = null;
			RCCONTROL rc = null;
			
			/*If the System is Inactive, these are the Stat Cap values*/
			int n_str = 125;
			int n_dex = 125;
			int n_int = 125;
			int rc_Exists = 0;
			/*********************************************************/
			
			
			if (!(from is BaseCreature))
			rc_Exists = from.Backpack.GetAmount( typeof( RCCONTROL ) );
			
			if ( rc_Exists != 0) {
				rc =  from.Backpack.FindItemByType( typeof( RCCONTROL ) ) as RCCONTROL;
			
				foreach (Item i in World.Items.Values) {
					if (i is ClassOrb){
					c_orb = i as ClassOrb;
					if (c_orb.ClassName == rc.P_Class)
					break;}
				}
				
				foreach (Item i in World.Items.Values) {
					if (i is RCChest) {
						chest = i as RCChest;
						if (chest.Active) {
							n_str = c_orb.Str_Cap;
							n_dex = c_orb.Dex_Cap;
							n_int = c_orb.Int_Cap;
						}
					}
				}
			}
				

			if ( !(from is BaseCreature && ((BaseCreature)from).Controled) )
			{
				if ( from.RawStatTotal >= from.StatCap )
					return false;
			}

			switch ( stat )
			{
				case Stat.Str: return ( from.StrLock == StatLockType.Up && from.RawStr < n_str );
				case Stat.Dex: return ( from.DexLock == StatLockType.Up && from.RawDex < n_dex );
				case Stat.Int: return ( from.IntLock == StatLockType.Up && from.RawInt < n_int );
			}

			return false;
		}
/********************************************************************************/

public static void IncreaseStat( Mobile from, Stat stat, bool atrophy )
{
atrophy = atrophy || (from.RawStatTotal >= from.StatCap);

switch ( stat )
{
case Stat.Str:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Dex ) && (from.RawDex < from.RawInt || !CanLower( from, Stat.Int )) )
--from.RawDex;
else if ( CanLower( from, Stat.Int ) )
--from.RawInt;
}

if ( CanRaise( from, Stat.Str ) )
++from.RawStr;

break;
}
case Stat.Dex:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawInt || !CanLower( from, Stat.Int )) )
--from.RawStr;
else if ( CanLower( from, Stat.Int ) )
--from.RawInt;
}

if ( CanRaise( from, Stat.Dex ) )
++from.RawDex;

break;
}
case Stat.Int:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawDex || !CanLower( from, Stat.Dex )) )
--from.RawStr;
else if ( CanLower( from, Stat.Dex ) )
--from.RawDex;
}

if ( CanRaise( from, Stat.Int ) )
++from.RawInt;

break;
}
}
}

private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes( 0.0 );

public static void GainStat( Mobile from, Stat stat )
{
if ( (from.LastStatGain + m_StatGainDelay) >= DateTime.Now )
return;

from.LastStatGain = DateTime.Now;

bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() );

IncreaseStat( from, stat, atrophy );
}
}
}

I followed your instructions, or so I thought, maybe I did something wrong with it, I dunno. Your help would be appreciated, thanks.
 

EchoEcho

Sorceror
This is a feature I am working on, but currently if NO ONE! has selected a Race or Class, changing it wont affect anything.
 

cuy782002

Wanderer
sweet system just a one question i need to know the exact lines to change in my SkillCheck.cs* im using daat99 system and i need to modifiy it THX
 

EchoEcho

Sorceror
If you open my modified skillcheck.cs the lines I changed are clearly marked by Comments.

Also, dont forget to add

using Server.Items; to the top, this is marked by comments, but will be in the next update.
 

vestrai

Wanderer
Code:
RunUO - [[url]www.runuo.com][/url] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
 - Error: Scripts\Misc\SkillCheck.cs: CS0101: (line 8, column 15) The namespace
'Server.Misc' already contains a definition for 'SkillCheck'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

That's the error I keep getting, I don't know what's going wrong, some help would be greatly appreciated, thanks, I'd love to use this script!

EDIT: I accidentally COPIED the file from MODIFIED and PASTED instead of MOVING it, thus causing the error.


The above has been taken care of, but I'm totally lost on how to actually pick the race and class, I tried to create a new character after setting the RCChest to active(true) and it didn't do anything. Please help.
 
Top