设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 51|回复: 0

[制作教程] Programming Plugins Tutorial

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    慵懒
    3 天前
  • 签到天数: 207 天

    连续签到: 1 天

    [LV.7]常住居民III

    3646

    主题

    862

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    21262
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    25800

    灌水之王

    发表于 前天 18:20 | 显示全部楼层 |阅读模式
    Programming Plugins Tutorial


            This is a basic overview of how to write plugins in RPG Maker MV. It will continually be improved upon, adding more details.


    Make sure to read JS Basics on my blog before diving in if you have no idea how to program. it will help get your feet wet.


            Go here to understand the API of pixi.js the framework that RPG Maker uses for its JS renderer.


    http://pixijs.github.io/docs/


            1. Define parameters. The first bit "Default 0" is the text that is shown in the Plugin Manager, the 2nd bit is the actual parameter value that is set. 0 or 1 equals false or true, too.


    * @param Max Resolution Height
    * @desc The max height you want your game to have.
    * Default: 0
    * @default 0






            2. Create a global namespace, which is your global identifier for the class. A class being what holds all your functions and code aka the template. Do not use .js at the end of NAMEOFPLUGIN and make sure to replace NAMESPACE with the name of your identifier such as your name or custom plugin/framework name.


    NAMESPACE.Parameters = PluginManager.parameters('NAMEOFPLUGIN');
    NAMESPACE.Param = NAMESPACE.Param || {};






            3. Set your parameter. Replace PARAM with the name of the parameter you want to call it. 0 is the default value it will load if it is not loaded properly for whatever reason.

                    Code:        
    NAMESPACE.Param.PARAM = eval(String(NAMESPACE.Parameters['PARAM'] || "0"));






            You can test your parameter value by using something like this. If you check for these you do not have to check if they are 0 or 1; you can simply check if they are true or false using a typical if statement. By default the statement will check for a true or false based on the variable that is specified.


     if (NAMESPACE.Param.PARAM)
    {
            // Do work here.
    }






            4. Define any custom functions you want. You can either extend a function or override it. It is suggested to not override where possible. Overridding a function means any code that was defined previously to your plugin (in ascending order - any that are above will not be called). Where if you extend a function, it will keep all the previous code that has been called.


            To override a function simply copy the function entirely and change it how you see fit. make sure to place the override function below the function you want to override.


            To extend a function you have to set the function to a variable or object, this allows you to duplicate the function code in another instance to be called again. You then have to call that instanced function using that variable or object inside the function.


    Helladen.ScrRes.SceneManager_run = SceneManager.run;
            SceneManager.run = function(sceneClass) {
            Helladen.ScrRes.SceneManager_run.call(this, sceneClass);
    }






            5. Create your custom logic now. Use the basic principles that I have shown you to do that. You can create additional functions and use those inside the functions you either override or extend. This is how you expand the codebase.


            Use this code to debug. You can specify entire objects then break them open inside the log window. To open this window up, simply press F8.

                    Code:        
    console.log("Hello World.");






    If you would like me to continue expanding this tutorial, reply here with what you need help with learning.


    本贴来自国际rpgmaker官方论坛作者:Helladen处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/programming-plugins-tutorial.66514/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-10 03:04 , Processed in 0.072196 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表