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!

Abilities System, with Tree Harvesting, Building houses from Recipes, +more [2.0 SVN]

Lokai

Knight
Abilities System, with Tree Harvesting, Building houses from Recipes, +more [2.0, 2.1, 2.2, SVN]

What is this?

This is a huge, partially complete system that was collecting dust and benefiting nobody. I decided to release it so someone could get something out of it. If you are reading this, then hopefully that someone is you.

The idea for this system began when I decided that there were some ‘skills’ in UO, like riding a horse, that were taken for granted, and I wanted to see if I could implement a new ‘skill’ that would correct this oversight. What I ended up with was a little more ambitious, but I will get to that.

Another aspect of the design of this system was that I wanted to do it without having to use an existing skill, and I wanted to do it without any modifications to Core files, so it would be drag-and-drop capable. In other words, I did NOT want to just create another use for Carpentry or Animal Lore, for example, but I wanted whole new skills with their own names and purposes, but without appending them to the Core set of RunUO skills.

The system that I present here is an ongoing work of mine for almost 2 years. There were many months that I did not work on it at all, and as you probably know I have not been active in RunUO at all for a very long time. I recently dusted off some of the old scripts I had left unfinished, and I also joined a few shards, re-familiarizing myself with it all. Note, that this system is only somewhat complete. There are gaps that need to be filled, and I will explain those as I go.

Let me now attempt to present the entire system as clearly as I can. There is a lot here, so please read everything carefully before using it. This system was tested in a clean copy of SVN 345 and SVN 346. I am certain it is compatible with most other 2.0 versions also, although I would think you would need to change many of the files to get it to port to a 1.0 Server.

HOW TO INSTALL:

Extract the zip file to your RunUO folder, say 'Yes to all', and since there are no modified distro files, this is safe. Enjoy - it will work as-is with no modifications, but see below descriptions for important notes.

The system is comprised of three main areas:

1. Tree Harvesting
2. New ‘skills’ which I call ‘Abilities’
3. Building system

1. Tree Harvesting:

This part of the system is an attempt to add pseudo-realism to the UO world by making every tree in the world produce goods based on it’s type, as opposed to the original system, in which oak trees can give Yew logs and maple trees can give Bloodwood logs. To do this, I created a tool called the Tree Harvest Tool. This tool has 5 functions, as shown in this image:



Using this one tool, you can gather a multitude of new resources from the trees. My ultimate objective was to then have those resources be used to produce useful products, like medicines, dyes, food, and weapons. Although I never completed the products part, the harvesting works great. If you use the Investigate Tree option, it will tell you exactly what type of resources you can obtain from the tree you are examining.



The Tree Harvest system uses 4 of the new Abilities, TreePicking, TreeCarving, TreeSapping, and TreeDigging.

2. New Abilities:

In addition to the Tree Harvesting abilities, there are another 26 Abilities in the system. Many of these are fully implemented. Some will require additional work to complete. The Core files for this system were basically copied from the Core RunUO Skills files, and then the word ‘Skill’ was replaced with ‘Ability’. It was a lot more complex than that, but that was how it all got started.

These Abilities are stored in a Dictionary, belonging to an item called the Master Ability Item. One will be given to you the first time you log in after adding the system. In this way, everyone’s Abilities are stored and saved persistently.

