This will only cover the BASICS of plugin making. I will add more to this when the video is up ( i.e. how to pull params from the user to use in your plugin)
A video will accommodate this in a little bit. You will NOT become a level 99 Warlock after this... maybe. a level 5 Wizard?.
Anyways,
1. Download my template
View attached files.
2. Download an IDE, or a Text editor specifically for coding ( I use Notepad ++) (you can use regular note pad, but that's boring)
https://notepad-plus-plus.org/
3. Load my Template and read through my comments. You can adjust code if you'd like.
Believe it or not, this is actually a working plugin as well. Load this to your plugins folder and turn
on your Text Drawing on your title screen.. see what happens!
* I will explain this below for the newer guys later tonight* Please read through replies on this thread for errors or best practice.
Shaz said:
Moving to Learning Javascript, & pinning
I think you should highlight the aliasing and calling of aliased methods more. First read through I didn't think you had it in there at all. This should be explained VERY well, and recommended as best practice, otherwise we're going to get a LOT of people writing plugins that just overwrite methods, which is going to give us a lot of incompatible plugins.
Click to expand...
JavaScript:
//============================================================================= // Toms_Example Template // by Faytless / Thomas Pham // Date: 10/25/2015 //============================================================================= /*: * @plugindesc xxxxx // Describe your plugin * @author yyyy // your name goes here * * @param xxxxx //name of a parameter you want the user to edit * @desc yyyyy //short description of the parameter * @default zzzzz // set default value for the parameter */ // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // Declare your function // 1. change *** to your plug ins file name below. // You are telling RPG maker that this plugin exsists. (function() { var parameters = PluginManager.parameters('template'); // NOTE: THIS WILL NOT MAKE YOU A DARK WIZARD. HERE ARE SOME BASE FOR YOU TO LAY A FOUNDATION FOR PLUGINS! // Now find something you want to edit in the core plugins. You can // find them in the Project\www\js folder // 2. find the EXACT function you want to edit /* This function can be found in rpg_scenes.js Scene_Title.prototype.drawGameTitle = function() { var x = 20; var y = Graphics.height / 4; var maxWidth = Graphics.width - x * 2; var text = $dataSystem.gameTitle; this._gameTitleSprite.bitmap.outlineColor = 'black'; this._gameTitleSprite.bitmap.outlineWidth = 8; this._gameTitleSprite.bitmap.fontSize = 72; this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center'); */ // You need to come up with a name for your modification while keeping // class name the same. // the name of the function I want to edit is called // Scene_Title.prototype.drawGameTitle // The name of my function will be called _Scene_Title_xxx // Follow for ease of use, follow the template below. // Start your var as _NAME_NAME_YOURCLASSNAME // Have it equal the function you are replacing var _Scene_Title_xxx = Scene_Title.prototype.drawGameTitle; // make your adjustments by adding code, or adjusting them below. // This is an exact copy of the code above, but with some of my adjustments // to some of the parameters. Later, I will show how you can call your parameters that the user adjusts // so your plugin has a little more control Scene_Title.prototype.drawGameTitle = function() { // _Scene_Title_xxx.call(this); //sometimes you have to call your function to get this to work. In this case you don't Ill explain why later. var x = 20; var y = Graphics.height / 4; var maxWidth = Graphics.width - x * 2; var text = $dataSystem.gameTitle; this._gameTitleSprite.bitmap.outlineColor = 'black'; this._gameTitleSprite.bitmap.outlineWidth = 8; this._gameTitleSprite.bitmap.fontSize = 200; this._gameTitleSprite.bitmap.drawText(text, 0,0 , maxWidth, 48, 'center'); } })(); // dont touch this.
本贴来自国际rpgmaker官方论坛作者:Faytless处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/tutorial-the-absolute-basics-of-plugin-making.47215/