扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 143|回复: 0

[转载发布] 請問使用插件讀取檔案失敗問題

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10465
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13215

    灌水之王

    发表于 2024-2-16 19:24:01 | 显示全部楼层 |阅读模式
    來源:
    https://atelierrgss.wordpress.com/rmv-battler-motion/

    我用了這個插件之後,如果讀取檔案就會失敗,但是新建遊戲就正常,在RPG裡面測試也是正常

    出錯訊息是

    用網頁的話會出現
    TypeError
    this._motion_idle_xy is undefined

    應用程序出現
    TypeError
    cannot read property '0' of undefined


    除錯通知
    TypeError: Cannot read property '0' of undefined
        at Game_Actor.Game_Battler.motion_Xaxis (MOG_BattlerMotion.js:194)
        at Sprite_Actor.Sprite_Battler.update_bmotion_position (MOG_BattlerMotion.js:438)
        at Sprite_Actor.Sprite_Battler.updatePosition (MOG_BattlerMotion.js:422)
        at Sprite_Actor.Sprite_Battler.setHome (rpg_sprites.js:487)
        at Sprite_Actor.setActorHome (YEP_BattleEngineCore.js:2513)
        at Sprite_Actor.setBattler (rpg_sprites.js:720)
        at Spriteset_Battle.updateActors (rpg_sprites.js:2626)
        at Spriteset_Battle.update (rpg_sprites.js:2418)
        at Spriteset_Battle.update (YEP_BattleEngineCore.js:2702)
        at Spriteset_Battle.Spriteset_Base.initialize (rpg_sprites.js:2121)

    腳本以下
    JAVASCRIPT 代码
    [code]//=============================================================================
    // MOG_BattlerMotion.js
    //=============================================================================

    /*:
    * @plugindesc (v1.2) Adiciona efeitos animados nos battlers.
    * @author Moghunter
    *
    * @param Shake Effect Actor
    * @desc Ativar o efeito tremer no aliado.
    * @default true
    *
    * @param Shake Effect Enemy
    * @desc Ativar o efeito tremer no aliado.
    * @default true
    *
    * @param Disable Blink Damage
    * @desc Desativar o efeito de piscar o battler no dano.
    * @default false   
    *
    * @help  
    * =============================================================================
    * +++ MOG - Battler Motion (v1.2) +++
    * By Moghunter
    * https://atelierrgss.wordpress.com/
    * =============================================================================
    * Adiciona efeitos animados nos battlers.
    *
    * =============================================================================
    * Para definir a animação de ação use a Tag abaixo na caixa de notas da skill.
    *
    * Motion Action: X
    *
    * 1 - Efeito Zoom.
    * 2 - Efeito giro para direita.
    * 3 - Efeito giro para esquerda.
    * 4 - Efeito pular.
    * 5 - Efeito ataque frontal.
    * 6 - Efeito rotação.
    * 7 - Efeito mover para direita.   
    *
    * =============================================================================
    * Para ativar os esfeitos de animações em posição de espera use as Tags abaixo.
    *
    * Breath Effect
    * Float Effect
    * Swing Effect
    *
    * =============================================================================
    * Histórico.
    * =============================================================================
    * (1.2) - Correção de não atualizar o efeito ao transformar o inimigo.
    *       - Correção do efeito tremer ao reviver o aliado.
    * (1.1) - Melhoria na animação de ação.
    *
    */

    //=============================================================================
    // ** PLUGIN PARAMETERS
    //=============================================================================
      var Imported = Imported || {};
      Imported.MOG_BattlerMotion = true;
      var Moghunter = Moghunter || {};

        Moghunter.parameters = PluginManager.parameters('MOG_BattlerMotion');
        Moghunter.b_motion_shake_effect_actor = String(Moghunter.parameters['Shake Effect Actor'] || "true");
        Moghunter.b_motion_shake_effect_enemy = String(Moghunter.parameters['Shake Effect Enemy'] || "true")
        Moghunter.b_motion_disable_blink_damage = String(Moghunter.parameters['Disable Blink Damage'] || "false")

    //=============================================================================
    // ** Game System
    //=============================================================================

    //==============================
    // * Initialize
    //==============================
    var _alias_mog_bmotion_sys_initialize = Game_System.prototype.initialize
    Game_System.prototype.initialize = function(){
            _alias_mog_bmotion_sys_initialize.call(this);
            this._bmotion = [false,false,false];
        if(String(Moghunter.b_motion_shake_effect_actor) === "true"){this._bmotion[0] = true};
            if(String(Moghunter.b_motion_shake_effect_enemy) === "true"){this._bmotion[1] = true};
            if(String(Moghunter.b_motion_disable_blink_damage) === "true"){this._bmotion[2] = true};
    };

    //=============================================================================
    // ** Game Action
    //=============================================================================

    //==============================
    // * Prepare
    //==============================
    var _alias_mog_bmotion_gaction_prepare = Game_Action.prototype.prepare
    Game_Action.prototype.prepare = function(){      
            _alias_mog_bmotion_gaction_prepare.call(this);
            if(this.subject().isEnemy()){this.set_bmotion_action();};
    };

    //==============================
    // * Set Bmotion Action
    //==============================
    Game_Action.prototype.set_bmotion_action = function(){      
            var item_notes = this._item.object().note.split(/[\r\n]+/);
        item_notes.forEach(function(note){
             var note_data = note.split(': ')
                     if(note_data[0].toLowerCase() == "motion action"){
                             var par = note_data[1].split(':');
                               this.subject().clear_action_data();
                   this.subject()._motion_action_data[0] = Number(par[0]);
             }
            },this);
    };

    //=============================================================================
    // ** Game Battler
    //=============================================================================

    //==============================
    // ** iniMembers
    //==============================
    var _alias_mog_bmotion_gbattler_initMembers = Game_Battler.prototype.initMembers;
    Game_Battler.prototype.initMembers = function(){
            _alias_mog_bmotion_gbattler_initMembers.call(this);
            this.set_motion_data();      
    };

    //==============================
    // * Notetags
    //==============================
    Game_Battler.prototype.notetags = function(){
            if(this.isEnemy){returnthis.enemy().note.split(/[\r\n]+/)};
            if(this.isActor){returnthis.actor().note.split(/[\r\n]+/)};
    };

    //==============================
    // ** Set Motion Data
    //==============================
    Game_Battler.prototype.set_motion_data = function(){
            this.clear_action_data();
            this._motion_damage_duration = 0;
            this._motion_damage_xy = [0,0];
            this._motion_idle_xy = [0,0];
            this._motion_idle_scale = [1.00,1.00];
            this._motion_idle_rotation = 0;      
            this._motion_collapse_scale = [0,0];
            this._motion_collapse_rotation = 0;
            this._motion_breath = [0,0,0,1.03,0,false];
            this._motion_fly = [0,0,0,60,0.35,false];
            this._motion_swing = [0,0.003,0.10,60,0.35,false];
    };

    //==============================
    // ** Clear Action Data
    //==============================
    Game_Battler.prototype.clear_action_data = function(){
            this._motion_action_data = [0,0,0,0];
            this._motion_action_xy = [0,0];
            this._motion_action_scale = [0,0];
            this._motion_action_rotation = 0;
    };

    //==============================
    // ** Is MotionActing
    //==============================
    Game_Battler.prototype.is_motionActing = function(){
            returnthis._motion_action_data[0] != 0;
    };

    //==============================
    // ** Set Battler Motion Data
    //==============================
    Game_Battler.prototype.set_battler_motion_data = function(){
            for(var i = 0; i < this.notetags().length; i++){               
                    if(this.notetags() == "Breath Effect"){this._motion_breath[5] = true};
                    if(this.notetags() == "Float Effect"){this._motion_fly[5] = true};
                    if(this.notetags() == "Swing Effect"){this._motion_swing[5] = true};
            };      
    };

    //==============================
    // ** OnBattleStart
    //==============================
    var _alias_mog_bmotion_gbattler_onBattleStart = Game_Battler.prototype.onBattleStart;
    Game_Battler.prototype.onBattleStart = function(){
        _alias_mog_bmotion_gbattler_onBattleStart.call(this);
            this.set_motion_data();
    };

    //==============================
    // ** Motion Xaxis
    //==============================
    Game_Battler.prototype.motion_Xaxis = function(){
            returnthis._motion_idle_xy[0] + this._motion_action_xy[0] +  this._motion_damage_xy[0]
    };

    //==============================
    // ** Motion Yaxis
    //==============================
    Game_Battler.prototype.motion_Yaxis = function(){
            returnthis._motion_idle_xy[1] + this._motion_action_xy[1] +  this._motion_damage_xy[1]
    };

    //==============================
    // ** Motion ScaleX
    //==============================
    Game_Battler.prototype.motion_ScaleX = function(){
            returnthis._motion_idle_scale[0] + this._motion_action_scale[0] + this._motion_collapse_scale[0];
    };

    //==============================
    // ** Motion ScaleY
    //==============================
    Game_Battler.prototype.motion_ScaleY= function(){
            returnthis._motion_idle_scale[1] + this._motion_action_scale[1] + this._motion_collapse_scale[1];
    };

    //==============================
    // ** Motion Rotation
    //==============================
    Game_Battler.prototype.motion_rotation = function(){
            returnthis._motion_idle_rotation + this._motion_action_rotation + this._motion_collapse_rotation;
    };

    //==============================
    // ** is Breath Mode
    //==============================
    Game_Battler.prototype.is_breath_mode = function(){
            returnthis._motion_breath[5];
    };

    //==============================
    // ** is Flying Mode
    //==============================
    Game_Battler.prototype.is_fly_mode = function(){
            returnthis._motion_fly[5] == true;
    };

    //==============================
    // ** is Swing Mode
    //==============================
    Game_Battler.prototype.is_swing_mode = function(){
            returnthis._motion_swing[5];
    };

    //==============================
    // ** Motion Shake
    //==============================
    Game_Battler.prototype.motion_shake = function(){
            this._motion_damage_duration = 30;
    };

    //=============================================================================
    // ** Game Enemy
    //=============================================================================

    //==============================
    // * Setup
    //==============================
    var _alias_mog_bmotion_genmy_setup = Game_Enemy.prototype.setup
    Game_Enemy.prototype.setup = function(enemyId, x, y){
            _alias_mog_bmotion_genmy_setup.call(this,enemyId, x, y);
            this.set_motion_data();
    };

    //==============================
    // * Transform
    //==============================
    var _alias_mog_bmotion_transform = Game_Enemy.prototype.transform
    Game_Enemy.prototype.transform = function(enemyId){
        _alias_mog_bmotion_transform.call(this,enemyId)
            this.set_motion_data();      
    };

    //=============================================================================
    // ** Game Action
    //=============================================================================

    //==============================
    // * Apply
    //==============================
    var _alias_mog_bmotion_gact_apply = Game_Action.prototype.apply;
    Game_Action.prototype.apply = function(target){
             var old_hp = target.hp;
            _alias_mog_bmotion_gact_apply.call(this,target);
            if(target.hp < old_hp){
                 if(target.isActor() && $gameSystem._bmotion[0]){target.motion_shake()};
                 if(target.isEnemy() && $gameSystem._bmotion[1]){target.motion_shake()};               
            };
    };

    //=============================================================================
    // ** Spriteset_Battle
    //=============================================================================

    //==============================
    // * Initialize
    //==============================
    var _alias_mog_bmotion_spriteseBattle_createEnemies = Spriteset_Battle.prototype.createEnemies;
    Spriteset_Battle.prototype.createEnemies = function(){
            this._sprite_shadow = [];
            for(var i = 0; i < $gameTroop.members().length; i++){this._sprite_shadow = new SpriteBattlerShadow(),this._battleField.addChild(this._sprite_shadow)};
            _alias_mog_bmotion_spriteseBattle_createEnemies.call(this)
            for(var i = 0; i < this._enemySprites.length; i++){
                     this._enemySprites.add_shadow(this._sprite_shadow);
            };
    };

    //=============================================================================
    // ** Sprite Enemy
    //=============================================================================

    //==============================
    // * Add Shadow
    //==============================
    Sprite_Enemy.prototype.add_shadow = function(sprite_shadow){
              this._spriteShadow = sprite_shadow;
    };

    //==============================
    // * iniVisibility
    //==============================
    var _alias_mog_bmotion_spenemy_initVisibility = Sprite_Enemy.prototype.initVisibility;
    Sprite_Enemy.prototype.initVisibility = function(){
            _alias_mog_bmotion_spenemy_initVisibility.call(this);
            this._check_initsetup = true;
    };

    //==============================
    // * updateBitmap
    //==============================
    var _alias_mog_bmotion_senmy_updateBitmap = Sprite_Enemy.prototype.updateBitmap;
    Sprite_Enemy.prototype.updateBitmap = function(){
            _alias_mog_bmotion_senmy_updateBitmap.call(this);
            if(this._check_duration < 10){this._check_duration += 1};
            if(this._check_duration > 1){if(this._check_initsetup && this.bitmap.isReady()){this.set_bmotion_setup()};}
    };

    //==============================
    // * startBlink
    //==============================
    var _alias_mog_bmotion_srtenemy_startBlink = Sprite_Enemy.prototype.startBlink
    Sprite_Enemy.prototype.startBlink = function(){
        if($gameSystem._bmotion[2]){this._effectDuration = 1; return};
            _alias_mog_bmotion_srtenemy_startBlink.call(this);
    };

    //=============================================================================
    // ** Sprite_Battler
    //=============================================================================
    var _alias_mog_bmotion_sprtb_initialize = Sprite_Battler.prototype.initialize
    Sprite_Battler.prototype.initialize = function(battler){
            _alias_mog_bmotion_sprtb_initialize.call(this,battler)
            this._check_initsetup = true;
            this._check_duration = 0;
    };

    //==============================
    // * initMembers
    //==============================
    var _alias_mog_bmotion_sprtb_initMembers =         Sprite_Battler.prototype.initMembers;
    Sprite_Battler.prototype.initMembers = function(){
            _alias_mog_bmotion_sprtb_initMembers.call(this);
            this._check_initsetup = true;
    };

    //==============================
    // * Set Motion Setup
    //==============================
    Sprite_Battler.prototype.set_bmotion_setup = function(){      
            this._check_initsetup = false;
            this._battler.set_battler_motion_data();
        if(this._battler.is_breath_mode()){this.set_breath_mode()};
            if(this._battler.is_fly_mode()){this.set_fly_mode()};
            if(this._battler.is_swing_mode()){this.set_swing_mode()};
    };

    //==============================
    // * Set Breath Mode
    //==============================
    Sprite_Battler.prototype.set_breath_mode = function(){
                    this._battler._motion_breath = [0,0,0,1.03,2,true];
                if(this.bitmap.height = 300){this._battler._motion_breath[4] = 3};
                    var rz = (Math.random() * 0.06).toFixed(3);
                    this.scale.y = 1.00 + Number(rz);
                    var rz = Math.floor(Math.random() * 2);
                    this._battler._motion_breath[0] = rz;
                    var rz = Math.floor(Math.random() * 5);
                    var rz = (rz * 0.0001).toFixed(4);
                    this._battler._motion_breath[1] = 0.0025 + Number(rz);      
    };

    //==============================
    // * Set Fly Mode
    //==============================
    Sprite_Battler.prototype.set_fly_mode = function(){
            this._battler._motion_fly = [this.x, this.y ,0 , 40 ,0.35,true];
                    this._battler._motion_fly[2] = Math.floor(Math.random() * 2);
                    this._battler._motion_fly[3] += Math.floor(Math.random() * 5);
                    var rz = (Math.random() * 0.1).toFixed(2);
                    this._battler._motion_fly[4] += Number(rz);      
                    this._battler._motion_idle_xy[1] = -(Math.floor(Math.random() * this._battler._motion_fly[3]));
    };

    //==============================
    // * Set Swing Mode
    //==============================
    Sprite_Battler.prototype.set_swing_mode = function(){
            this._battler._motion_swing = [0,0.003,0.10,0,0.35,true];
                    var rz = (Math.random() * 0.10).toFixed(2);
                    this.rotation = Number(rz);               
                    this._battler._motion_swing[0] += Math.floor(Math.random() * 2);
    };

    //==============================
    // * Update Position
    //==============================
    var _alias_mog_battlerMotion_sprbtr_updatePosition = Sprite_Battler.prototype.updatePosition;
    Sprite_Battler.prototype.updatePosition = function(){
            _alias_mog_battlerMotion_sprbtr_updatePosition.call(this);
            this.update_bmotion_position();
    };

    //==============================
    // * Update Main
    //==============================
    var _alias_mog_bmotion_updateMain = Sprite_Battler.prototype.updateMain;
    Sprite_Battler.prototype.updateMain = function(){
            _alias_mog_bmotion_updateMain.call(this)
             this.update_bmotion();
    };

    //==============================
    // * Update Bmotion Position
    //==============================
    Sprite_Battler.prototype.update_bmotion_position = function(){
      this.x += this._battler.motion_Xaxis();
      this.y += this._battler.motion_Yaxis();
      this.scale.x = this._battler.motion_ScaleX();
      this.scale.y = this._battler.motion_ScaleY();
      this.rotation = this._battler.motion_rotation();
    };

    //==============================
    // * Update Bmotion Position
    //==============================
    Sprite_Battler.prototype.update_bmotion = function(){
               if(this._spriteShadow != null){this._spriteShadow.update_shadow(this)};
               if(this._battler.isDead()){return};
               if(this._battler._motion_damage_duration > 0){this.update_motion_damage()};
           if(this._battler.is_motionActing())
                   {this.update_motion_action();}                    
               else
                 {this.update_motion_idle();
               };
    };

    //==============================
    // * Update Motion_Standy
    //==============================
    Sprite_Battler.prototype.update_motion_idle = function(){
      if(this._battler.isActor()){return};   
            if(this._battler.is_breath_mode()){this.update_idle_breath_mode()};
                    if(this._battler.is_fly_mode()){this.update_idle_fly_mode()};
                    if(this._battler.is_swing_mode()){this.update_idle_swing_mode()};
    };

    //==============================
    // * Update Idle Breath Mode
    //==============================
    Sprite_Battler.prototype.update_idle_breath_mode = function(){
                this._battler._motion_breath[2] += 1
                    if(this._battler._motion_breath[2] < this._battler._motion_breath[4]){return};
                    this._battler._motion_breath[2] = 0        
                    if(this._battler._motion_breath[0] == 0){
                            this._battler._motion_idle_scale[1] += this._battler._motion_breath[1];
                        if(this._battler._motion_idle_scale[1] > this._battler._motion_breath[3]){this._battler._motion_idle_scale[1] =this._battler._motion_breath[3]; this._battler._motion_breath[0] = 1};
                    }
                    else{
                            this._battler._motion_idle_scale[1] -= this._battler._motion_breath[1];
                            if(this._battler._motion_idle_scale[1] < 1.00){this._battler._motion_idle_scale[1] = 1.00; this._battler._motion_breath[0] = 0};
                    };
    };

    //==============================
    // * Update Idle Fly Mode
    //==============================
    Sprite_Battler.prototype.update_idle_fly_mode = function(){      
             if(this._battler._motion_fly[2] === 0){
                  this._battler._motion_idle_xy[1] -= this._battler._motion_fly[4];
                             if(this._battler._motion_idle_xy[1] = -20){
                                     this._battler._motion_idle_xy[1] = -20;
                                     this._battler._motion_fly[2] = 0
                             };                 
             };                 
    };

    //==============================
    // * Update Swing Mode
    //==============================
    Sprite_Battler.prototype.update_idle_swing_mode = function(){
            if(this._battler._motion_swing[0] === 0){
                          this._battler._motion_idle_rotation += this._battler._motion_swing[1];
                              if(this._battler._motion_idle_rotation >= this._battler._motion_swing[2]){this._battler._motion_idle_rotation = this._battler._motion_swing[2]; this._battler._motion_swing[0] =

    1};
                    }
        else{this._battler._motion_idle_rotation -= this._battler._motion_swing[1];
                 if(this._battler._motion_idle_rotation
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-10 16:44 , Processed in 0.130331 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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