设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 6037|回复: 26
打印 上一主题 下一主题

[原创发布] 【MV·道具栏New提示】新获得道具在物品栏里绘制个New!

[复制链接]

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
9941
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

跳转到指定楼层
1
发表于 2018-12-30 08:12:36 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2019-1-7 19:10 编辑

2019/1/7 更新了一下
修正了使用图标时没有正确使用坐标偏移量的bug
添加了一个开关设置,设定的开关开启时获得新道具将不会被记录为新道具
帖子里添加了一张效果图展示使用效果

获得新道具的时候在物品栏道具图标下添加一个 NEW! 的小图标
JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // VIPArcher_ShowNewItem.js
  3. //-----------------------------------------------------------------------------
  4. // Project1 论坛:https://rpg.blue/ 使用或转载请保留以上信息。
  5. //=============================================================================
  6. /*:
  7.  * 说明: 用到的素材储存于 img/system 文件夹中
  8.  * @plugindesc 获得新道具时在物品栏列表中添加一个 New 的小图标
  9.  * 图标可以使用自定的单独素材或者 IconSet.png 里的图标
  10.  * @author VIPArcher
  11.  *
  12.  * @param NewIcon
  13.  * @desc 设置为 数字 时使用 IconSet.png 中对应位置的图标
  14.  * 设置为 字符串 时使用 system 目录中对应文件名的素材
  15.  * @default NewIcon
  16.  * @dir img/system/
  17.  * @type file
  18.  *
  19.  * @param Switch
  20.  * @desc 不记录新物品开关,此开启时获得任何物品都不记录为新道具
  21.  * 默认: 0 (不使用开关控制)
  22.  * @default 0
  23.  * @type switch
  24.  *
  25.  * @param OffsetX
  26.  * @desc 图标相对位置的 X 坐标偏移
  27.  * 默认: 0
  28.  * @default 0
  29.  * @type number
  30.  *
  31.  * @param OffsetY
  32.  * @desc 图标相对位置的 Y 坐标偏移
  33.  * 默认: 0
  34.  * @default 0
  35.  * @type number
  36.  *
  37.  * @help 这个插件没有需要操作的指令,不需要帮助。
  38.  */
  39. var VIPArcher = VIPArcher || {};
  40. VIPArcher.ShowNewItem = {};
  41. VIPArcher.ShowNewItem.version = '1.1.0';
  42. VIPArcher.ShowNewItem.Parameters = PluginManager.parameters('VIPArcher_ShowNewItem');
  43. var newIcon = VIPArcher.ShowNewItem.Parameters["NewIcon"] || "NewIcon";
  44. VIPArcher.ShowNewItem.NewIcon = isNaN(newIcon) ? String(newIcon) : Number(newIcon);
  45. VIPArcher.ShowNewItem.Switch  = Number(VIPArcher.ShowNewItem.Parameters["Switch"])  || 0;
  46. VIPArcher.ShowNewItem.OffsetX = Number(VIPArcher.ShowNewItem.Parameters["OffsetX"]) || 0;
  47. VIPArcher.ShowNewItem.OffsetY = Number(VIPArcher.ShowNewItem.Parameters["OffsetY"]) || 0;
  48.  
  49. void function() {
  50.     var ShowNewItem = VIPArcher.ShowNewItem;
  51.     var _Scene_Boot_loadSystemImages = Scene_Boot.loadSystemImages;
  52.     Scene_Boot.loadSystemImages = function() {
  53.         _Scene_Boot_loadSystemImages.call(this);
  54.         if (isNaN(ShowNewItem.NewIcon)) {
  55.             ImageManager.reserveSystem(ShowNewItem.NewIcon);
  56.         }
  57.     };
  58.     var _Game_Party_initAllItems = Game_Party.prototype.initAllItems;
  59.     Game_Party.prototype.initAllItems = function() {
  60.         _Game_Party_initAllItems.call(this);
  61.         this._newIconList = {'I': {}, 'W': {}, 'A': {}};
  62.     };
  63.     Game_Party.prototype._newItemContainer = function(item) {
  64.         if (!item) {
  65.             return null;
  66.         } else if (DataManager.isItem(item)) {
  67.             return this._newIconList['I'];
  68.         } else if (DataManager.isWeapon(item)) {
  69.             return this._newIconList['W'];
  70.         } else if (DataManager.isArmor(item)) {
  71.             return this._newIconList['A'];
  72.         } else {
  73.             return null;
  74.         }
  75.     };
  76.     Game_Party.prototype._setNewIcon = function(item) {
  77.         var container = this._newItemContainer(item);
  78.         if (container && !this.itemIsNew(item)) container[item.id] = true;
  79.     };
  80.     Game_Party.prototype.itemIsNew = function(item) {
  81.         var container = this._newItemContainer(item);
  82.         if (container) {
  83.             return container[item.id];
  84.         } else {
  85.             return null;
  86.         }
  87.     };
  88.     Game_Party.prototype.removeNewIcon = function(item) {
  89.         var container = this._newItemContainer(item);
  90.         if (container) delete container[item.id];
  91.     };
  92.     var _Game_Party_gainItem = Game_Party.prototype.gainItem;
  93.     Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
  94.         _Game_Party_gainItem.call(this, item, amount, includeEquip);
  95.         if (amount > 0 && !$gameSwitches.value(ShowNewItem.Switch)) this._setNewIcon(item);
  96.     };
  97.     var _Window_ItemList_drawItem = Window_ItemList.prototype.drawItem;
  98.     Window_ItemList.prototype.drawItem = function(index) {
  99.         _Window_ItemList_drawItem.call(this, index);
  100.         var item = this._data[index];
  101.         if (item && $gameParty.itemIsNew(item)) {
  102.             var rect = this.itemRect(index);
  103.             rect.width -= this.textPadding();
  104.             this.changePaintOpacity(this.isEnabled(item));
  105.             this.drawNewFlag(item, rect.x, rect.y);
  106.             this.changePaintOpacity(1);
  107.         }
  108.     };
  109.     Window_ItemList.prototype.drawNewFlag = function(item, x, y) {
  110.         var offsetX = ShowNewItem.OffsetX + 2;
  111.         var offsetY = ShowNewItem.OffsetY + 2;
  112.         if (isNaN(ShowNewItem.NewIcon)) {
  113.             var bitmap = ImageManager.loadSystem(ShowNewItem.NewIcon);
  114.             this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x + offsetX, y + offsetY);
  115.         } else {
  116.             this.drawIcon(ShowNewItem.NewIcon, x + offsetX, y + offsetY);
  117.         }
  118.     };
  119.     var _Window_ItemList_select = Window_ItemList.prototype.select;
  120.     Window_ItemList.prototype.select = function(index) {
  121.         if (this.index() >=0) this.removeNewIcon();
  122.         _Window_ItemList_select.call(this, index);
  123.     };
  124.     Window_ItemList.prototype.removeNewIcon = function() {
  125.         $gameParty.removeNewIcon(this.item());
  126.         this.redrawItem(this.index());
  127.     };
  128.     var _Game_Actor_tradeItemWithParty = Game_Actor.prototype.tradeItemWithParty;
  129.     Game_Actor.prototype.tradeItemWithParty = function(newItem, oldItem) {
  130.         var _result = _Game_Actor_tradeItemWithParty.call(this, newItem, oldItem);
  131.         $gameParty.removeNewIcon(oldItem);
  132.         return _result;
  133.     };
  134. }();

