查看: 2414|回复: 1

[有事请教] Terrax照明和Foreground冲突的问题

[复制链接]
梦石
0
星屑
594
在线时间
99 小时
注册时间
2020-5-7
回帖
8
发表于 2020-8-19 10:26:27 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 水果布丁 于 2020-8-19 10:29 编辑

rt,terraxlighting插件和dlc里的foreground插件不能同时使用,否则会报未定义bitmap
DD169C0B-CA59-4f53-9D61-D561BE82E9CE.png
请问如何解决?
D9E3B6F3-12B2-4f92-B3B2-14A5E6B33007.png
terrax和fore的脚本如下
  1. //=============================================================================
  2. // Terrax Plugins - Quasi ABS support for  Terrax Lighting system
  3. // TerraxLighting.js
  4. // Version: 1.2
  5. //=============================================================================
  6. //

  7. //=============================================================================
  8. /*:
  9. * @plugindesc v1.2 Support for linking QuasiABS with TerraxLightingSystem
  10. * @author Terrax
  11. *
  12. * @help
  13. * The following definitions can be added to the QuasiABS settings in the database - skill-settings
  14. *
  15. * tx_missle: 25, #FF0000
  16. * Will give the missle a small (radius 25) red (color #FF0000) lightsource
  17. *
  18. * tx_onhit: 30, #FFAA00, 10, FADEOUT, 5
  19. * Will give a small yellow lightflash whenever the missle impacts on a wall or flies out of view, it will fadeout on the last 5 frames
  20. *
  21. * tx_onhitNPC: 100, #FFAA00, 15
  22. * Will give a large yellow lightflash when the missle impacts with an NPC character.
  23. *
  24. *
  25. * Example :
  26. *
  27. * <absSettings>
  28. *   collider: circle, 13, 13
  29. *   cooldown: 45
  30. *   through: 3
  31. *   tx_missle: 25, #FF0000
  32. *   tx_onhit: 30, #FFAA00, 10, FADEOUT, 5
  33. *   tx_onhitNPC: 100, #FFAA00, 15
  34. * </absSettings>
  35. *
  36. *
  37. * To make a state give light (for burning for example) you can define the radius and color in the note-tag of the state
  38. * with the following definition.
  39. * Database -> States -> Notetag ->  <TX>TX:50,#FFAA00;</TX>
  40. * for a light effect with radius 50 and color #FFAA00.
  41. *
  42. * Released under the MIT license,
  43. * if used for commercial projects feel free to make a donation or
  44. * better yet, give me a free version of what you have created.
  45. * e-mail : fox(AT)caiw.nl / terraxz2 on steam.
  46. *
  47. * Thanks to everyone in the rpgmakerweb community for idea's, support and interest.
  48. */
  49. //=============================================================================
  50. //  ps.. if my code looks funky, i'm an old guy..
  51. // object orientated programming bugs the hell out of me.
  52. var Imported = Imported || {};
  53. Imported.TerraxLightingQuasiABS = true;

  54. (function() {


  55.         // OVERWRITTEN FROM QUASI ABS TO ADD LIGHTSOURCES TO MISSLES AND END ANIMATIONS
  56.         // Skill_Sequencer

  57.         Skill_Sequencer.prototype.update = function() {

  58.                 if (this._skill.break) {
  59.                         var i = this._character._skillLocked.indexOf(this._skill);
  60.                         if (i >= 0) {
  61.                                 this._character._skillLocked.splice(i, 1);
  62.                         }
  63.                         this._character._casting = false;
  64.                         QuasiABS.Manager.removePicture(this._skill.picture);
  65.                         QuasiABS.Manager.removePicture(this._skill.trail);
  66.                         QuasiABS.Manager.removePicture(this._skill.pictureCollider);
  67.                         i = this._character._activeSkills.indexOf(this._skill);
  68.                         this._character._activeSkills.splice(i, 1);
  69.                         return;
  70.                 }
  71.                 if (this._skill.moving) {

  72.                         // ADDED
  73.                         Terrax_ABS_skill_x.push(this._skill.collider.center.x);
  74.                         Terrax_ABS_skill_y.push(this._skill.collider.center.y);
  75.                         Terrax_ABS_skill.push(this._skill.settings.tx_missle);
  76.                         this.updateSkillPosition();
  77.                 }
  78.                 if (this._waitCount > 0) {
  79.                         this._waitCount--;
  80.                         return;
  81.                 }
  82.                 if (this._waitForUserMove || this._waitForUserJump || this._waitForPose) {
  83.                         if (!this._character.isMoving())   this._waitForUserMove = false;
  84.                         if (!this._character.isJumping())  this._waitForUserJump = false;
  85.                         if (!this._character._posePlaying) this._waitForPose = false;
  86.                 }
  87.                 if (this._waitForMove || this._waitForUserMove ||
  88.                         this._waitForUserJump || this._waitForPose) {
  89.                         return;
  90.                 }
  91.                 var sequence = this._skill.sequence.shift();
  92.                 if (sequence) {
  93.                         var action = sequence.split(' ');

  94.                         // TX ADDED Trigger
  95.                         if (action[0].toLowerCase() == "trigger") {
  96.                                 Terrax_ABS_blast_x.push(this._skill.collider.center.x);
  97.                                 Terrax_ABS_blast_y.push(this._skill.collider.center.y);
  98.                                 Terrax_ABS_blast.push(this._skill.settings.tx_blast);
  99.                                 Terrax_ABS_blast_duration.push(-1);
  100.                                 Terrax_ABS_blast_fade.push(-1);
  101.                                 Terrax_ABS_blast_grow.push(-1);
  102.                                 Terrax_ABS_blast_mapid.push($gameMap.mapId());
  103.                         }

  104.                         this.startAction(action);
  105.                 }
  106.                 if (this._skill.sequence.length === 0) {
  107.                         if (!this._skill.moving) {
  108.                                 var i = this._character._activeSkills.indexOf(this._skill);
  109.                                 QuasiABS.Manager.removePicture(this._skill.picture);
  110.                                 QuasiABS.Manager.removePicture(this._skill.trail);
  111.                                 QuasiABS.Manager.removePicture(this._skill.pictureCollider);
  112.                                 this._character._activeSkills.splice(i, 1);

  113.                                 // TX ADDED On hit
  114.                                 //Graphics.Debug2('coors xy',this._skill.collider.center.x+'-'+this._skill.collider.center.y+' '+this._skill.settings.tx_onhit);

  115.                                 Terrax_ABS_blast_x.push(this._skill.collider.center.x-$gameMap.tileWidth()/2);
  116.                                 Terrax_ABS_blast_y.push(this._skill.collider.center.y-$gameMap.tileHeight()/2);
  117.                                 Terrax_ABS_blast.push(this._skill.settings.tx_onhit);
  118.                                 Terrax_ABS_blast_duration.push(-1);
  119.                                 Terrax_ABS_blast_fade.push(-1);
  120.                                 Terrax_ABS_blast_grow.push(-1);
  121.                                 Terrax_ABS_blast_mapid.push($gameMap.mapId());

  122.                         }
  123.                 }


  124.         };

  125.         Skill_Sequencer.prototype.updateState = function() {

  126.         }


  127.         Graphics.Debug2 = function(name, message) {
  128.                 if (this._errorPrinter) {
  129.                         this._errorPrinter.innerHTML = this._makeErrorHtml(name, message);
  130.                 }
  131.         };


  132.         QuasiABS.Manager.startAction = function(self, targets, item) {
  133.                 if (!item.animationTarget || targets.length === 0) {
  134.                         this.startAnimation(item.data.animationId, item.collider.center.x, item.collider.center.y);
  135.                 }
  136.                 for (var i = 0; i < targets.length; i++) {
  137.                         if (item.animationTarget === 1) {
  138.                                 var x = targets[i].cx();
  139.                                 var y = targets[i].cy();
  140.                                 this.startAnimation(item.data.animationId, x, y);
  141.                         }

  142.                         var action = new Game_Action(self.battler(), true);
  143.                         action.setSkill(item.data.id);

  144.                         var tx_x = targets[i].cx()-$gameMap.tileWidth()/2;
  145.                         var tx_y = targets[i].cy()-$gameMap.tileHeight()/2;
  146.                         var tx_set = item.settings.tx_state;

  147.                         action.absApply(targets[i].battler());

  148.                         // TX ADDED OnHitNPC
  149.                         Terrax_ABS_blast_x.push(targets[i].cx()-$gameMap.tileWidth()/2);
  150.                         Terrax_ABS_blast_y.push(targets[i].cy()-$gameMap.tileHeight()/2);
  151.                         Terrax_ABS_blast.push(item.settings.tx_onhitNPC);
  152.                         Terrax_ABS_blast_duration.push(-1);
  153.                         Terrax_ABS_blast_fade.push(-1);
  154.                         Terrax_ABS_blast_grow.push(-1);
  155.                         Terrax_ABS_blast_mapid.push($gameMap.mapId());

  156.                         var id = self === $gamePlayer ? 0 : self.eventId();
  157.                         targets[i].addAgro(id, item.data);
  158.                 }
  159.         };

  160.         Game_CharacterBase.prototype.updateABS = function() {
  161.                 if (this.battler())  {
  162.                         if (this.battler().hp <= 0) return this.onDeath();
  163.                         this.updateSkills();
  164.                         this.battler().updateABS(this._realX,this._realY);
  165.                 }
  166.         };

  167.         Game_Battler.prototype.updateABS = function(x,y) {
  168.                 for (var i = 0; i < this.states().length; i++) {
  169.                         this.updateStateSteps(this.states()[i],x,y);
  170.                 }
  171.                 //this.showAddedStates();   //Currently does nothing, so no need to run it
  172.                 //this.showRemovedStates(); //Currently does nothing, so no need to run it
  173.         };

  174.         Game_Battler.prototype.updateStateSteps = function(state,x,y) {
  175.                 if (!state.removeByWalking) return;
  176.                 if (this._stateSteps[state.id] >= 0) {
  177.                         if (this._stateSteps[state.id] % this.stepsForTurn() === 0) {
  178.                                 this.onTurnEnd();
  179.                                 this.result().damageIcon = $dataStates[state.id].iconIndex;
  180.                                 this.startDamagePopup();
  181.                                 if (this._stateSteps[state.id] === 0) this.removeState(state.id);
  182.                         }
  183.                         this._stateSteps[state.id]--;

  184.                         // ADDED
  185.                         var statenote = $dataStates[state.id].note;

  186.                         if (statenote) {
  187.                                 var searchnote = statenote.indexOf("TX:");
  188.                                 if (searchnote >= 0) {
  189.                                         var closetag = statenote.indexOf(";",searchnote);
  190.                                         var txdata = statenote.substring(searchnote+3, closetag);

  191.                                         //Graphics.Debug2('state',$dataStates[state.id].note+ " "+txdata);

  192.                                         var tw = $gameMap.tileWidth();
  193.                                         var ty = $gameMap.tileHeight();
  194.                                         var x1 = (x * tw) + (tw/2);
  195.                                         var y1 = (y * ty) + (ty/2);

  196.                                         Terrax_ABS_skill_x.push(x1);
  197.                                         Terrax_ABS_skill_y.push(y1);
  198.                                         Terrax_ABS_skill.push(txdata);

  199.                                 }
  200.                         }

  201.                 }
  202.         };

  203. })();

  204.        
  205.        