Users can view their own Abilities using the Show Abilities Gump, called with the “[showabilities” or “[showabs” commands. This gump has buttons for directly invoking those Abilities that can be invoked. It also has small tabs on the left that let you ‘drag’ the Ability away so that you have an individual gump for each Ability. Counselors and GameMasters can also bring up the Abilities of another player or themselves using the “[Abilities” or “[Abs” commands. This gump lets you adjust the values of Abilities. See the ‘AbilitiesCommands’ file for the other commands.

Here are the Abilities:

Butchering – (COMPLETE) – when you butcher an animal instead of just using a knife on it, you get bonus meat, but fewer hides, etc.
Skinning – (COMPLETE) – when you skin an animal, you get bonus hides, scales, feathers, and a reduced amount of meat.
AnimalRiding – (COMPLETE) – this Ability will determine if you can stay mounted. (I always thought it was strange that everyone was born in UO with a natural ability to ride any animal. This Ability makes some animals harder to ride than others.)
Sailing – (COMPLETE) – this is similar to the Riding Ability. If you attempt to sail around in a boat, you might not be able to turn the way you think you should, and if you are truly incompetent, you might just wreck the boat and end up washed ashore. (This Ability was tested under limited conditions, so more robust testing should be done. It makes use of a wonderful system that actually checks the Sailing ability of EVERYONE on the boat, not just the person giving the commands. It also rewards crew members individually.)
DetectEvil – (NOT IMPLEMENTED)
CureDisease – (NOT IMPLEMENTED)
PickPocket – (COMPLETE) – allows you to practice your thievery on pretty much anyone. You should check out the script for some Boolean values that you might want to adjust before starting up the Server.
Pilfering – (COMPLETE) – allows you to steal things from display cases and other decorative objects. (Limited testing done.)
Framing, Bricklaying, Roofing, StoneMasonry – (PARTIAL) – these four Abilities are tied directly to the Building system. They allow you to construct just about every type of wall, window, floor, roof, etc. These components can then be gathered in something called a House Recipe, which when completed will provide you with the deed to your new house. To do this, you need to work with the Foreman. (I recommend that if you like this system, you may want to do some modifications to your Server so that this will be viable. For example, you might want to make houses much more expensive, to encourage people to develop their Laborer and Construction Abilities.)
Ventriloquism – (COMPLETE) – fun Ability that lets you throw your voice to pretty much anywhere, like to another person, a tree, or a wall.
Hypnotism – (COMPLETE) – another fun Ability, lets you command someone. (Probably needs more testing.) A rewritten version of CMonkey123’s Emote script is included with this system, and is required for the Hypnotism script.
PreyTracking – (NOT IMPLEMENTED)
SpeakToAnimals – (COMPLETE) – probably an overly powerful ability, it lets you commune with the animals around you so that they will guard you for a short time.
Woodworking – (PARTIAL) – this Ability lets you create odd bits like unfinished table legs, etc. The ‘crafting’ part is done, but I was originally planning on making it so you could then combine parts, stain the items, etc. None of that was done.
Cooperage – (PARTIAL) – barrel-making 101. (I never knew there were so many names for barrels.)
Spinning – (COMPLETE) – when you use Raw Wool on a spinning wheel you will get Grey Yarn. This Ability is another one of those that seeks to answer ‘why is it that everyone is born with this knowledge?’ (If you want to use this Ability, and Weaving also, you might want to change your Tailor vendors so that they buy and sell the new products. Check the scripts for the names you will need.)
Weaving – (COMPLETE) - when you use Yarn or Thread on a loom, it’s not necessarily Automatic. This is an Ability you must learn.
Construction – (PARTIAL) – this is mostly complete. This Ability measures your competence in adding various building components to the House Recipe you are attempting to construct. To implement this, the Foreman must be spawned, and you must also have a way of selling or giving away House Recipes.
Commerce – (COMPLETE) Completed Commerce system - Customizable percentage increase/decrease when buying or selling from vendors. Requires DISTRO EDIT to fully implement. (Sorry)
Brewing – (*NEW* IMPLEMENTED) Use various Tree Resources on a Heat Source to produce various Tree Products. (Make sure you have large vials or wooden bowels in your inventory.)
Herblore – (*NEW* IMPLEMENTED) Use various Tree Resources on a Mortal and Pestle to produce various Tree Products. (Make sure you have large vials or wooden bowels in your inventory.)
Teaching – (PARTIAL) – this was intended to be an Ability that lets you impart some of your knowledge of Abilities to others. The only part that is implemented is that every time you raise an Ability, there is a chance that your Teaching Ability will go up also. Check the file ‘Ability Utilities’ to see how that works.
Linguistics – (COMPLETE) – I really like this Ability. When this is enabled, any time you talk with someone who is of another race than yours, you may not understand what they are saying completely. The system automatically translates your words into a foreign dialect, unless you are listening to someone of your own race. Those with some ability in Linguistics will be able to piece together a word here, and a word there. This Ability requires the file ‘words.txt’ which should be located in the Data directory. A sample is included below. You can if you wish redesign the linguistic database using your own translations. Just make sure the format is the same – word, then the “|” pipe symbol, then the translation.

3. Building System:

The Building system was copied almost entirely from the Core RunUO Crafting system. Modifications were made to allow it to compile independently from the Core, and to use the Ability system rather than RunUO Skills. As described above, the Roofer, Framer, etc, will be able to build various components needed in the construction of houses. These components can then be brought to the Foreman, where he will add them to your House Recipe for you. Most of the Building system was tested extensively.



NOTES:

I may at some point spend more time on this or other systems, but I cannot guarantee that I will, nor can I promise to support the use or modification of this system. If I have time I will check in from time to time, but in general, consider this to be an ‘As-Is’ work, with no support.

I do NOT use Instant Message programs as often any more, so don’t be surprised if you don’t see me online. I wish I could be more active here, but I have several full-time obligations that require my attention elsewhere.

I really do enjoy creating scripts for RunUO, and I also enjoy sharing them with the community. I hope someone gets something useful from this submission.

UPDATE:

1.1: Uploaded new zip file, with fix to Doors.cs and BuildResources.cs.

1.2: New file, added ability to hide Abilities in ShowAbilities gump.

1.3: New file, Fixed Linguistics, so vendors, bankers, etc will respond to speech events.

1.4: New file, added Ability Ball to supporting files, changed Thread to ThreadSpool in supporting files.

1.5: New file, modified Ability Ball to not show hidden Abilities. Added null check to BuildItem script.

1.6: New file. Added improvements as follows:

  • Master Ability Item more stable - I was able to delete an account with characters that were part of the system, and was still able to restart the Server without error.
  • Added Construction supplies and house recipes to the SBForeman script, so if you add a Foreman to your shard, he will now sell everything you need to get started.
  • Started filling out uses for Tree Resources. Double-click now asks for target, and I have several started, including TreeSap becoming Pitch Supply if you use it on a Heat Source.
  • System now updated for RunUO 2.2 or SVN through at least R752.
1.7: New file.
  • Improvements to SpeakToAnimals to make it so they are released from following.
  • A couple minor changes to Skinning and Butchering.
  • Also included is a recommended change to RunUO file BladedItemTarget.cs. If you have custom changes in your file, simply copy/paste the section marked by comments in the script to your script, otherwise for RunUO 2.2, just drop mine in your Targets folder and overwrite the original. This recommended change will cause double-clicking a dagger, cleaver, butcher's knife or skinning knife to utilize the Abilities system.
  • Correct BladedItemTarget.cs file now uploaded.
1.8: New File.
  • Completed Commerce system - Customizable percentage increase/decrease when buying or selling from vendors. Requires DISTRO EDIT to fully implement. (Sorry)
To implement Commerce, install new file and overwrite, as usual. Use [props on the MasterAbilityItem to ENABLE Commerce. This will automatically allow you to sell by activating the Commerce Ability from the ShowAbilities gump. In order to be able to have Commerce affect buying prices, you need to modify BaseVendor:

Find this code:

Code:
            if ( validBuy.Count == 0 )
                return false;
 
            bought = ( buyer.AccessLevel >= AccessLevel.GameMaster );
 
            cont = buyer.Backpack;
            if ( !bought && cont != null )
            {
                if ( cont.ConsumeTotal( typeof( Gold ), totalCost ) )
                    bought = true;
                else if ( totalCost < 2000 )
                    SayTo( buyer, 500192 );//Begging thy pardon, but thou casnt afford that.
            }

After "cont = buyer.Backpack;" and before the "if ( !bought && cont != null )" you need to insert the following code:

Code:
            // Abilitiy System Modification Start ---->
            if (MasterAbilityItem.CommerceEnabled)
            {
                int commerceCost = totalCost;
                string commerceSkill = "non-existent";
                if (!MasterAbilityItem.Abilities.ContainsKey(buyer))
                    MasterAbilityItem.Abilities.Add(buyer, new Abilities(buyer));
                Ability ability = MasterAbilityItem.Abilities[buyer].Commerce;
 
                SuccessRating rating = AbilityUtilities.CheckAbility(buyer, ability, 0.0, 100.0);
                switch (rating)
                {
                    case SuccessRating.CriticalFailure:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.CriticalFailure);
                        commerceSkill = "horrible";
                        break;
                    case SuccessRating.HazzardousFailure:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.HazzardousFailure);
                        commerceSkill = "terrible";
                        break;
                    case SuccessRating.Failure:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.Failure);
                        commerceSkill = "lousy";
                        break;
                    case SuccessRating.PartialSuccess:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.PartialSuccess);
                        commerceSkill = "mediocre";
                        break;
                    case SuccessRating.Success:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.Success);
                        commerceSkill = "good";
                        break;
                    case SuccessRating.CompleteSuccess:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.CompleteSuccess);
                        commerceSkill = "adpet";
                        break;
                    case SuccessRating.ExceptionalSuccess:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.ExceptionalSuccess);
                        commerceSkill = "exceptional";
                        break;
                    case SuccessRating.TooEasy:
                        commerceCost = (int)(totalCost / AbilityHandlers.Commerce.TooEasy);
                        commerceSkill = "unquestionable";
                        break;
                    default:
                    case SuccessRating.TooDifficult:
                        commerceCost = (int)(totalCost * AbilityHandlers.Commerce.TooDifficult);
                        commerceSkill = "non-existent";
                        break;
                }
                SayTo(buyer, "Normally, I would charge {0}, but due to your {1} commerce ability, I am charging you {2}.",
                    totalCost, commerceSkill, commerceCost);
                totalCost = commerceCost;
            }
            // Abilitiy System Modification End <----