使用到的素材(放到目录  img/system 中):

评分

参与人数 8+8 收起 理由
tuxyin + 1 塞糖
if216 + 1 我很赞同
百里_飞柳 + 1 塞糖
j296196585 + 1 精品文章
白嫩白嫩的 + 1 塞糖
wabcmcc + 1 精品文章
liz_fly + 1 塞糖
言物之石 + 1 精品文章

查看全部评分

Lv4.逐梦者

梦石
0
星屑
5142
在线时间
604 小时
注册时间
2017-10-21
帖子
348
2
发表于 2019-1-7 11:35:14 | 只看该作者
本帖最后由 微笑的迪妮莎 于 2019-1-7 11:36 编辑

会出错呢大佬
可能跟我用的其他插件冲突吧

点评

哦,报错是第46行,好像是图片地址的识别问题。  发表于 2019-1-7 14:58
具体是什么错误呢?顺便我写的时候用的是MV1.6,旧版本MV可能会不兼容  发表于 2019-1-7 11:37
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
17732
在线时间
2144 小时
注册时间
2015-7-4
帖子
915
3
发表于 2019-1-7 13:39:25 | 只看该作者
用自定义图标会报错,用系统图标可以显示,但会覆盖物品原有图标,插件参数无法调整坐标。

点评

