SunLikeModLib (latest version is Nov 29)
How to use this library in mod development
1. Add reference to library to .csproj file
2. Add BepInEx dependency annotation in plugin code
3. Use library methods to register new items, effects, cheatcodes, etc.
4. Use ILSpy to see game classes, methods. I use ILSpy_selfcontained_x64_8.0.0. Open game's Assembly-CSharp.dll there.
How to create a new item
1. I recommend creating new class (after public class Plugin : BaseUnityPlugin). For example, FiredemonPotion - a new consumable item.
2. It will have 2 static methods, which we would pass into function that registers our item.
3. public static void LoadPotion(string name, Item result) - this will be called after item was loaded, to adjust it stats
4. public static bool PotionEffect(Stats target) - this will be called when player uses our item in game
when this method returns true - it means that item was successfuly used and the item charge will be consumed.
5. Register our item in the Awake() method
registerItemConsumable() - adds new consumable's effect. Game searches those effects by item name. So here we write our item name, and pass PotionEffect method from our class.
registerItem() - adds new item, so the game will know how to convert item name into item class, when it loads a save, or your item is added from cheat menu. Here we pass itemLoadingStruct, but for now, a simplified version. (Edit: in later versions of SunLikeModLib, itemLoadingStruct is moved to SunLikeModLib.ModItemStats.*; this was made so all "register" methods are in Plugin class, and other classes are mostly for internal use inside of library)
Item name here begins with ^ symbol, because its a regex, and this symbol means start of the string. Without it, regex would trigger for item "FakeFiredemonPotion" that is not ours. Second string is the name of item our item is based on. Use the name of similar existing consumable from the game. And finally, third line is our method of adjusting item stats.
6. Compile your plugin. Add its .dll into BepInEx plugin folder, add mod library dll too. Run game, use "item FiredemonPotion" cheat to add your item.
Update Jul 25: fixed critical bug when displaying units with fewer than 4 skills.
Files
Get Portals of Phereon BepInEx mods
Portals of Phereon BepInEx mods
Status | Prototype |
Category | Game mod |
Author | thesunlike |
More posts
- Expanded Items modMay 29, 2024
- Tavern Eggs modDec 26, 2023
- New combat status effectsNov 29, 2023
- Enchant Items mod (new, game ver 0.27)Nov 07, 2023
- DatingDeck modJul 25, 2023
- Unofficial patchJul 20, 2023
- Expand Professions modJul 19, 2023
- Angel Demon Shift modJul 11, 2023
- Enchant Items mod (old, game ver 0.24-)Jul 10, 2023
- SunLikeModLib - custom skill, skill combo and character town buttonJun 30, 2023
Leave a comment
Log in with itch.io to leave a comment.