#author("2025-05-30T14:04:45+09:00","default:admin","admin") #author("2025-06-03T15:23:40+09:00","default:admin","admin") *''What are Plugins?'' [#a3a17c8a] Plugins are features that extend the functionality of Bakin's tools and engine programmatically using C#. There are two main types of plugins: - ''Tool Plugins (.dll format)'' - ''Engine Plugins (.cs format)'' As of March 2025, only engine plugins have been released for the creation environment. **Plugin Types [#g95890dc] //ここは記載しない可能性があります。 //- Tool plugins are used to extend Bakin's editor. //Tool plugins are further subdivided into the following three types: //-- ''Data Extension'': Add more optional specifiers to data such as casts and items. //-- ''Class Extension'': Add new data types separate from casts, items, etc. //-- ''Tool Extension'': Add new tools to the editor's main menu or edit menu //(The Sprite Tool included with the main unit uses this mechanism.) //ここは記載しない可能性があります。 - Engine plugins are used to extend the operation of the Bakin engine. The engine plugin currently has the following two types of functions: --''Event Scripts'': Extend the functionality of events by assigning C# programs to them -- ''Battle Plugins'': Replace Bakin's battle system with a C# program **How to Use Plugins [#f559cc12] - For engine plugins, create the folder specified in the description below directly under the project folder you are editing and store plugins in it. -- ''Event Scripts'' ---First create a 'script' folder and add the .cs file to it. ---After launching Bakin, click the arrow in the "C# Program Assignment" field on the lower left of the event sheet. ---Select the script you wish to assign from the list that opens. #ref(./EventEditor_UsePlugin.png,50%) ---Plugins with multiple methods can use the event panel to specify which method to apply. See [[Control]] for the "Call C# Program" panel. ---''Notes'' cs files can also be stored in subfolders. Note that the dll file must be placed directly under the script. -- ''Battle Plugins'' ---Create a 'battlescript' folder and add a set of .cs files to it. ---It is applied automatically when the project is launched, and no tool operation is required. //ここは記載しない可能性があります。 //- The tool plugin (currently not yet created environment) adds a DLL file to the 'plugins' folder of the Bakin installed destination. //Then, new entries will be added to the Database or Main Menu. //ここは記載しない可能性があります。 *** Delete Plugins [#rdb1a566] //ここは記載しない可能性があります。 //- For tool plugins, remove the dll file from the 'plugins' folder. //ここは記載しない可能性があります。 - ''Event Scripts'': Delete the .cs file you wish to remove from the 'script' folder. - ''Battle Plugins'': Delete the entire 'battlescript' folder. You can also use "Remove Battle-Related Scripts from Game File" in the Map Editor's top menu > Functions > Expanded Features. **How to Create Plugins [#hf249d00] ''&color(red){(!)Bakin updates may affect the operation of plugins created in the past. Please check the differences each time an update occurs.};'' - ''Event Scripts'' After launching Bakin, click the arrow in the "C# Program Assignment" field on the lower left of the event sheet. Press the "Create New" button at the top to start the editor (the editor associated with .cs). #ref(./EventEditor_Plugin.png,50%) --It is recommended that Visual Studio (Community version is acceptable) be installed with C# development ready. --You can also use other editors to create .cs files and put them in the 'script' folder without going through Bakin. - ''Battle Plugins'' Execute "Copy Battle-Related Scripts to Game File" in the Map Editor's top menu > Functions > Expanded Features. See [[Map Editor Overview]] for more information on this feature. When executed, a 'battlescript' folder will be created in the project folder currently being edited, and a battle plugin template (the same as the default battle process) will be created in that folder. Edit the created file with your editor. //ここは記載しません。 //- Tool Plugins //You will find various tool plugin templates (zip files) in the "SDK" folder of your Bakin installed destination. //Unzip the Zip file and edit it with your editor. //Open the .sln file in Visual Studio 2019 (install C# desktop development). //References to SharpKmyCore, Common, Yukar Editor, Yukar Engine, SBControl, etc. will have their paths broken, so delete them and reconnect the references from the Bakin installed destination folder. //Now all that is left is to build for x64 and the tool plugin (.dll) is ready. //ここは記載しません。 - ''Metadata Settings'' -- No metadata in event scripts. -- For battle plugins, replace // @@version xx.xx.xx.xx.xx at the beginning of BattlePluginDef.cs with the corresponding Bakin version. //ここは記載しません。 //-- For tool plugins, edit PluginDef.cs to change the plugin name, icon, description, etc. that appear in the editor's Version information. //ここは記載しません。 - ''Plugin Help'' If you distribute plugins and need to explain the contents, please create and include a readme.txt file. - ''Plugin Settings'' There is currently no ability to specify plugin preferences. ***Key Points When Creating Plugins [#fbdaae55] - ''Link Any DLL'' By making the following statement at the beginning of a C# program, you can link and use any DLL file in the script folder. This feature can also be used to load DLLs in the script folder. Please refer to "Introduce Steam "Achievements" into the Game" in [[Plug-in Samples]]. Please refer to "Introduce Steam "Achievements" into the Game" in [[Plugin Samples]]. // @@link xxx.dll - ''Import Another cs File'' You can import another cs file by making the following statement: // @@include xxx.cs Please use this option when a large process is divided into multiple cs files. Refer to the battle plugins in "Battle Plugin Samples". By inserting the above description into BattlePluginDef.cs in various places and incorporating the processing of branches and leaves, all battle processing is made the target of the build. -''Access C# Assigned to Another Event'' By using @ref and writing as follows, you can access C# assigned to another event. + Write the following for the cs file of another event you want to access at the beginning of the cs file // @@ref OtherScript.cs #br +Obtain target MapCharacter from mapScene var chr = mapScene.mapCharList.Find(x => x.Name == "Name_of_Another_Event"); #br +Access members of a class assigned to another MapCharacter through a cast ((OtherScript)chr.bindedScript).field = "ABC"; - ''Resources Referenced Only from Plugins'' If you have a resource that is referenced only from a plugin, you must specify that resource as the target for export. To specify, right-click on the resource you wish to export in the tree of entries in the [[Resources:https://rpgbakin.com/pukiwiki_en/#u0a87ff3]] menu, and then select ''“Be Sure to Include in Published Work Export”''. **Plugin Distribution [#gb975bfd] - ''Event Scripts'': Distribute the created cs files in any way you wish. - ''Battle Plugins'': Zip the entire 'battlescript' folder and distribute it in any way you wish. //ここは記載しません。 //- For tool plugins: Distribute the dll file in any way you wish. //ここは記載しません。 ***Distribution as .csrbr Files [#m0d8bccc] Compressing the event script .cs files and related files into a Zip file and rewriting the extension to .csrbr will make distribution and importing into Bakin easier. -They can distribute through the [[Steam Workshop]]. -In the event sheet "C# Program Assignment", click the Add button to select the .csrbr file. Once added, the .csrbr file will be automatically decompressed and extracted. ---Battle plugins cannot be distributed in .csrbr format. **Plugin Reference [#df2f4fe2] References to currently available classes can be found at the following URL. RPG Developer Bakin Plugin Reference:https://rpgbakin.com/csreference/ As of September 2023, the classes used in the creation of event scripts and battle plugins are available to the public. **Plugin Samples [#a9104cdd] See [[Plug-in Samples]] for sample codes of the plugins. See [[Plugin Samples]] for sample codes of the plugins. Explanations of the sample codes published on the Steam Workshop are available.