1.9: New File. (.zip and .7z files included.) Updated Tree Resources and Tree Products to behave closer to the final desire for this system. Brewing and Herblore now implemented using Tree Resources on a Heat Source (Brewing) or Mortar and Pestle (Herblore) to produce Tree Products. Also small mod to TreeHarvest.cs to better define resources found in various trees.

1.9A: New File (.zip and .7z files included.) Modified Linguistics to allow Admin to determine the cut-off AccessLevel for forced translations. To use, set "LinguisticsLevel" on the MasterAbilityItem to the AccessLevel at or below which you wish to force language translations.

NEW FILE SYSTEM UPLOADED:

Now only 2 ZIP files uploaded. Both contain all current updates. One is for use with any version of 2.0 RC2 through FINAL (SVN 285 - 399.) The other file is for use with 2.1, 2.2, and later (tested up to SVN 830.)

I did this because I don't want anyone using an outdated version of this script simply because they are not able to compile the new one. All old revisions of this system have been removed.

*UPDATE 2/15/2012*
Created ORB SA-compatible system. Basically Ability = LokaiSkill. (There was much more to it than that, but suffice to say, it works.) Enjoy.
 

Attachments

  • words.txt
    28.1 KB · Views: 87
  • BladedItemTarget.cs
    5.1 KB · Views: 74
  • Abilities System for 2.0 RC2-FINAL(v285-399).zip
    135.4 KB · Views: 66
  • Abilities System for 2.1-2.2(v605-830).zip
    135.4 KB · Views: 114
  • Lokai Skills System for ORB SA.zip
    135.7 KB · Views: 78