复制代码
  1. //=============================================================================
  2. // Foreground.js (Ver1.0.1)
  3. //=============================================================================
  4. // [History]
  5. // 2015.Nov. 7  1.0.0 First Release
  6. // 2018.Sep.19  1.0.1 Fix bug when 'event command -> test' becomes error

  7. /*:
  8. * @plugindesc display foreground tiling sprite(Ver1.0.1)
  9. * @author Sasuke KANNAZUKI (thanks to Yoji Ojima)
  10. *
  11. * @noteParam fgName
  12. * @noteRequire 1
  13. * @noteDir img/parallaxes/
  14. * @noteType file
  15. * @noteData maps
  16. *
  17. * @help  This plugin does not provide plugin commands.
  18. *
  19. * 'foreground' is like a parallax that displays over the map.
  20. * put bitmap file at img/parallaxes.
  21. *
  22. * Map Note:
  23. *  write down following 5 settings at map's note.
  24. *  <fgName:name>     name is the string, file name of tiling sprite.
  25. *    if the name starts '!', it is regarded as "foreground zero".
  26. *    the filename is searched from img/parallaxes.
  27. *  <fgLoopX:number>  number is the flag of loop x. 0:no 1:yes
  28. *    if this is not written on the note, it'll be 0(=no).
  29. *  <fgLoopY:number>  number is the flag of loop y. 0:no 1:yes
  30. *    if this is not written on the note, it'll be 0(=no).
  31. *  <fgSx:number>     number is x scroll speed.
  32. *    when it doesn't loop x, this is ignored.
  33. *    if this is not written on the note, it'll be 0.
  34. *  <fgSy:number>     number is y scroll speed.
  35. *    when it doesn't loop y, this is ignored.
  36. *    if this is not written on the note, it'll be 0.
  37. *
  38. * Ex.
  39. * <fgName:sample1><fgLoopX:1><fgLoopY:1>
  40. *
  41. * <fgName:!sample1>
  42. *
  43. * [License]
  44. * this plugin is released under MIT license.
  45. * http://opensource.org/licenses/mit-license.php
  46. */

  47. /*:ja
  48. * @plugindesc マップに合わせてスクロールする近景の設定(Ver1.0.1)
  49. * @author 神無月サスケ (thanks to Yoji Ojima)
  50. *
  51. * @noteParam fgName
  52. * @noteRequire 1
  53. * @noteDir img/parallaxes/
  54. * @noteType file
  55. * @noteData maps
  56. *
  57. * @help このプラグインにプラグインコマンドはありません。
  58. * 近景(foreground)は、マップの上に表示される遠景のようなものです。
  59. * 使用する画像ファイルは、img/parallaxes に置いてください。
  60. *
  61. * マップのメモ:
  62. *  以下の5項目を書いてください(設定項目は、遠景と似ています)。
  63. *  <fgName:ファイル名> 前景として使うファイル名です(拡張子なし)
  64. *    名前が '!'で始まる場合、遠景同様視差ゼロとなります。
  65. *    ファイルは img/parallaxes に置いてください
  66. *  <fgLoopX:数字> X座標にループするかどうか  (0:no 1:yes)。
  67. *    省略時は0(=no)になります。
  68. *  <fgLoopY:number> Y座標にループするかどうか  (0:no 1:yes)。
  69. *    省略時は0(=no)になります。
  70. *  <fgSx:数字>    X座標のスクロール速度です
  71. *    X座標にループしない場合は無視されます。
  72. *    省略時は0になります。
  73. *  <fgSy:数字>    Y座標のスクロール速度です
  74. *    Y座標にループしない場合は無視されます。
  75. *    省略時は0になります。
  76. *
  77. * 例:
  78. * <fgName:sample1><fgLoopX:1><fgLoopY:1>
  79. * sample1.png が前景になり、斜め上にループします。
  80. *
  81. * <fgName:!sample1>
  82. * 視差ゼロで!sample1.png が表示されます。
  83. *
  84. * ■ライセンス表記
  85. * このプラグインは MIT ライセンスで配布されます。
  86. * ご自由にお使いください。
  87. * http://opensource.org/licenses/mit-license.php
  88. */

  89. (function() {
  90.   //
  91.   // check zero foreground or not.
  92.   //
  93.   ImageManager.isZeroForeground = function(filename) {
  94.     return filename.charAt(0) === '!';
  95.   };

  96.   //
  97.   // map initialization
  98.   //
  99.   var _Game_Map_initialize = Game_Map.prototype.initialize;
  100.   Game_Map.prototype.initialize = function() {
  101.     _Game_Map_initialize.call(this);
  102.     this.initForeground();
  103.   };

  104.   Game_Map.prototype.initForeground = function(){
  105.     this._foregroundDefined = true;
  106.     this._foregroundName = '';
  107.     this._foregroundZero = false;
  108.     this._foregroundLoopX = false;
  109.     this._foregroundLoopY = false;
  110.     this._foregroundSx = 0;
  111.     this._foregroundSy = 0;
  112.     this._foregroundX = 0;
  113.     this._foregroundY = 0;
  114.   };

  115.   //
  116.   // if foreground is undefined, initialize it.
  117.   //
  118.   Game_Map.prototype.guardForeground = function(){
  119.     if(!this._foregroundDefined){
  120.       this.initForeground();
  121.     }
  122.   };

  123.   //
  124.   // an accessor
  125.   //
  126.   Game_Map.prototype.foregroundName = function() {
  127.     this.guardForeground();
  128.     return this._foregroundName;
  129. };

  130.   //
  131.   // set foreground by reading map's note.
  132.   //
  133.   var _Game_Map_setup = Game_Map.prototype.setup;
  134.   Game_Map.prototype.setup = function(mapId) {
  135.     _Game_Map_setup.call(this, mapId);
  136.     this.setupForeground();
  137.   };

  138.   Game_Map.prototype.setupForeground = function() {
  139.     if ($dataMap.meta) {
  140.       this._foregroundName = $dataMap.meta.fgName || '';
  141.       this._foregroundZero = ImageManager.isZeroForeground(
  142.         this._foregroundName);
  143.       this._foregroundLoopX = !!$dataMap.meta.fgLoopX;
  144.       this._foregroundLoopY = !!$dataMap.meta.fgLoopY;
  145.       this._foregroundSx = Number($dataMap.meta.fgSx) || 0;
  146.       this._foregroundSy = Number($dataMap.meta.fgSy) || 0;
  147.     }
  148.     this._foregroundX = 0;
  149.     this._foregroundY = 0;
  150.   };

  151.   //
  152.   // to display foreground
  153.   //
  154.   var _Game_Map_setDisplayPos = Game_Map.prototype.setDisplayPos;
  155.   Game_Map.prototype.setDisplayPos = function(x, y) {
  156.     _Game_Map_setDisplayPos.call(this, x, y);
  157.     this.guardForeground();
  158.     if (this.isLoopHorizontal()) {
  159.       this._foregroundX = x;
  160.     } else {
  161.        this._foregroundX = this._displayX;
  162.     }
  163.     if (this.isLoopVertical()) {
  164.       this._foregroundY = y;
  165.     } else {
  166.       this._foregroundY = this._displayY;
  167.     }
  168.   };

  169.   Game_Map.prototype.foregroundOx = function() {
  170.     this.guardForeground();
  171.     if (this._foregroundZero) {
  172.       return this._foregroundX * this.tileWidth();
  173.     } else if (this._foregroundLoopX) {
  174.       return this._foregroundX * this.tileWidth() / 2;
  175.     } else {
  176.       return 0;
  177.     }
  178.   };

  179.   Game_Map.prototype.foregroundOy = function() {
  180.     this.guardForeground();
  181.     if (this._foregroundZero) {
  182.       return this._foregroundY * this.tileHeight();
  183.     } else if (this._foregroundLoopY) {
  184.       return this._foregroundY * this.tileHeight() / 2;
  185.     } else {
  186.       return 0;
  187.     }
  188.   };

  189.   //
  190.   // to scroll foreground
  191.   //
  192.   var _Game_Map_scrollDown = Game_Map.prototype.scrollDown;
  193.   Game_Map.prototype.scrollDown = function(distance) {
  194.     var lastY = this._displayY;
  195.     _Game_Map_scrollDown.call(this, distance);
  196.     this.guardForeground();
  197.     if (this.isLoopVertical()) {
  198.       if (this._foregroundLoopY) {
  199.         this._foregroundY += distance;
  200.       }
  201.     } else if (this.height() >= this.screenTileY()) {
  202.       var displayY = Math.min(lastY + distance,
  203.         this.height() - this.screenTileY());
  204.       this._foregroundY += displayY - lastY;
  205.     }
  206.   };

  207.   var _Game_Map_scrollLeft = Game_Map.prototype.scrollLeft;
  208.   Game_Map.prototype.scrollLeft = function(distance) {
  209.     var lastX = this._displayX;
  210.     _Game_Map_scrollLeft.call(this, distance);
  211.     this.guardForeground();
  212.     if (this.isLoopHorizontal()) {
  213.       if (this._foregroundLoopX) {
  214.         this._foregroundX -= distance;
  215.       }
  216.     } else if (this.width() >= this.screenTileX()) {
  217.       var displayX = Math.max(lastX - distance, 0);
  218.       this._foregroundX += displayX - lastX;
  219.     }
  220.   };

  221.   var _Game_Map_scrollRight = Game_Map.prototype.scrollRight;
  222.   Game_Map.prototype.scrollRight = function(distance) {
  223.     var lastX = this._displayX;
  224.     _Game_Map_scrollRight.call(this, distance);
  225.     this.guardForeground();
  226.     if (this.isLoopHorizontal()) {
  227.       if (this._foregroundLoopX) {
  228.         this._foregroundX += distance;
  229.       }
  230.     } else if (this.width() >= this.screenTileX()) {
  231.       var displayX = Math.min(lastX + distance,
  232.        this.width() - this.screenTileX());
  233.       this._foregroundX += displayX - lastX;
  234.     }
  235.   };

  236.   var _Game_Map_scrollUp = Game_Map.prototype.scrollUp;
  237.   Game_Map.prototype.scrollUp = function(distance) {
  238.     var lastY = this._displayY;
  239.     _Game_Map_scrollUp.call(this, distance);
  240.     this.guardForeground();
  241.     if (this.isLoopVertical()) {
  242.       if (this._foregroundLoopY) {
  243.         this._foregroundY -= distance;
  244.       }
  245.     } else if (this.height() >= this.screenTileY()) {
  246.       var displayY = Math.max(lastY - distance, 0);
  247.       this._foregroundY += displayY - lastY;
  248.     }
  249.   };

  250.   //
  251.   // update foreground
  252.   //
  253.   var _Game_Map_update = Game_Map.prototype.update;
  254.   Game_Map.prototype.update = function(sceneActive) {
  255.     _Game_Map_update.call(this, sceneActive);
  256.     this.updateForeground();
  257.   };

  258.   Game_Map.prototype.updateForeground = function() {
  259.     this.guardForeground();
  260.     if (this._foregroundLoopX) {
  261.       this._foregroundX += this._foregroundSx / this.tileWidth() / 2;
  262.     }
  263.     if (this._foregroundLoopY) {
  264.       this._foregroundY += this._foregroundSy / this.tileHeight() / 2;
  265.     }
  266.   };

  267.   //
  268.   // sprites
  269.   //
  270.   var _Spriteset_Map_createLowerLayer =
  271.    Spriteset_Map.prototype.createLowerLayer;
  272.   Spriteset_Map.prototype.createLowerLayer = function() {
  273.     _Spriteset_Map_createLowerLayer.call(this);
  274.    this.createForeground();
  275.   };

  276.   var _Spriteset_Map_update = Spriteset_Map.prototype.update;
  277.   Spriteset_Map.prototype.update = function() {
  278.     _Spriteset_Map_update.call(this);
  279.     this.updateForeground();
  280.   };

  281.   Spriteset_Map.prototype.createForeground = function() {
  282.     this._foreground = new TilingSprite();
  283.     this._foreground.move(0, 0, Graphics.width, Graphics.height);
  284.     // in order to display under the weather sprites:
  285.     this._baseSprite.removeChild(this._weather);
  286.     this._baseSprite.addChild(this._foreground);
  287.     this._baseSprite.addChild(this._weather);
  288.   };

  289.   Spriteset_Map.prototype.updateForeground = function() {
  290.     if (this._foregroundName !== $gameMap.foregroundName()) {
  291.       this._foregroundName = $gameMap.foregroundName();
  292.       this._foreground.bitmap = ImageManager.loadParallax(this._foregroundName);
  293.     }
  294.     if (this._foreground.bitmap) {
  295.       this._foreground.origin.x = $gameMap.foregroundOx();
  296.       this._foreground.origin.y = $gameMap.foregroundOy();
  297.     }
  298.   };

  299. })();
复制代码
梦石
0
星屑
594
在线时间
99 小时
注册时间
2020-5-7
回帖
8
 楼主| 发表于 2020-8-27 11:20:58 | 显示全部楼层
请问有谁知道如何解决?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部