Project1

标题: 求大神改造一个插件,用来显示在横版战斗上显示文字特... [打印本页]

作者: 老王的忧郁    时间: 2016-3-20 16:30
标题: 求大神改造一个插件,用来显示在横版战斗上显示文字特...

我希望插件可以用代码调用,来在战斗图上显示多种文字特效

例:

      


蓝色等颜色的跳出文字、显示在战斗图的上方、

向上浮动的蓝色等颜色的文字,在战斗图上方出现向上浮动

白色或者金色的文字出现在战斗图中央、不浮动

绿色、红色、蓝色 的文字出现在战斗图中央、然后向上浮动,

白色、金色、等文字出现在战斗图下方,不浮动

如果可以,希望还能设置渐变的颜色,不同的文字运动轨迹、自定义文字大小,自动转行等功能。

这些自定义的文字,希望可以引用  “伤害值”、变量、计算公式、技能名称等。

最好能搭配♦ YEP_BuffsStatesCore.js 这个插件中的自定义状态、技能等特殊效果使用,在技能或状态的注释栏中用代码调用   自定义文字显示 功能

以下是一个用来在战斗中显示攻击获取1EXP,同时在角色战斗图上显示“1+exp”文字的插件,或许能提供个例子。

JAVASCRIPT 代码复制
  1. /*:
  2. -------------------------------------------------------------------------------
  3. @title Battle Action Exp
  4. @author Hime --> HimeWorks ([url]http://himeworks.com[/url])
  5. @version 1.1
  6. @date Feb 25, 2016
  7. @filename HIME_BattleExpPopup.js
  8. @url
  9.  
  10. If you enjoy my work, consider supporting me on Patreon!
  11.  
  12. * [url]https://www.patreon.com/himeworks[/url]
  13.  
  14. If you have any questions or concerns, you can contact me at any of
  15. the following sites:
  16.  
  17. * Main Website: [url]http://himeworks.com[/url]
  18. * Facebook: [url]https://www.facebook.com/himeworkscom/[/url]
  19. * Twitter: [url]https://twitter.com/HimeWorks[/url]
  20. * Youtube: [url]https://www.youtube.com/c/HimeWorks[/url]
  21. * Tumblr: [url]http://himeworks.tumblr.com/[/url]
  22.  
  23. -------------------------------------------------------------------------------
  24. @plugindesc v1.1 - Gain Exp after performing an action, instead of at the end
  25. of battle.
  26. @help
  27. -------------------------------------------------------------------------------
  28. == Description ==
  29.  
  30. Example plugin that demonstrates how you could show an exp popup over the
  31. battler's head.
  32.  
  33. Requires Battle Action Exp plugin to be installed.
  34.  
  35. == Terms of Use ==
  36.  
  37. - Free for use in non-commercial projects with credits
  38. - Free for use in commercial projects, but it would be nice to let me know
  39. - Please provide credits to HimeWorks
  40.  
  41. == Change Log ==
  42.  
  43. 1.0 - Feb 25, 2016
  44.  * initial release
  45.  
  46. == Usage ==
  47.  
  48. Plug and play
  49.  
  50. -------------------------------------------------------------------------------
  51.  
  52. -------------------------------------------------------------------------------
  53.  */
  54. var Imported = Imported || {} ;
  55. var TH = TH || {};
  56. Imported.TH_BattleExpPopup = 1;
  57. TH.BattleExpPopup = TH.BattleExpPopup || {};
  58.  
  59. (function ($) {
  60.  
  61.   var TH_GameActionResult_clear = Game_ActionResult.prototype.clear;
  62.   Game_ActionResult.prototype.clear = function() {
  63.     TH_GameActionResult_clear.call(this);
  64.     this.expPopupChecked = false;
  65.   };
  66.  
  67.   var TH_SpriteBattler_initMembers = Sprite_Battler.prototype.initMembers;
  68.   Sprite_Battler.prototype.initMembers = function() {
  69.     TH_SpriteBattler_initMembers.call(this);
  70.     this._expPopups = [];
  71.   }
  72.  
  73.   var TH_SpriteBattler_update = Sprite_Battler.prototype.update;
  74.   Sprite_Battler.prototype.update = function() {
  75.     TH_SpriteBattler_update.call(this);
  76.     if (this._battler && this._battler.isSpriteVisible()) {
  77.       this.updateExpPopup();
  78.     }
  79.   }
  80.  
  81.   Sprite_Battler.prototype.setupExpPopup = function() {
  82.     var result = this._battler.result();
  83.     if (!result.expPopupChecked && result.gainedExp > 0) {
  84.       result.expPopupChecked = true;
  85.       var spr = new Sprite_ExpPopup();
  86.       spr.setup(this._battler);
  87.       spr.x = this.x + this.damageOffsetX() - 20;
  88.       spr.y = this.y + this.damageOffsetY() - 140;
  89.       this._expPopups.push(spr);
  90.       this.parent.addChild(spr);
  91.     }   
  92.   };
  93.  
  94.   Sprite_Battler.prototype.updateExpPopup = function() {
  95.     this.setupExpPopup();
  96.     if (this._expPopups.length > 0) {
  97.       for (var i = 0; i < this._expPopups.length; i++) {
  98.         this._expPopups[i].update();
  99.       }
  100.       if (!this._expPopups[0].isPlaying()) {
  101.         this.parent.removeChild(this._expPopups[0]);
  102.         this._expPopups.shift();
  103.       }
  104.     }
  105.   };
  106.  
  107.   function Sprite_ExpPopup() {
  108.     this.initialize.apply(this, arguments);
  109.   }
  110.   Sprite_ExpPopup.prototype = Object.create(Sprite_Base.prototype);
  111.   Sprite_ExpPopup.prototype.constructor = Sprite_ExpPopup;
  112.  
  113.   Sprite_ExpPopup.prototype.initialize = function() {
  114.     Sprite_Base.prototype.initialize.call(this);
  115.     this._duration = 90;
  116.   };
  117.  
  118.   Sprite_ExpPopup.prototype.setup = function(battler) {
  119.     this._battler = battler;
  120.     this.bitmap = new Bitmap(100, 200);
  121.     this.bitmap.textColor = "rgb(0, 255, 0)";
  122.     this.bitmap.fontSize = 20;
  123.     this.bitmap.drawText(battler.result().gainedExp + " exp", 0, 0, 100, 200, 'center');
  124.   };
  125.  
  126.   Sprite_ExpPopup.prototype.update = function() {
  127.     if (this._duration > 30) {
  128.       this.y -= 0.5;
  129.     }
  130.     if (this._duration > 0) {
  131.       this._duration -= 1
  132.     }
  133.   };
  134.  
  135.   Sprite_ExpPopup.prototype.isPlaying = function() {
  136.     return this._duration > 0;
  137.   };
  138. })(TH.BattleExpPopup);





      

