Brief guide to making custom skills by Inge
This is a guide to the minimum you need to do to create a hidden custom skill
I'd suggest you download this example/template package to look at while reading... SkillTutExample.rar
In order to use this guide you will need some experience of Sims 3 script modding and xml editing, and have a package editor.
SkillTutExample.package contains a working skeleton custom skill, that you can use as a template if you wish. I have included the source code file in the download to save you having to ilspy the dll.
SKIL xml resource
Group 0x00000000 (indicates basegame compatible)
Instance (your unique instance number - it doesn't have to be a hash of anything in particular)
Inside the SKIL:
The first <SkillList></SkillList> list of entries needs to be left alone.
The second set I filled in represents the bare minimum of entries I believe you need in order for the game to accept and handle a custom skill at all. Note that none of the text in this xml appears to a player, so you don't have to make it human-friendly
<SkillName> YourUniqueSkillName - this is used to provide the hash guid for the STBL entry
<SkillDescription> Another unique string (STBL entry optional)
<Hex> YourUniqueSkillName=FNV32 of YourUniqueSkillName. Write number in hex format No spaces
<CustomClassName> Namespace.Class of your class, then comma, then name of your dll (without the .dll) If you decide to make the skill a nested class of another class, then you use + rather than . eg Namespace.Class+NestedClass
<MaxSkillLevel> Starting level is 0. 10 is the highest value you can use here. If you want to you can also provide your own <Level_number> entries to override the default points per level entries.
<Commodity> AnotherUniqueName (Mostly it seems to be the same as YourUniqueSkillName with the word Skill stuck on the front - ie "SkillYourUniqueSkillName") = FNV32 of AnotherUniqueName. Again hex format, no spaces
<Hidden> use True. This simple guide will not make a skill with enough features to appear to the player
<AvailableAgeSpecies> Initial letter of age (remember toddler = P though, and babies are not a real sim so they don't have a letter) species would be for example AH for adult horse.
<Version> Essential field. Just leave it as 1.0
The other fields I just included because my store object example did. You can see they were just filled in with something that looks like fallback data, and in a hidden skill shouldn't show anyway. Obviously if you were venturing to make a non-hidden skill you would have your own values for these.
You will need at least one STBL entry, because the SkillManager checks for its existence before agreeing to accept the skill. The GUID of the entry should be FNV64 of Gameplay/Excel/Skills/SkillList:SkillName Instead of "SkillName" use the name you are using in your <SkillName> tag in the xml
Tuning xml for my bootstrapper class, see below
You will need a script with a class that acts as a "bootstrap" to load the skill before the game starts running. I include a template code file (SkillExample.cs), and basically what it does is:
A variable called kInstantiator - a tunable, which means it has an xml tuning entry. This is just some weird thing you have to do to get the class to be created at runtime without actually creating it via a game object script. That means the class's constructor method will run as the game is loading, and therefore set up the event handler that in turn loads the skill. The tuning xml's instance needs to be FNV64 of Namespace.Classname - and this is the class that kInstantiator is in, not the Skill class itself. Do not forget the [assembly: Tunable] directive like I always do and spend hours wondering why the tuning xml is not working!
OnPreload is the event handler for the game getting to a certain point in loading. I am not sure exactly when it runs but it's the right time to load skills! It reads your SKIL. Fill in the "new Resourcekey" params with the type, group, and instance of your SKIL resource.
The actual skill class
I didn't mention this before but if you had wanted to you could leave out the <CustomClassName> in your SKIL xml and your skill would simply borrow the base Skill class, tuned by your SKIL entries. However there is quite a lot you may not be happy with when it comes to testing (in my case I didn't like that when you tell it to add a skill point, it multiplies that number by 8 because the sim is in a good mood etc etc) and by having your own skill class it means you can easily create override methods. Anyway it needs at least the constructor, of course...
I finally added a class to represent your object or whatever that has a method with examples how you can give a sim the skill and increment his points.
You can test whether your skill is loaded properly by using Twallan's Master Controller, with his Cheats module, then click on a Sim - Advanced - Skill Levels and see if you can spot your skill name in the list. It will be what you called it in the STBL.
Finally credit to Twallan for a lot of help he gave me when learning how to make my own skill.