哦!非常感谢!我修改了55行后也OK了。  发表于 2019-1-7 22:10
我找群友拿了1.5.1的MV代码测试了一下,好像没有什么问题,我目前没有1.5.0的源码能看,所以你能说明一下具体报错是什么吗?  发表于 2019-1-7 16:14
那我再添加一个1.5版本的脚本吧  发表于 2019-1-7 15:07
是的,我的MV用1.50,很多人都还在用旧版本哦,能兼容一下就更完美了。  发表于 2019-1-7 14:55
嗯,谢谢反馈,的确忘了用系统图标的时候加上坐标偏移的设置,自定义图标报错可能是因为你用的MV是旧版本  发表于 2019-1-7 14:14
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5142
在线时间
604 小时
注册时间
2017-10-21
帖子
348
4
发表于 2019-1-7 19:00:04 | 只看该作者
我游戏都进不去大佬
从新下载的

点评

我的是1.51的,好的大佬我试试  发表于 2019-1-7 19:20
你试试把55行的ImageManager.reserveSystem(ShowNewItem.NewIcon);改成ImageManager.loadSystem(ShowNewItem.NewIcon);  发表于 2019-1-7 19:15
你也是MV 1.50 以前的版本吗  发表于 2019-1-7 19:11
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5142
在线时间
604 小时
注册时间
2017-10-21
帖子
348
5
发表于 2019-1-7 19:23:56 | 只看该作者
本帖最后由 微笑的迪妮莎 于 2019-1-7 19:25 编辑

大佬可以用了,不出错了,但是貌似不适用于我~~~


点评

嗯,其实你可以调整一下位置呗(×  发表于 2019-1-7 19:28
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5142
在线时间
604 小时
注册时间
2017-10-21
帖子
348
6
发表于 2019-1-7 19:38:08 | 只看该作者
原来如此  会用了  谢谢大佬的辛劳创作

我已转发了 保留了版权

点评

好的大佬 已经加上了  发表于 2019-1-7 19:45
转载可以,但是要带上原帖链接。因为也许未来还有bug需要更新  发表于 2019-1-7 19:44
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
122
在线时间
32 小时
注册时间
2019-3-20
帖子
30
7
发表于 2019-4-14 00:42:46 | 只看该作者
微笑的迪妮莎 发表于 2019-1-7 19:38
原来如此  会用了  谢谢大佬的辛劳创作

我已转发了 保留了版权

哥们,你的物品简介怎么弄的
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1994
在线时间
216 小时
注册时间
2019-3-23
帖子
26
8
发表于 2019-4-14 22:24:39 | 只看该作者
大佬,我在物品栏里面没有出现这个显示,但是在装备里面选装备就会显示,这是怎么回事呀

1555251706(1).png (20.97 KB, 下载次数: 21)

1

1

点评

可能是其他脚本改变了绘制的位置,或者修改了绘制道具的方法,只看截图我也看不出什么端倪(x  发表于 2019-4-14 23:57
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1994
在线时间
216 小时
注册时间
2019-3-23
帖子
26
9
发表于 2019-4-15 23:14:04 | 只看该作者
wesleylsw 发表于 2019-4-14 22:24
大佬,我在物品栏里面没有出现这个显示,但是在装备里面选装备就会显示,这是怎么回事呀 ...

装备里面是能看到这个标识,物品里面就不显示,我尝试把插件直接放在最后物品也不显示,不怎么会弄,能价个Q解决一下么,弄好有酬谢
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
68
在线时间
31 小时
注册时间
2009-7-29
帖子
63
10
发表于 2020-1-29 15:11:21 | 只看该作者
感谢分享!

点评

你又开始灌水!!?  发表于 2020-1-29 15:20
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-19 23:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表