作者: 汪汪    时间: 2016-3-22 12:07
本帖最后由 汪汪 于 2016-3-22 21:09 编辑




  1. (function() {

  2. Sprite_Damage.prototype.setup = function(target) {
  3.     var result = target.result();
  4.     if(result.text){
  5.             this.createText(result.text)
  6.             result.text =  null
  7.     }
  8.     if (result.missed || result.evaded) {
  9.         this.createMiss();
  10.     } else if (result.hpAffected) {
  11.         this.createDigits(0, result.hpDamage);
  12.     } else if (target.isAlive() && result.mpDamage !== 0) {
  13.         this.createDigits(2, result.mpDamage);
  14.     }
  15.     if (result.critical) {
  16.         this.setupCriticalEffect();
  17.     }
  18. };

  19. //创建数字
  20. Sprite_Damage.prototype.createText = function(text) {
  21.     var w = new Window_Help(1)
  22.     w.setText = function(text) {
  23.             this._text = text;
  24.             this.contents.clear();
  25.             return this.drawTextEx(this._text, 0, 0);
  26.         };
  27.     var width = w.setText(text)
  28.     var sprite = w._windowContentsSprite  
  29.     sprite.x = 0
  30.     sprite.y = 0
  31.     sprite.pivot.x = width/2;
  32.     sprite.anchor.y = 1;
  33.     sprite.y = -40;
  34.     sprite.ry = sprite.y;
  35.     sprite.dy = 0;
  36.     this.addChild(sprite);
  37. };




  38. })();

复制代码
//大概效果就是这样........应该
在伤害公式里写
JAVASCRIPT 代码复制
  1. a._result.text ="攻击啦!!" ;a.atk * 4 - b.def * 2





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1