LordHogFred

Knight
Awesome, this is excellent!
Is it possible to enable/disable various abilities if we don't want to use them?
Also how complex is it to add new abilitiesto the current set?
I can tell I will be using this system quite a lot :p.
 

Lokai

Knight
The only ones I created "On/Off" switches for so far are Sailing, Riding, and Linguistics. You just [props the Master Ability Item, and set to true or false.

It should be fairly easy to add similar booleans to the MAI, then add a check for it in the appropriate script. Of course some of it is fairly obvious - if you don't want Tree Harvesting, just don't give anyone a Tree Harvest Tool.

As for adding new Abilities, if you modify the number of Abilities, you may have issues with the Ability Gump, not sure, but you can certainly rename one of the ones that has yet to be implemented, like Herblore, and do simple search/replace in the appropriate scripts.

LordHogFred;814782 said:
Awesome, this is excellent!
Is it possible to enable/disable various abilities if we don't want to use them?
Also how complex is it to add new abilitiesto the current set?
I can tell I will be using this system quite a lot :p.
 

David

Moderate
Very nice; and very well conceived Lokai. This is the type of project that I really enjoy. I just *might* pick this up and run with it when/if I finish my current RunUO project.
 

Lokai

Knight
David;814815 said:
Very nice; and very well conceived Lokai. This is the type of project that I really enjoy. I just *might* pick this up and run with it when/if I finish my current RunUO project.

I would like that.

Two Wolves;814816 said:
is there an Abilities point cap like the Skill point cap?

Yes. The caps are listed in Abilities.cs, line 44-46. They start at 10, go up to 100, and have a combined limit of 3000. These are adjustable to suit your liking, of course.

Just like skills, you will also want to adjust the speed at which the Abilities raise levels. You can find this in AbilityUtilities.cs.
 

Lokai

Knight
Here are some screenshots, for those curious, but not curious enough to try it.

This is the Abilities Gump. (Look familiar?)



This is the "ShowAbilities" Gump:



And when you click the little brown tab next to the blue dot, you get a small drag-away Gump for the individual Ability.



When you log in to the shard for the first time after installing this, it will give you a Master Ability Item. This Item is the key to the entire system, so I have made it resistant to deletion. If you attempt to delete it without there being another one in existence, it will deny the request.

 

mikeymaze

Wanderer
Looks good

Really cool idea's having issues with doors tho
PHP:
+ Items/Construction/Doors/Doors.cs:
   CS0101: Line 126: The namespace 'Server.Items' already contains a definition
for 'MetalDoor'
   CS0101: Line 152: The namespace 'Server.Items' already contains a definition
for 'BarredMetalDoor'

i tried to comment those lines out but still no idea even tried to change it to barredMetalDoor3
 

Lokai

Knight
UPDATE:

Uploaded new zip file, with fix to Doors.cs and BuildResources.cs.

Basically, all I did was a search and replace in those 2 files, changing MetalDoor to Metal_Door.
 

Dionsyus

Wanderer
Im Having an error when compiling


Errors:
+ Multis/HouseFoundation.cs:
CS0104: Line 2396: 'Thread' is an ambiguous reference between 'System.Thread
ing.Thread' and 'Server.Items.Thread'

anyone have any ideas?


Lokai Thank you for this wonderful system!!!!
 

Lokai

Knight
Dionsyus;814858 said:
Im Having an error when compiling


Errors:
+ Multis/HouseFoundation.cs:
CS0104: Line 2396: 'Thread' is an ambiguous reference between 'System.Thread
ing.Thread' and 'Server.Items.Thread'

anyone have any ideas?


Lokai Thank you for this wonderful system!!!!

I don't get this error because I compile my scripts independently from the Core. However, you can fix it by changing lines 2396 and 2404 of HouseFoundation.cs, replace "Thread" with "Threading.Thread". That should remove the ambiguity.
 

Dionsyus

Wanderer
alright man i did it now i get a new error..im pretty new to this and i know u said no support but here is my error and the lines that i changed:

Errors:
+ Multis/HouseFoundation.cs:
CS0246: Line 2396: The type or namespace name 'Threading' could not be found
(are you missing a using directive or an assembly reference?)



Line 2396:private static Threading.Thread m_Thread;

Line 2404:m_Thread = new Threading.Thread( new ThreadStart( CompressionThread ) );

im sure i did it wrong lol
 

Lokai

Knight
Dionsyus;814864 said:
alright man i did it now i get a new error..im pretty new to this and i know u said no support but here is my error and the lines that i changed:

Errors:
+ Multis/HouseFoundation.cs:
CS0246: Line 2396: The type or namespace name 'Threading' could not be found
(are you missing a using directive or an assembly reference?)



Line 2396:private static Threading.Thread m_Thread;

Line 2404:m_Thread = new Threading.Thread( new ThreadStart( CompressionThread ) );

im sure i did it wrong lol

Wow, your compiler is so picky. Try "System.Threading.Thread" instead.
 

September

Sorceror
Wow

WOOOOOOW ! :eek::eek::eek::eek::eek::p
This is SO great *Bows* lol

Will Download this and give it a go for sure, I am in love with any type of "sysytem" and dream of all the capabilities UO has and You have definatly shown to be and ultimate dreamer at that i mean what REALLY great ideas!!!! So Impresive! and It all looks so nice also, what is really astonishing is that you did all this "it will work as-is with no modifications" ... and this also still has so much potential too it, You have completed quite a bit,
i see why you strayed away i mean you could just go crazzzzzzzzy with this project,..lol. Nice work For sure!
 

M_0_h

Page
If you are using the XmlSpawner Systems you could also think of replacing the MasterAbilityItem with a XmlAttachment... It's always a bad way to handle such things via items... another thing you could try is to make a seperate serialization file for the stats of each player which could be loaded when your shard loads :)

the system itself looks very nice, I'll give it a closer look, thanks for the contribution! ;)
 

mikeymaze

Wanderer
I know you said there is little to no support but i have changed the following i think as you said and here is the changes i made, might be wrong

Code:
private static System.Threading.Thread m_Thread;

		static DesignStateDetailed()
		{
			m_SendQueue = new Queue<SendQueueEntry>();
			m_SendQueueSyncRoot = ((ICollection)m_SendQueue).SyncRoot;
			m_Sync = new AutoResetEvent( false );

			m_Thread = new System.Threading.Thread( new ThreadStart( CompressionThread ) );
			m_Thread.Name = "AOS Compression Thread";
			m_Thread.Start();
		}

Here is the errors i get also with the xml problem people said above
Errors:
+ Customs/New Customs/XML/XmlSpawner2_20_v324_3of3/XmlUtils/XmlFind.cs:
CS0104: Line 2216: 'Thread' is an ambiguous reference between 'Server.Items.
Thread' and 'System.Threading.Thread'
CS0104: Line 2216: 'Thread' is an ambiguous reference between 'Server.Items.
Thread' and 'System.Threading.Thread'
CS1502: Line 2216: The best overloaded method match for 'Server.Items.Thread
.Thread(int)' has some invalid arguments
CS1503: Line 2216: Argument '1': cannot convert from 'System.Threading.Threa
dStart' to 'int'
CS0117: Line 2218: 'Server.Items.Thread' does not contain a definition for '
Start'
+ Lokai Custom/Abilities System/Abilities/Pilfering.cs:
CS1501: Line 127: No overload for method 'RandomClothing' takes '1' argument
s
thanks and if u want me to go to support then i will sorry
 

Lokai

Knight
mikeymaze;814888 said:
I know you said there is little to no support but i have changed the following i think as you said and here is the changes i made, might be wrong

Code:
private static System.Threading.Thread m_Thread;
 
        static DesignStateDetailed()
        {
            m_SendQueue = new Queue<SendQueueEntry>();
            m_SendQueueSyncRoot = ((ICollection)m_SendQueue).SyncRoot;
            m_Sync = new AutoResetEvent( false );
 
            m_Thread = new System.Threading.Thread( new ThreadStart( CompressionThread ) );
            m_Thread.Name = "AOS Compression Thread";
            m_Thread.Start();
        }

Here is the errors i get also with the xml problem people said above

thanks and if u want me to go to support then i will sorry

Probably easiest thing to do is to change my Thread to something else. I was going to use NewSpoolOfThread, then changed it to just Thread, thinking it would not conflict, but evidently it causes ambiguity issues. There are I think 3 scripts in the Supporting Files folder that reference Thread. Change them to something else using Search/Replace, like NewThread. That should fix it.

As for the Pilfering error, all the Loot scripts I have worked with take a bool argument, but evidently the one you are using does not. So, just change line 127 to read like this instead:

Code:
Item item = Loot.RandomClothing();
 
Top