查看: 3367|回复: 1

[已经解决] 求大神改造一个插件,用来显示在横版战斗上显示文字特...

[复制链接]
梦石
0
星屑
75
在线时间
73 小时
注册时间
2015-7-10
回帖
26
发表于 2016-3-20 16:30:58 | 显示全部楼层 |阅读模式

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

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

×

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

例: 文字特效.jpg

       寒冰真气.jpg


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

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

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

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

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

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

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

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

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

  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. If you enjoy my work, consider supporting me on Patreon!

  10. * [url]https://www.patreon.com/himeworks[/url]

  11. If you have any questions or concerns, you can contact me at any of
  12. the following sites:

  13. * Main Website: [url]http://himeworks.com[/url]
  14. * Facebook: [url]https://www.facebook.com/himeworkscom/[/url]
  15. * Twitter: [url]https://twitter.com/HimeWorks[/url]
  16. * Youtube: [url]https://www.youtube.com/c/HimeWorks[/url]
  17. * Tumblr: [url]http://himeworks.tumblr.com/[/url]

  18. -------------------------------------------------------------------------------
  19. @plugindesc v1.1 - Gain Exp after performing an action, instead of at the end
  20. of battle.
  21. @help
  22. -------------------------------------------------------------------------------
  23. == Description ==

  24. Example plugin that demonstrates how you could show an exp popup over the
  25. battler's head.

  26. Requires Battle Action Exp plugin to be installed.

  27. == Terms of Use ==

  28. - Free for use in non-commercial projects with credits
  29. - Free for use in commercial projects, but it would be nice to let me know
  30. - Please provide credits to HimeWorks

  31. == Change Log ==

  32. 1.0 - Feb 25, 2016
  33. * initial release

  34. == Usage ==

  35. Plug and play

  36. -------------------------------------------------------------------------------

  37. -------------------------------------------------------------------------------
  38. */
  39. var Imported = Imported || {} ;
  40. var TH = TH || {};
  41. Imported.TH_BattleExpPopup = 1;
  42. TH.BattleExpPopup = TH.BattleExpPopup || {};

  43. (function ($) {

  44.   var TH_GameActionResult_clear = Game_ActionResult.prototype.clear;
  45.   Game_ActionResult.prototype.clear = function() {
  46.     TH_GameActionResult_clear.call(this);
  47.     this.expPopupChecked = false;
  48.   };

  49.   var TH_SpriteBattler_initMembers = Sprite_Battler.prototype.initMembers;
  50.   Sprite_Battler.prototype.initMembers = function() {
  51.     TH_SpriteBattler_initMembers.call(this);
  52.     this._expPopups = [];
  53.   }
  54.   
  55.   var TH_SpriteBattler_update = Sprite_Battler.prototype.update;
  56.   Sprite_Battler.prototype.update = function() {
  57.     TH_SpriteBattler_update.call(this);
  58.     if (this._battler && this._battler.isSpriteVisible()) {
  59.       this.updateExpPopup();
  60.     }
  61.   }
  62.   
  63.   Sprite_Battler.prototype.setupExpPopup = function() {
  64.     var result = this._battler.result();
  65.     if (!result.expPopupChecked && result.gainedExp > 0) {
  66.       result.expPopupChecked = true;
  67.       var spr = new Sprite_ExpPopup();
  68.       spr.setup(this._battler);
  69.       spr.x = this.x + this.damageOffsetX() - 20;
  70.       spr.y = this.y + this.damageOffsetY() - 140;
  71.       this._expPopups.push(spr);
  72.       this.parent.addChild(spr);
  73.     }   
  74.   };
  75.   
  76.   Sprite_Battler.prototype.updateExpPopup = function() {
  77.     this.setupExpPopup();
  78.     if (this._expPopups.length > 0) {
  79.       for (var i = 0; i < this._expPopups.length; i++) {
  80.         this._expPopups[i].update();
  81.       }
  82.       if (!this._expPopups[0].isPlaying()) {
  83.         this.parent.removeChild(this._expPopups[0]);
  84.         this._expPopups.shift();
  85.       }
  86.     }
  87.   };
  88.   
  89.   function Sprite_ExpPopup() {
  90.     this.initialize.apply(this, arguments);
  91.   }
  92.   Sprite_ExpPopup.prototype = Object.create(Sprite_Base.prototype);
  93.   Sprite_ExpPopup.prototype.constructor = Sprite_ExpPopup;
  94.   
  95.   Sprite_ExpPopup.prototype.initialize = function() {
  96.     Sprite_Base.prototype.initialize.call(this);
  97.     this._duration = 90;
  98.   };
  99.   
  100.   Sprite_ExpPopup.prototype.setup = function(battler) {
  101.     this._battler = battler;
  102.     this.bitmap = new Bitmap(100, 200);
  103.     this.bitmap.textColor = "rgb(0, 255, 0)";
  104.     this.bitmap.fontSize = 20;
  105.     this.bitmap.drawText(battler.result().gainedExp + " exp", 0, 0, 100, 200, 'center');
  106.   };
  107.   
  108.   Sprite_ExpPopup.prototype.update = function() {
  109.     if (this._duration > 30) {
  110.       this.y -= 0.5;
  111.     }
  112.     if (this._duration > 0) {
  113.       this._duration -= 1
  114.     }
  115.   };
  116.   
  117.   Sprite_ExpPopup.prototype.isPlaying = function() {
  118.     return this._duration > 0;
  119.   };
  120. })(TH.BattleExpPopup);
复制代码





      
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2016-3-22 12:07:47 | 显示全部楼层
本帖最后由 汪汪 于 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. })();

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

点评

我会考虑的  发表于 2016-3-22 22:21
能够显示自定义的文字、图标、变量等。 但没有文字轨迹的变化和多元化的文字显示形式  发表于 2016-3-22 22:13
额,总之好像智商高简单版  发表于 2016-3-22 12:37
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部