Original Source
- Original title: MV [HELP] Plugins incompatible
- Original author: Aandel
- Original date: February 18, 2024
- Source thread: https://forums.rpgmakerweb.com/threads/help-plugins-incompatible.165894/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support
Summary
Hey guys! I need a picture control plugin that causes the blur effect. I found exactly what I needed, but it proved to be incompatible with three plugins that I also really need. The plugin that makes the blur effect is Exhydra PictureControl-BlurFilter
Archived First Post
I need a picture control plugin that causes the blur effect.
I found exactly what I needed, but it proved to be incompatible with three plugins that I also really need.
The plugin that makes the blur effect is Exhydra PictureControl-BlurFilter
// █▐▐ Picture Control | Blur Filter
// ╞══════════════════════════════════════════════════════════════════════════════════╡
/*:
* @plugindesc [1.00] Adds a user-specified blur to a picture.
* @Author Exhydra
*
* @param ─ Options
* @desc
* @Default ───────────────
*
* @param Default Add
* @desc Adds the blur filter to each picture by default.
* @Default false
*
* @param Default Strength
* @desc The default strength of each blur filter.
* @Default 0
*
* @param Default Quality
* @desc The default quality of each blur filter.
* @Default 1.5
*
* @param Default Padding
* @desc The default padding of each blur filter.
* @Default 0
*
* @param ─ Plugin
* @desc
* @Default ───────────────
*
* @param Plugin GID
* @desc Global identification tag for internal use only. Do not change.
* @Default eXa-3IPtxrUiEoyjLMW
*
* @Help
* ▄ Plugin ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄
*
* ┌─ Version : 1.00
* ├─ Release : 27th September 2016
* ├─ Updated : 27th September 2016
* └─ License : Free for Commercial and Non-Commercial Usage
*
*/
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Plugin
// ╘══════════════════════════════════════════════════════════════════════════════════╛
var Imported = Imported || {};
Imported.exaPictureControlBlurFilter = 1.00;
var EXA = EXA || {};
EXA.PC = EXA.PC || {};
EXA.PC.BF = EXA.PC.BF || {};
(function() {
'use strict';
var exaParams = $plugins.filter(function(plugin) {
return plugin.parameters['Plugin GID'] == 'eXa-3IPtxrUiEoyjLMW';
})[0].parameters;
EXA.PC.BF._defaultBlur = exaParams['Default Add'] === 'true';
EXA.PC.BF._defaultStrength = Number(exaParams['Default Strength']) || 0;
EXA.PC.BF._defaultQuality = Number(exaParams['Default Quality']) || 1.5;
EXA.PC.BF._defaultPadding = Number(exaParams['Default Padding']) || 0;
})();
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Picture
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initialize
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.PC.BF.Game_Picture_initialize = Game_Picture.prototype.initialize;
Game_Picture.prototype.initialize = function() {
EXA.PC.BF.Game_Picture_initialize.call(this);
this.initBlur();
}; // Game_Picture ‹‹ initialize
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initBlur
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Picture.prototype.initBlur = function() {
this._blur = EXA.PC.BF._defaultBlur;
this._blurStrength = EXA.PC.BF._defaultStrength;
this._blurQuality = EXA.PC.BF._defaultQuality;
this._blurPadding = EXA.PC.BF._defaultPadding;
this._blurTarget = 0;
this._blurDuration = 0;
}; // Game_Picture ‹‹ initBlur
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] addBlur
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Picture.prototype.addBlur = function(strength, quality, padding) {
this._blur = true;
this._blurStrength = strength;
this._blurQuality = quality;
this._blurPadding = padding;
}; // Game_Picture ‹‹ addBlur
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] toBlur
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Picture.prototype.toBlur = function(strength, duration) {
this._blurTarget = strength;
this._blurDuration = duration;
if (duration === 0) {
this._blurStrength = strength;
}
}; // Game_Picture ‹‹ toBlur
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] eraseBlur
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Picture.prototype.eraseBlur = function() {
this._blur = false;
}; // Game_Picture ‹‹ eraseBlur
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] update
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.PC.BF.Game_Picture_update = Game_Picture.prototype.update;
Game_Picture.prototype.update = function() {
EXA.PC.BF.Game_Picture_update.call(this);
this.updateBlur();
}; // Game_Picture ‹‹ update
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] updateBlur
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Picture.prototype.updateBlur = function() {
if (this._blurDuration > 0) {
var d = this._blurDuration;
this._blurStrength = (this._blurStrength * (d - 1) + this._blurTarget) / d;
this._blurDuration--;
}
}; // Game_Picture ‹‹ updateBlur
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Sprite_Picture
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initialize
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.PC.BF.Sprite_Picture_initialize = Sprite_Picture.prototype.initialize;
Sprite_Picture.prototype.initialize = function(pictureId) {
EXA.PC.BF.Sprite_Picture_initialize.call(this, pictureId);
this._blurFilter = new PIXI.filters.BlurFilter();
this._blurFilter.added = false;
this._blurFilter.blur = 0;
this._blurFilter.quality = 0;
this._blurFilter.padding = 0;
}; // Sprite_Picture ‹‹ initialize
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] updateOther
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.PC.BF.Sprite_Picture_updateOther = Sprite_Picture.prototype.updateOther;
Sprite_Picture.prototype.updateOther = function() {
EXA.PC.BF.Sprite_Picture_updateOther.call(this);
var picture = this.picture();
if (picture._blur) {
if (!this._blurFilter.added) {
this._blurFilter.added = true;
this._blurFilter.quality = picture._blurQuality;
this._blurFilter.padding = picture._blurPadding;
this.filters = [this._blurFilter];
}
this._blurFilter.blur = picture._blurStrength;
} else {
if (this._blurFilter.added) {
this._blurFilter.added = false;
this.filters = null;
}
}
}; // Sprite_Picture ‹‹ updateOther
// ▌▌██████████████████████████████████████EOF█████████████████████████████████████▐▐[/TD]
Could someone analyze this plugin and see if there is a way to make it compatible with the three plugins below?
The others are:
MOG PictureEffects
// MOG_PictureEffects.js
//=============================================================================
/*:
* @plugindesc (v1.4) Adiciona novas funções no sistema de mostrar imagens.
* @Author Moghunter
*
* @Help
* =============================================================================
* +++ MOG - Picture Effects (v1.4) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* =============================================================================
* Adiciona novas funções no sistema de mostrar imagens.
* =============================================================================
* UTILIZAÇÃO.
* =============================================================================
* Utilize os comandos através do Plugin Command.
*
* =============================================================================
* * POSITIONS *
* =============================================================================
* --- > Posição da imagem no player. < ----
*
* picture_player_position : PICTURE_ID
*
* --- > Posição da imagem no evento. < ----
*
* picture_event_position : PICTURE_ID : EVENT_ID
*
* --- > Posição fixa no mapa. < ----
*
* picture_map_position : PICTURE_ID
*
*
* (NOTA - A função MOVE não funciona nos efeitos de Posição.)
*
* =============================================================================
* * EFFECTS *
* =============================================================================
* ---> Efeito Respirar < -----
*
* pic_breath : PICTURE ID : true : Power : Speed
*
* ---> Efeito Flutuar < -----
*
* pic_float : PICTURE ID : true
*
* ---> Efeito Tremer < -----
*
* pic_shake : PICTURE ID : true : Power
*
* ---> Efeito Tremer 2 < -----
*
* pic_shake2 : PICTURE ID : true : Power
*
* ---> Efeito Smooth < -----
*
* pic_smooth : PICTURE ID : true : Power : Speed
*
* =============================================================================
* * ANIMATED *
* =============================================================================
*
* picture_animated : PICTURE_ID : NUMBER_OF_FRAMES : ANIMATION_SPEED
*
* (NOTA - A largura da imagem é dividida pelo numero de frames.)
*
*
* =============================================================================
* * HISTÓRICO *
* =============================================================================
* (1.4) - Compatibilidade com Rpg Maker MV 1.6+
* (1.3) - Adicionado o efeito Smooth.
* - Adicionado as opções de definir o poder e velocidade dos efeitos.
* (1.2) - Adicionado a função de tremer no modo 2.
*
*/
//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
var Imported = Imported || {};
Imported.MOG_PictureEffects = true;
var Moghunter = Moghunter || {};
Moghunter.parameters = PluginManager.parameters('MOG_PictureEffects');
//=============================================================================
// ** Game_Interpreter
//=============================================================================
//==============================
// * PluginCommand
//==============================
var _alias_mog_picefc_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_alias_mog_picefc_pluginCommand.call(this,command, args);
if ($gameScreen.picture(Number(args[1]))) {this.setPictureEffects(command, args)};
return true;
};
//==============================
// * Set Picture Effets
//==============================
Game_Interpreter.prototype.setPictureEffects = function(command, args) {
this.picEfctSetPos(command, args);
if (args[3]) {this.picEfctSetAni(command, args)};
};
//==============================
// * pict Effect Set Pos
//==============================
Game_Interpreter.prototype.picEfctSetPos = function(command, args) {
if (command === "picture_player_position") {
$gameScreen.picture(Number(args[1]))._positionData[0] = 1;
} else if (command === "picture_map_position") {
$gameScreen.picture(Number(args[1]))._positionData[0] = 3;
} else if (command === "picture_event_position" && args[3]) {
$gameMap.events().forEach(function(event) {
if (!event._erased && event.eventId() === Number(args[3])) {
$gameScreen.picture(Number(args[1]))._positionData[0] = 2;
$gameScreen.picture(Number(args[1]))._positionData[4] = args[3];
$gameScreen.picture(Number(args[1]))._positionData[5] = $gameMap._mapId
};
}, this);
};
};
//==============================
// * pict Effet Set Ani
//==============================
Game_Interpreter.prototype.picEfctSetAni = function(command, args) {
var enable = String(args[3]) === "true" ? true : false;
if (command == "pic_animated") {
var frm = Math.min(Math.max(Number(args[3]),1),999);
var speed = args[5] ? Number(args[5]) : 20;
$gameScreen.picture(Number(args[1]))._animeData = [true,frm,9999,0,speed];
};
if (command == "pic_shake") {
var pw = args[5] ? Number(args[5]) : 10;
$gameScreen.picture(Number(args[1]))._shake = [enable,20,0,0,pw];
} else if (command === "pic_shake2") {
var pw = args[5] ? Number(args[5]) : 10;
$gameScreen.picture(Number(args[1]))._shake2 = [enable,20,0,0,pw,0,0];
};
if (command == "pic_breath") {
var pw = args[5] ? Number(args[5]) : 1;
var pw = pw * 0.01
var pw2 = args[7] ? Number(args[7]) : 5;
var pw2 = 1 + (pw2 * 0.1);
$gameScreen.picture(Number(args[1]))._breathEffect = [enable,0,0,0,pw,pw2];
};
if (command == "pic_float") {
var pw = args[5] ? Number(args[5]) : 1;
var pw = pw * 0.1;
var pw2 = args[7] ? Number(args[7]) : 15;
$gameScreen.picture(Number(args[1]))._floatEffect = [enable,0,0,0,pw2,pw];
};
if (command == "pic_smooth") {
var pw = args[5] ? Number(args[5]) : 20;
var pw2 = args[7] ? Number(args[7]) : 160;
var pw2 = pw2 * 0.01;
$gameScreen.picture(Number(args[1]))._moveEffect = [enable,0,0,160,0,0,pw,pw2,160];
};
};
//=============================================================================
// ** Game Character Base
//=============================================================================
//==============================
// * Screen RealX
//==============================
Game_CharacterBase.prototype.screen_realX = function() {
return this.scrolledX() * $gameMap.tileWidth()
};
//==============================
// * Screen RealY
//==============================
Game_CharacterBase.prototype.screen_realY = function() {
return this.scrolledY() * $gameMap.tileHeight()
};
//==============================
// * Pict FX
//==============================
Game_Map.prototype.pictFX = function() {
return this._displayX * this.tileWidth();
};
//==============================
// * Pict FY
//==============================
Game_Map.prototype.pictFY = function() {
return this._displayY * this.tileHeight();
};
//=============================================================================
// ** Game Picture
//=============================================================================
//==============================
// * initBasic
//==============================
var _mog_pect_gpicture_initBasic = Game_Picture.prototype.initBasic;
Game_Picture.prototype.initBasic = function() {
_mog_pect_gpicture_initBasic.call(this);
this.initPicEffectBasic();
};
//==============================
// * initPicEffectBasic
//==============================
Game_Picture.prototype.initPicEffectBasic = function() {
this._position = [0,0];
this._zoom = [100,100];
this._effectType = 0;
this._shake = [false,0,0,0,0];
this._shake2 = [false,0,0,0,0,0,0];
this._breathEffect = [false,0,0,0,0];
this._breathEffect2 = [false,0,0,0,0];
this._floatEffect = [false,0,0,0];
this._positionData = [0,0,0,0,0,0,0];
this._animeData = [false,0,0,0,0];
this._moveEffect = [false,0,0,0,0,0,0,0,0];
};
//==============================
// * Pic X
//==============================
Game_Picture.prototype.picX = function() {
return this._position[0] + this._positionData[1] + this._shake[2] + this._shake2[2] + this._moveEffect[1];
};
//==============================
// * Pic Y
//==============================
Game_Picture.prototype.picY = function() {
return this._position[1] + this._positionData[2] + this._shake[3] + this._shake2[3] + this._floatEffect[3] + this._moveEffect[2];
};
//==============================
// * Zoom X
//==============================
Game_Picture.prototype.zoomX = function() {
return this._zoom[0] + this._breathEffect[2];
};
//==============================
// * Zoom Y
//==============================
Game_Picture.prototype.zoomY = function() {
return this._zoom[1] + this._breathEffect[3];
};
//==============================
// * Opacity
//==============================
Game_Picture.prototype.opacity = function() {
return this._opacity;
};
//==============================
// * Angle
//==============================
Game_Picture.prototype.angle = function() {
return this._angle + this._shake2[5];
};
//==============================
// * Erase
//==============================
var _mog_pect_gpicture_erase = Game_Picture.prototype.erase;
Game_Picture.prototype.erase = function() {
_mog_pect_gpicture_erase.call(this);
this.initPicEffectBasic();
};
//==============================
// * Show
//==============================
var _mog_pect_gpicture_show = Game_Picture.prototype.show;
Game_Picture.prototype.show = function(name, origin, x, y, scaleX,scaleY, opacity, blendMode) {
_mog_pect_gpicture_show.call(this,name, origin, x, y, scaleX,scaleY, opacity, blendMode)
this.initPicEffectBasic();
this._position[0] = x;
this._position[1] = y;
this._positionData[1] = x;
this._positionData[2] = y;
this._zoom[0] = scaleX;
this._zoom[1] = scaleY;
if (this._breathEffect[0]) {
this._breathEffect[3] = (Math.random() * 0.20).toFixed(2);
};
if (this._floatEffect[0]) {
this._floatEffect[3] = -(Math.random() * 15).toFixed(2);
};
};
//==============================
// * Move
//==============================
var _mog_pect_gpicture_move = Game_Picture.prototype.move;
Game_Picture.prototype.move = function(origin, x, y, scaleX, scaleY,opacity, blendMode, duration) {
_mog_pect_gpicture_move.call(this,origin, x, y, scaleX, scaleY,opacity, blendMode, duration)
this._positionData[1] = x;
this._positionData[2] = y;
};
//==============================
// * update Move
//==============================
Game_Picture.prototype.updateMove = function() {
if (this._duration > 0) {
var d = this._duration;
if (this._positionData[0] === 0) {
this._x = (this._x * (d - 1) + this._targetX) / d;
this._y = (this._y * (d - 1) + this._targetY) / d;
};
this._zoom[0] = (this._scaleX * (d - 1) + this._targetScaleX) / d;
this._zoom[1] = (this._scaleY * (d - 1) + this._targetScaleY) / d;
this._opacity = (this._opacity * (d - 1) + this._targetOpacity) / d;
this._duration--;
this.updatePictureEffects();
};
};
//==============================
// * Game Picture
//==============================
var _mog_pect_gpicture_update = Game_Picture.prototype.update;
Game_Picture.prototype.update = function() {
_mog_pect_gpicture_update.call(this);
this.updatePictureEffects();
};
//==============================
// * Update Picture Effects
//==============================
Game_Picture.prototype.updatePictureEffects = function() {
if (this._shake[1] > 0) {this.updateShake()};
if (this._shake2[1] > 0) {this.updateShake2()};
if (this._breathEffect[0]) {this.updateBreathEffect()};
if (this._floatEffect[0]) {this.updateFloatEffect()};
if (this._positionData[0] > 0) {this.updatePicPosEfct()};
if (this._moveEffect[0]) {this.updateMoveEfct()};
this._scaleX = this.zoomX();
this._scaleY = this.zoomY();
};
//==============================
// * Update Move Effect
//==============================
Game_Picture.prototype.updateMoveEfct = function() {
this._moveEffect[3]++;
this._moveEffect[1] = this.movePictureEfc(this._moveEffect[1],this._moveEffect[4],this._moveEffect[7]);
this._moveEffect[2] = this.movePictureEfc(this._moveEffect[2],this._moveEffect[5],this._moveEffect[7]);
this._x = this.picX();
this._y = this.picY();
if (this._moveEffect[3] < 30) {return};
this._moveEffect[3] = 0;
var r = Math.randomInt(2);
this._moveEffect[4] = r === 0 ? Math.randomInt(this._moveEffect[6]) : -Math.randomInt(this._moveEffect[6]);
var r = Math.randomInt(2);
this._moveEffect[5] = r === 0 ? Math.randomInt(this._moveEffect[6]) : -Math.randomInt(this._moveEffect[6]);
};
//==============================
// * Move Picture Effect
//==============================
Game_Picture.prototype.movePictureEfc = function(value,real_value,speed) {
if (value == real_value) {return value};
var dnspeed = (0.1 + speed) + (Math.abs(value - real_value) / 160);
if (value > real_value) {value -= dnspeed;
if (value < real_value) {value = real_value};}
else if (value < real_value) {value += dnspeed;
if (value > real_value) {value = real_value};
};
return value;
};
//==============================
// * Update Breath Effect
//==============================
Game_Picture.prototype.updateBreathEffect = function() {
if (this._duration > 0) {return};
if (this._breathEffect[1] === 0) {
this._breathEffect[3] += this._breathEffect[4];
if (this._breathEffect[3] >= this._breathEffect[5]) {
this._breathEffect[3] = this._breathEffect[5];
this._breathEffect[1] = 1;
};
} else {
this._breathEffect[3] -= this._breathEffect[4];
if (this._breathEffect[3] <= 0) {
this._breathEffect[3] = 0;
this._breathEffect[1] = 0;
};
};
};
//==============================
// * Update Float Effect
//==============================
Game_Picture.prototype.updateFloatEffect = function() {
if (this._duration > 0) {return};
if (this._floatEffect[1] === 0) {
this._floatEffect[3] -= this._floatEffect[5];
if (this._floatEffect[3] <= -this._floatEffect[4]) {this._floatEffect[1] = 1};
} else {
this._floatEffect[3] += this._floatEffect[5];
if (this._floatEffect[3] >= 0) {this._floatEffect[1] = 0};
};
};
//==============================
// * Update Shake
//==============================
Game_Picture.prototype.updateShake = function() {
this._shake[1] --
this._shake[2] = Math.random() * this._shake[4];
this._shake[3] = Math.random() * this._shake[4];
if (this._shake[1] <= 0) {
if (this._shake[0]) {this._shake[1] = 20
} else {
this._shake[2] = 0;
this._shake[3] = 0;
};
};
};
//==============================
// * Update Shake
//==============================
Game_Picture.prototype.updateShake2 = function() {
this._shake2[6]++;
if (this._shake2[6] < 3) {return};
this._shake2[6] = 0;
this._shake2[1] --;
this._shake2[2] = Math.random() * this._shake2[4];
this._shake2[3] = Math.random() * this._shake2[4];
var r = Math.randomInt(2)
this._shake2[5] = r === 1 ? Math.randomInt(5) : -Math.randomInt(5);
if (this._shake2[1] <= 0) {
if (this._shake2[0]) {this._shake2[1] = 20
} else {
this._shake2[2] = 0;
this._shake2[3] = 0;
};
};
};
//==============================
// * Update Picture Pos Effct
//==============================
Game_Picture.prototype.updatePicPosEfct = function() {
if (this._positionData[0] === 1) {
this._position[0] = $gamePlayer.screenX();
this._position[1] = $gamePlayer.screenY();
} else if (this._positionData[0] === 2) {
var event = $gameMap.events()[this._positionData[4] - 1]
if (event && !event._erased && this._positionData[5] === $gameMap._mapId) {
this._position[0] = event.screenX();
this._position[1] = event.screenY();
} else {
this._position[0] = $gamePlayer.screenX();
this._position[1] = $gamePlayer.screenY();
};
} else {
this._position[0] = -$gameMap.pictFX();
this._position[1] = -$gameMap.pictFY();
};
this._x = this.picX();
this._y = this.picY();
};
//=============================================================================
// ** Sprite Picture
//=============================================================================
//==============================
// * Update Bitmap
//==============================
var _mog_picefc_sprpic_updateBitmap = Sprite_Picture.prototype.updateBitmap;
Sprite_Picture.prototype.updateBitmap = function() {
_mog_picefc_sprpic_updateBitmap.call(this);
if (this.picture() && this.picture()._animeData[0]) {this.updateFrames(this.picture())};
};
//==============================
// * Update Frames
//==============================
Sprite_Picture.prototype.updateFrames = function(picture) {
if (!this.bitmap.isReady()) {this.visible = false;return};
this.visible = true
if (!this._picFrames) {this.setPicFrames(picture)};
picture._animeData[2] ++
if (picture._animeData[2] < picture._animeData[4]) {return};
picture._animeData[2] = 0
this.setFrame(picture._animeData[3] * this._picFrames[3],0,this._picFrames[3],this._picFrames[4])
picture._animeData[3] ++
if (picture._animeData[3] >= this._picFrames[0]) {picture._animeData[3] = 0}
};
//==============================
// * set PicFrames
//==============================
Sprite_Picture.prototype.setPicFrames = function(picture) {
var w = this.bitmap.width / picture._animeData[1]
var h = this.bitmap.height;
this._picFrames = [picture._animeData[1],0,0,w,h];
this.setFrame(picture._animeData[3] * this._picFrames[3],0,this._picFrames[3],this._picFrames[4]);
};
//==============================
// * Update Origin
//==============================
var _mog_picefc_sprpic_updateOther = Sprite_Picture.prototype.updateOther;
Sprite_Picture.prototype.updateOther = function() {
_mog_picefc_sprpic_updateOther.call(this)
this.updatePicEffect();
};
//==============================
// * Update Pic Effect
//==============================
Sprite_Picture.prototype.updatePicEffect = function() {
if (this.picture()._breathEffect[0]) {
this.anchor.x = 0.5;
this.anchor.y = 1;
this.y += this.height / 2;
};
if (this.picture()._positionData[0] === 0) {
this.x += this.picture()._shake[2] + this.picture()._shake2[2];
this.y += this.picture()._shake[3] + this.picture()._shake2[3];
if (this.picture()._floatEffect[0]) {this.y += this.picture()._floatEffect[3]};
};
};
GALV PictureAnims
MV Picture Animations
TDDP BindPicturesTo Map
TDDP-Repo/TDDP_BindPicturesToMap.js at master · TorD/TDDP-Repo
// TDDP_BindPicturesToMap.js
// Version: 1.0.7
//=============================================================================
var Imported = Imported || {};
Imported.TDDP_BindPicturesToMap = "1.0.7";
//=============================================================================
/*:
* @plugindesc 1.0.7 Plugin Commands for binding pictures to the map and/or changing what layer they're drawn on.
*
* @Author Tor Damian Design / Galenmereth
* @Help =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
* Information
* =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
* The Bind Pictures To Map plugin lets you bind the movement of pictures to
* the movement of the map rather than to the camera. You can also change what
* "layer" a picture is drawn to, like below characters, or even below the
* parallax layer.
*
* For updates and easy to use documentation, please go to the plugin's website:
* http://mvplugins.tordamian.com/?p=54
*
* There you can also download a PDF of the documentation for offline use, and
* having the documentation in one cleanly presented place means you can always
* be sure it's the most recent available.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Terms & Conditions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* In short: Completely free, including for commercial use.
*
* MIT License
*
* Copyright (c) 2019 Tor Damian Design
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
(function() {
"use strict";
//=============================================================================
// Game_Interpreter - register plugin commands
//=============================================================================
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args)
var args = args || [];
if (command === 'BindPictureToMap') this.bindPictureToMap(args[0], true, args[1]);
if (command === 'UnbindPictureFromMap') this.bindPictureToMap(args[0], false, args[1]);
if (command === 'ChangePictureLayer') this.changePictureLayer(args[0], args[1]);
if (command === 'START_BindPicturesToMap') this.bindAllPicturesToMap(args);
if (command === 'STOP_BindPicturesToMap') this.stopBindAllPicturesToMap();
};
var _Game_Interpreter_clear =
Game_Interpreter.prototype.clear;
Game_Interpreter.prototype.clear = function() {
_Game_Interpreter_clear.call(this);
this._bindAllPicturesToMap = this._bindAllPicturesToMapLayer = false;
};
Game_Interpreter.prototype.bindPictureToMap = function(pictureId, bindToMap, layer) {
// Control first argument input, pictureId
if(!pictureId) alert("BindPictureToMap requires the first parameter to be a valid picture Id");
if(layer) {
this.changePictureLayer(pictureId, layer)
}
var game_picture = $gameScreen.picture(pictureId)
// Update picture_sprite
var picture_sprite = SceneManager._scene._spriteset._pictureStorage[pictureId];
if(picture_sprite) {
if(game_picture && bindToMap != game_picture._bindToMap) {
picture_sprite.loadBitmap();
}
picture_sprite.updateLayer();
};
if(game_picture) game_picture._bindToMap = bindToMap;
};
Game_Interpreter.prototype.changePictureLayer = function(pictureId, layer) {
var layer = String(layer);
if(!SceneManager._scene._spriteset._pictureContainer[layer]) {
throw new Error("BindPictureToMap: " + layer + " is not a valid layer.");
}
var game_picture = $gameScreen.picture(pictureId)
game_picture._layer = layer;
}
Game_Interpreter.prototype.bindAllPicturesToMap = function(args) {
this._bindAllPicturesToMap = true;
// Control second argument input, layer
if(args && args[0]) {
var layer = String(args[0]);
if(!SceneManager._scene._spriteset._pictureContainer[layer]) {
throw new Error("BindPicturesToMap: " + args[0] + " is not a valid layer.");
}
this._bindAllPicturesToMapLayer = layer;
}
}
Game_Interpreter.prototype.stopBindAllPicturesToMap = function() {
this._bindAllPicturesToMap = false;
this._bindAllPicturesToMapLayer = false;
}
//=============================================================================
// Spriteset_Map
//=============================================================================
Spriteset_Map.prototype.createLowerLayer = function() {
Spriteset_Base.prototype.createLowerLayer.call(this);
this.createPicturesLayer('bottom', this._baseSprite);
this.createParallax();
this.createPicturesLayer('below_tilemap', this._baseSprite);
this.createTilemap();
this.createPicturesLayer('below_characters', this._tilemap);
this.createCharacters();
this.createPicturesLayer('above_characters', this._tilemap, 8);
this.createShadow();
this.createPicturesLayer('below_weather', this._tilemap, 8);
this.createWeather();
this.createPicturesLayer('top', this);
this.createDestination();
};
// Modified
Spriteset_Map.prototype.createDestination = function() {
this._destinationSprite = new Sprite_Destination();
this._destinationSprite.z = 9;
this._pictureContainer['top'].addChild(this._destinationSprite);
};
// NEW
Spriteset_Map.prototype.createPicturesLayer = function(layer, parent, z) {
var z = z || 0;
var container = new Sprite();
// Set container props
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var x = (Graphics.width - width) / 2;
var y = (Graphics.height - height) / 2;
container.setFrame(x, y, width, height);
container.z = z;
// Add to children
parent.addChild(container);
// Add binding
this._pictureContainer[layer] = container;
};
// ALIAS
var _Spriteset_Map_initialize =
Spriteset_Map.prototype.initialize;
Spriteset_Map.prototype.initialize = function() {
this._pictureStorage = {};
this._pictureContainer = {};
_Spriteset_Map_initialize.call(this);
};
var _Spriteset_Map_update =
Spriteset_Map.prototype.update;
Spriteset_Map.prototype.update = function() {
_Spriteset_Map_update.call(this);
this.updatePictures();
}
Spriteset_Map.prototype.updatePictures = function() {
for (var i = 1; i <= $gameScreen.maxPictures(); i++) {
var sprite = this._pictureStorage;
if(!sprite.parent && sprite.picture()) {
this._pictureStorage.update();
}
}
}
// OVERWRITE inherited
Spriteset_Map.prototype.createPictures = function() {
for (var i = 1; i <= $gameScreen.maxPictures(); i++) {
this._pictureStorage = new Sprite_Picture(i);
}
};
//=============================================================================
// Sprite_Picture
//=============================================================================
Sprite_Picture.prototype.updateLayer = function() {
var picture = this.picture();
var parent = this.parent;
if(picture) {
if(picture.layer()) {
if(picture.layer() != parent) {
if(parent) parent.removeChild(this);
picture.layer().addChild(this);
// Sort parent on new entry by pic id
picture.layer().children.sort(function(a, b){return a._pictureId-b._pictureId});
}
}
}
};
var _Sprite_Picture_updateOther =
Sprite_Picture.prototype.updateOther;
Sprite_Picture.prototype.updateOther = function() {
_Sprite_Picture_updateOther.call(this);
this.updateLayer();
};
// OVERWRITE inherited
Sprite_Picture.prototype.loadBitmap = function() {
var bitmap = ImageManager.loadPicture(this.picture()._name);
bitmap.addLoadListener(this.bltLoadedBitmap.bind(this, bitmap));
return;
};
// NEW
Sprite_Picture.prototype._useLoopingBitmap = function() {
return this.picture()._bindToMap && ($gameMap.isLoopHorizontal() || $gameMap.isLoopVertical());
}
// NEW
Sprite_Picture.prototype.bltLoadedBitmap = function(sourceBitmap) {
var picture = this.picture();
picture.setDimensions(sourceBitmap);
// Check if bitmap size is too large
if(picture._width + picture._height > 8032) {
throw new Error("Picture " + this._pictureId + "(" + this._pictureName + ") is too large for bitmaps bound to the map and looping enabled. Its height + width must be less than 8032 in total.");
}
// Set dimensions of new bitmap
var bw = (this._useLoopingBitmap() && $gameMap.isLoopHorizontal() && picture._useHorizontalRepeat) ? picture._loopWidth : picture._width;
var bh = (this._useLoopingBitmap() && $gameMap.isLoopVertical() && picture._useVerticalRepeat) ? picture._loopHeight : picture._height;
this.bitmap = new Bitmap(bw, bh);
// Blit original bitmap
this.bitmap.blt(sourceBitmap, 0, 0, sourceBitmap.width, sourceBitmap.height, 0, 0);
// Only used and performed when on a map scene
if (SceneManager._scene instanceof Scene_Map && this._useLoopingBitmap()) {
// Make a copy for horizontal offscreen scrolls into view
if($gameMap.isLoopHorizontal() && picture._useHorizontalRepeat) {
this.bitmap.blt(sourceBitmap, 0, 0, sourceBitmap.width, sourceBitmap.height, picture._horSpacing, 0);
}
// Make a copy for vertical offscreen scrolling into view
if($gameMap.isLoopVertical() && picture._useVerticalRepeat) {
this.bitmap.blt(sourceBitmap, 0, 0, sourceBitmap.width, sourceBitmap.height, 0, picture._verSpacing);
}
// Make a copy if horizontal + vertical is scrolled into view
if($gameMap.isLoopHorizontal() && $gameMap.isLoopVertical()
&& picture._useHorizontalRepeat && picture._useVerticalRepeat) {
this.bitmap.blt(sourceBitmap, 0, 0, sourceBitmap.width, sourceBitmap.height, picture._horSpacing, picture._verSpacing);
}
}
};
//=============================================================================
// Game_Picture
//=============================================================================
var _Game_Picture_initBasic =
Game_Picture.prototype.initBasic;
Game_Picture.prototype.initBasic = function() {
_Game_Picture_initBasic.call(this);
this._bindToMap = $gameMap._interpreter._bindAllPicturesToMap;
if($gameMap._interpreter._bindAllPicturesToMapLayer) {
this._layer = $gameMap._interpreter._bindAllPicturesToMapLayer;
} else {
this._layer = 'top';
}
};
/**
* Get current layer object
*/
Game_Picture.prototype.layer = function() {
if(!SceneManager._scene._spriteset) return null;
return SceneManager._scene._spriteset._pictureContainer[this._layer];
}
/**
* Extensions to show function to set additional properties
*/
var _Game_Picture_show =
Game_Picture.prototype.show;
Game_Picture.prototype.show = function(name, origin, x, y, scaleX,
scaleY, opacity, blendMode) {
_Game_Picture_show.call(this, name, origin, x, y, scaleX,
scaleY, opacity, blendMode);
// Origin coords
this._originX = this._x;
this._originY = this._y;
// Only used and performed when on a map scene
if (SceneManager._scene instanceof Scene_Map) {
// Map offsets for resolutions that offset the map's drawing start. Used only when binding pictures to map
this._mapOffsX = Math.max(SceneManager._screenWidth - ($gameMap.width() * $gameMap.tileWidth()), 0);
this._mapOffsY = Math.max(SceneManager._screenHeight - ($gameMap.height() * $gameMap.tileHeight()), 0);
}
};
/**
* Set dimensions based on a bitmap. Gets called by Sprite_Picture
*/
Game_Picture.prototype.setDimensions = function(bitmap) {
this._width = bitmap.width;
this._height = bitmap.height;
// Only used and performed when on a map scene
if (SceneManager._scene instanceof Scene_Map) {
// Horizontal and vertical spacing for repeating textures
this._horSpacing = $gameMap.width() * $gameMap.tileWidth();
this._verSpacing = $gameMap.height() * $gameMap.tileHeight();
}
// Check if we need horizontal and vertical repeating
this._useHorizontalRepeat = this._width < this._horSpacing * 2;
this._useVerticalRepeat = this._height < this._verSpacing * 2;
// Set requested bitmap width based on repeating
this._loopWidth = this._useHorizontalRepeat ? this._horSpacing * 2 : this._width;
this._loopHeight = this._useVerticalRepeat ? this._verSpacing * 2 : this._height;
}
/**
* Extensions to updateMove when binding pictures to map
*/
var _Game_Picture_updateMove =
Game_Picture.prototype.updateMove;
Game_Picture.prototype.updateMove = function() {
_Game_Picture_updateMove.call(this);
if(this._bindToMap) {
var mw = ($gameMap.width() * $gameMap.tileWidth());
var mh = ($gameMap.height() * $gameMap.tileHeight());
var dx = Math.abs($gameMap.displayX());
var dy = Math.abs($gameMap.displayY());
var ox = dx * $gameMap.tileWidth();
var oy = dy * $gameMap.tileHeight();
this._x = this._originX - ox;
this._y = this._originY - oy;
if (this._useHorizontalRepeat && ox >= mw) {
this._x += mw;
}else {
this._x += this._mapOffsX;
}
if (this._useVerticalRepeat && oy >= mh) {
this._y += mh;
}else {
this._y += this._mapOffsY;
}
}
};
//=============================================================================
// Game_Picture
//=============================================================================
/**
* Fix to displayX's returned decimal value to hinder JS rounding errors
*/
Game_Map.prototype.displayX = function() {
return Math.ceil10(this._displayX, -8);
};
/**
* Fix to displayY's returned decimal value to hinder JS rounding errors
*/
Game_Map.prototype.displayY = function() {
return Math.ceil10(this._displayY, -8);
};
//=============================================================================
// Math additions
//=============================================================================
/**
* Decimal adjustment of a number.
*
* @param {String} type The type of adjustment.
* @param {Number} value The number.
* @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
* @returns {Number} The adjusted value.
*/
function decimalAdjust(type, value, exp) {
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
// If the value is not a number or the exp is not an integer...
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
return NaN;
}
// Shift
value = value.toString().split('e');
value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
// Shift back
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
}
// Decimal ceil
if (!Math.ceil10) {
Math.ceil10 = function(value, exp) {
return decimalAdjust('ceil', value, exp);
};
}
})();
Features Mentioned
- galvs-scripts.com
- [Mod edit: removed code because Galv does not allow redistribution.]
- TDDP BindPicturesTo Map
- TDDP-Repo/TDDP_BindPicturesToMap.js at master · TorD/TDDP-Repo
- TDD's Plugins for RPG Maker MV. Contribute to TorD/TDDP-Repo development by creating an account on GitHub.
- github.com
- Spoiler
- //=============================================================================
- // TDDP_BindPicturesToMap.js
- // Version: 1.0.7
- var Imported = Imported || {};
- Imported.TDDP_BindPicturesToMap = "1.0.7";
- /*:
- @plugindesc 1.0.7 Plugin Commands for binding pictures to the map and/or changing what layer they're drawn on.
- @Author Tor Damian Design / Galenmereth
- @Help =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
* └─ License : Free for Commercial and Non-Commercial Usage * */ // ╘══════════════════════════════════════════════════════════════════════════════════╛
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...