請問使用插件讀取檔案失敗問題
來源: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 代码
//=============================================================================
// 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 = ;
if(String(Moghunter.b_motion_shake_effect_actor) === "true"){this._bmotion = true};
if(String(Moghunter.b_motion_shake_effect_enemy) === "true"){this._bmotion = true};
if(String(Moghunter.b_motion_disable_blink_damage) === "true"){this._bmotion = 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.toLowerCase() == "motion action"){
var par = note_data.split(':');
this.subject().clear_action_data();
this.subject()._motion_action_data = Number(par);
}
},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 = ;
this._motion_idle_xy = ;
this._motion_idle_scale = ;
this._motion_idle_rotation = 0;
this._motion_collapse_scale = ;
this._motion_collapse_rotation = 0;
this._motion_breath = ;
this._motion_fly = ;
this._motion_swing = ;
};
//==============================
// ** Clear Action Data
//==============================
Game_Battler.prototype.clear_action_data = function(){
this._motion_action_data = ;
this._motion_action_xy = ;
this._motion_action_scale = ;
this._motion_action_rotation = 0;
};
//==============================
// ** Is MotionActing
//==============================
Game_Battler.prototype.is_motionActing = function(){
returnthis._motion_action_data != 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 = true};
if(this.notetags() == "Float Effect"){this._motion_fly = true};
if(this.notetags() == "Swing Effect"){this._motion_swing = 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 + this._motion_action_xy +this._motion_damage_xy
};
//==============================
// ** Motion Yaxis
//==============================
Game_Battler.prototype.motion_Yaxis = function(){
returnthis._motion_idle_xy + this._motion_action_xy +this._motion_damage_xy
};
//==============================
// ** Motion ScaleX
//==============================
Game_Battler.prototype.motion_ScaleX = function(){
returnthis._motion_idle_scale + this._motion_action_scale + this._motion_collapse_scale;
};
//==============================
// ** Motion ScaleY
//==============================
Game_Battler.prototype.motion_ScaleY= function(){
returnthis._motion_idle_scale + this._motion_action_scale + this._motion_collapse_scale;
};
//==============================
// ** 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;
};
//==============================
// ** is Flying Mode
//==============================
Game_Battler.prototype.is_fly_mode = function(){
returnthis._motion_fly == true;
};
//==============================
// ** is Swing Mode
//==============================
Game_Battler.prototype.is_swing_mode = function(){
returnthis._motion_swing;
};
//==============================
// ** 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){target.motion_shake()};
if(target.isEnemy() && $gameSystem._bmotion){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){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 = ;
if(this.bitmap.height = 300){this._battler._motion_breath = 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 = rz;
var rz = Math.floor(Math.random() * 5);
var rz = (rz * 0.0001).toFixed(4);
this._battler._motion_breath = 0.0025 + Number(rz);
};
//==============================
// * Set Fly Mode
//==============================
Sprite_Battler.prototype.set_fly_mode = function(){
this._battler._motion_fly = ;
this._battler._motion_fly = Math.floor(Math.random() * 2);
this._battler._motion_fly += Math.floor(Math.random() * 5);
var rz = (Math.random() * 0.1).toFixed(2);
this._battler._motion_fly += Number(rz);
this._battler._motion_idle_xy = -(Math.floor(Math.random() * this._battler._motion_fly));
};
//==============================
// * Set Swing Mode
//==============================
Sprite_Battler.prototype.set_swing_mode = function(){
this._battler._motion_swing = ;
var rz = (Math.random() * 0.10).toFixed(2);
this.rotation = Number(rz);
this._battler._motion_swing += 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 += 1
if(this._battler._motion_breath < this._battler._motion_breath){return};
this._battler._motion_breath = 0
if(this._battler._motion_breath == 0){
this._battler._motion_idle_scale += this._battler._motion_breath;
if(this._battler._motion_idle_scale > this._battler._motion_breath){this._battler._motion_idle_scale =this._battler._motion_breath; this._battler._motion_breath = 1};
}
else{
this._battler._motion_idle_scale -= this._battler._motion_breath;
if(this._battler._motion_idle_scale < 1.00){this._battler._motion_idle_scale = 1.00; this._battler._motion_breath = 0};
};
};
//==============================
// * Update Idle Fly Mode
//==============================
Sprite_Battler.prototype.update_idle_fly_mode = function(){
if(this._battler._motion_fly === 0){
this._battler._motion_idle_xy -= this._battler._motion_fly;
if(this._battler._motion_idle_xy = -20){
this._battler._motion_idle_xy = -20;
this._battler._motion_fly = 0
};
};
};
//==============================
// * Update Swing Mode
//==============================
Sprite_Battler.prototype.update_idle_swing_mode = function(){
if(this._battler._motion_swing === 0){
this._battler._motion_idle_rotation += this._battler._motion_swing;
if(this._battler._motion_idle_rotation >= this._battler._motion_swing){this._battler._motion_idle_rotation = this._battler._motion_swing; this._battler._motion_swing =
1};
}
else{this._battler._motion_idle_rotation -= this._battler._motion_swing;
if(this._battler._motion_idle_rotation
页:
[1]