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

Project1

 找回密码
 注册会员
搜索
查看: 10259|回复: 12

[有事请教] 如何让敌人图鉴里显示其他图片而不是战斗图片?

[复制链接]

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
发表于 2018-3-14 15:48:32 | 显示全部楼层 |阅读模式
100星屑
本帖最后由 眼中目之瞳 于 2018-3-14 15:55 编辑

在横板战斗中使用横板图,而在图鉴中显示的是其他图片
举例:
战斗中使用这张图片:
未标题-1.png
而图鉴中使用这张图片:
未标题-2.png
以下是我在用的图鉴脚本(有修改,游戏窗口大小是1024×640)

JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // EnemyBook.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Displays detailed statuses of enemies.
  7.  * @author Yoji Ojima
  8.  *
  9.  * @param Unknown Data
  10.  * @desc The index name for an unknown enemy.
  11.  * @default ??????
  12.  *
  13.  * @help
  14.  *
  15.  * Plugin Command:
  16.  *   EnemyBook open         # Open the enemy book screen
  17.  *   EnemyBook add 3        # Add enemy #3 to the enemy book
  18.  *   EnemyBook remove 4     # Remove enemy #4 from the enemy book
  19.  *   EnemyBook complete     # Complete the enemy book
  20.  *   EnemyBook clear        # Clear the enemy book
  21.  *
  22.  * Enemy Note:
  23.  *   <desc1:foobar>         # Description text in the enemy book, line 1
  24.  *   <desc2:blahblah>       # Description text in the enemy book, line 2
  25.  *   <book:no>              # This enemy does not appear in the enemy book
  26.  */
  27.  
  28. /*:ja
  29.  * @plugindesc モンスター図鑑です。敵キャラの詳細なステータスを表示します。
  30.  * @author Yoji Ojima
  31.  *
  32.  * @param Unknown Data
  33.  * @desc 未確認の敵キャラの索引名です。
  34.  * @default ??????
  35.  *
  36.  * @help
  37.  *
  38.  * プラグインコマンド:
  39.  *   EnemyBook open         # 図鑑画面を開く
  40.  *   EnemyBook add 3        # 敵キャラ3番を図鑑に追加
  41.  *   EnemyBook remove 4     # 敵キャラ4番を図鑑から削除
  42.  *   EnemyBook complete     # 図鑑を完成させる
  43.  *   EnemyBook clear        # 図鑑をクリアする
  44.  *
  45.  * 敵キャラのメモ:
  46.  *   <desc1:なんとか>       # 説明1行目
  47.  *   <desc2:かんとか>       # 説明2行目
  48.  *   <book:no>              # 図鑑に載せない場合
  49.  */
  50.  
  51. (function() {
  52.  
  53.     var parameters = PluginManager.parameters('EnemyBook');
  54.     var unknownData = String(parameters['Unknown Data'] || '??????');
  55.  
  56.     var _Game_Interpreter_pluginCommand =
  57.             Game_Interpreter.prototype.pluginCommand;
  58.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  59.         _Game_Interpreter_pluginCommand.call(this, command, args);
  60.         if (command === 'EnemyBook') {
  61.             switch (args[0]) {
  62.             case 'open':
  63.                 SceneManager.push(Scene_EnemyBook);
  64.                 break;
  65.             case 'add':
  66.                 $gameSystem.addToEnemyBook(Number(args[1]));
  67.                 break;
  68.             case 'remove':
  69.                 $gameSystem.removeFromEnemyBook(Number(args[1]));
  70.                 break;
  71.             case 'complete':
  72.                 $gameSystem.completeEnemyBook();
  73.                 break;
  74.             case 'clear':
  75.                 $gameSystem.clearEnemyBook();
  76.                 break;
  77.             }
  78.         }
  79.     };
  80.  
  81.     Game_System.prototype.addToEnemyBook = function(enemyId) {
  82.         if (!this._enemyBookFlags) {
  83.             this.clearEnemyBook();
  84.         }
  85.         this._enemyBookFlags[enemyId] = true;
  86.     };
  87.  
  88.     Game_System.prototype.removeFromEnemyBook = function(enemyId) {
  89.         if (this._enemyBookFlags) {
  90.             this._enemyBookFlags[enemyId] = false;
  91.         }
  92.     };
  93.  
  94.     Game_System.prototype.completeEnemyBook = function() {
  95.         this.clearEnemyBook();
  96.         for (var i = 1; i < $dataEnemies.length; i++) {
  97.             this._enemyBookFlags[i] = true;
  98.         }
  99.     };
  100.  
  101.     Game_System.prototype.clearEnemyBook = function() {
  102.         this._enemyBookFlags = [];
  103.     };
  104.  
  105.     Game_System.prototype.isInEnemyBook = function(enemy) {
  106.         if (this._enemyBookFlags && enemy) {
  107.             return !!this._enemyBookFlags[enemy.id];
  108.         } else {
  109.             return false;
  110.         }
  111.     };
  112.  
  113.     var _Game_Troop_setup = Game_Troop.prototype.setup;
  114.     Game_Troop.prototype.setup = function(troopId) {
  115.         _Game_Troop_setup.call(this, troopId);
  116.         this.members().forEach(function(enemy) {
  117.             if (enemy.isAppeared()) {
  118.                 $gameSystem.addToEnemyBook(enemy.enemyId());
  119.             }
  120.         }, this);
  121.     };
  122.  
  123.     var _Game_Enemy_appear = Game_Enemy.prototype.appear;
  124.     Game_Enemy.prototype.appear = function() {
  125.         _Game_Enemy_appear.call(this);
  126.         $gameSystem.addToEnemyBook(this._enemyId);
  127.     };
  128.  
  129.     var _Game_Enemy_transform = Game_Enemy.prototype.transform;
  130.     Game_Enemy.prototype.transform = function(enemyId) {
  131.         _Game_Enemy_transform.call(this, enemyId);
  132.         $gameSystem.addToEnemyBook(enemyId);
  133.     };
  134.  
  135.     function Scene_EnemyBook() {
  136.         this.initialize.apply(this, arguments);
  137.     }
  138.  
  139.     Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
  140.     Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;
  141.  
  142.     Scene_EnemyBook.prototype.initialize = function() {
  143.         Scene_MenuBase.prototype.initialize.call(this);
  144.     };
  145.  
  146.     Scene_EnemyBook.prototype.create = function() {
  147.         Scene_MenuBase.prototype.create.call(this);
  148.         this._indexWindow = new Window_EnemyBookIndex(0, 0);
  149.         this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  150.         var wy = this._indexWindow.height;
  151.         var ww = Graphics.boxWidth-200;
  152.         var wh = Graphics.boxHeight;
  153.         this._statusWindow = new Window_EnemyBookStatus(200, wy, ww, wh);
  154.         this.addWindow(this._indexWindow);
  155.         this.addWindow(this._statusWindow);
  156.         this._indexWindow.setStatusWindow(this._statusWindow);
  157.     };
  158.  
  159.     function Window_EnemyBookIndex() {
  160.         this.initialize.apply(this, arguments);
  161.     }
  162.  
  163.     Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
  164.     Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;
  165.  
  166.     Window_EnemyBookIndex.lastTopRow = 0;
  167.     Window_EnemyBookIndex.lastIndex  = 0;
  168.  
  169.     Window_EnemyBookIndex.prototype.initialize = function(x, y) {
  170.         var width = Graphics.boxWidth-823;
  171.         var height = this.fittingHeight(16.8);
  172.         Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  173.         this.refresh();
  174.         this.setTopRow(Window_EnemyBookIndex.lastTopRow);
  175.         this.select(Window_EnemyBookIndex.lastIndex);
  176.         this.activate();
  177.     };
  178.  
  179.     Window_EnemyBookIndex.prototype.maxCols = function() {
  180.         return 1;
  181.     };
  182.  
  183.     Window_EnemyBookIndex.prototype.maxItems = function() {
  184.         return this._list ? this._list.length : 0;
  185.     };
  186.  
  187.     Window_EnemyBookIndex.prototype.setStatusWindow = function(statusWindow) {
  188.         this._statusWindow = statusWindow;
  189.         this.updateStatus();
  190.     };
  191.  
  192.     Window_EnemyBookIndex.prototype.update = function() {
  193.         Window_Selectable.prototype.update.call(this);
  194.         this.updateStatus();
  195.     };
  196.  
  197.     Window_EnemyBookIndex.prototype.updateStatus = function() {
  198.         if (this._statusWindow) {
  199.             var enemy = this._list[this.index()];
  200.             this._statusWindow.setEnemy(enemy);
  201.         }
  202.     };
  203.  
  204.     Window_EnemyBookIndex.prototype.refresh = function() {
  205.         this._list = [];
  206.         for (var i = 1; i < $dataEnemies.length; i++) {
  207.             var enemy = $dataEnemies[i];
  208.             if (enemy.name && enemy.meta.book !== 'no') {
  209.                 this._list.push(enemy);
  210.             }
  211.         }
  212.         this.createContents();
  213.         this.drawAllItems();
  214.     };
  215.  
  216.     Window_EnemyBookIndex.prototype.drawItem = function(index) {
  217.         var enemy = this._list[index];
  218.         var rect = this.itemRectForText(index);
  219.         var name;
  220.         if ($gameSystem.isInEnemyBook(enemy)) {
  221.             name = enemy.name;
  222.         } else {
  223.             name = unknownData;
  224.         }
  225.         this.drawText(name, rect.x, rect.y, rect.width);
  226.     };
  227.  
  228.     Window_EnemyBookIndex.prototype.processCancel = function() {
  229.         Window_Selectable.prototype.processCancel.call(this);
  230.         Window_EnemyBookIndex.lastTopRow = this.topRow();
  231.         Window_EnemyBookIndex.lastIndex = this.index();
  232.     };
  233.  
  234.     function Window_EnemyBookStatus() {
  235.         this.initialize.apply(this, arguments);
  236.     }
  237.  
  238.     Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
  239.     Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;
  240.  
  241.     Window_EnemyBookStatus.prototype.initialize = function(x, y, width, height) {
  242.         Window_Base.prototype.initialize.call(this, x, y-641, width, height);
  243.         this._enemy = null;
  244.         this._enemySprite = new Sprite();
  245.         this._enemySprite.anchor.x = 0.3;
  246.         this._enemySprite.anchor.y = 0.5;
  247.         this._enemySprite.x = width / 2 - 20;
  248.         this._enemySprite.y = height / 2;
  249.         this.addChildToBack(this._enemySprite);
  250.         this.refresh();
  251.     };
  252.  
  253.     Window_EnemyBookStatus.prototype.setEnemy = function(enemy) {
  254.         if (this._enemy !== enemy) {
  255.             this._enemy = enemy;
  256.             this.refresh();
  257.         }
  258.     };
  259.  
  260.     Window_EnemyBookStatus.prototype.update = function() {
  261.         Window_Base.prototype.update.call(this);
  262.         if (this._enemySprite.bitmap) {
  263.             var bitmapHeight = this._enemySprite.bitmap.height;
  264.             var contentsHeight = this.contents.height;
  265.             var scale = 1;
  266.             if (bitmapHeight > contentsHeight) {
  267.                 scale = contentsHeight / bitmapHeight;
  268.             }
  269.             this._enemySprite.scale.x = scale;
  270.             this._enemySprite.scale.y = scale;
  271.         }
  272.     };
  273.  
  274.     Window_EnemyBookStatus.prototype.refresh = function() {
  275.         var enemy = this._enemy;
  276.         var x = 0;
  277.         var y = 0;
  278.         var lineHeight = this.lineHeight();
  279.  
  280.         this.contents.clear();
  281.  
  282.         if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
  283.             this._enemySprite.bitmap = null;
  284.             return;
  285.         }
  286.  
  287.         var name = enemy.battlerName;
  288.         var hue = enemy.battlerHue;
  289.         var bitmap;
  290.         if ($gameSystem.isSideView()) {
  291.             bitmap = ImageManager.loadSvEnemy(name, hue);
  292.         } else {
  293.             bitmap = ImageManager.loadEnemy(name, hue);
  294.         }
  295.         this._enemySprite.bitmap = bitmap;
  296.  
  297.         this.resetTextColor();
  298.         this.drawText(enemy.name, x+25, y+50);
  299.  
  300.         x = this.textPadding();
  301.         y = lineHeight + this.textPadding();
  302.  
  303.         for (var i = 0; i < 8; i++) {
  304.             this.changeTextColor(this.systemColor());
  305.             this.drawText(TextManager.param(i), x+10, y+100, 160);
  306.             this.resetTextColor();
  307.             this.drawText(enemy.params[i], x + 110,y+100, 60, 'center');
  308.             y += lineHeight;
  309.         }
  310.  
  311.         var rewardsWidth = 280;
  312.         x = this.contents.width - rewardsWidth;
  313.         y = lineHeight + this.textPadding();
  314.  
  315.         for (var j = 0; j < enemy.dropItems.length; j++) {
  316.             var di = enemy.dropItems[j];
  317.             if (di.kind > 0) {
  318.                 var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
  319.                 this.drawItemName(item, x, y, rewardsWidth);
  320.                 y += lineHeight;
  321.             }
  322.         }
  323.  
  324.         var descWidth = 480;
  325.         x = this.contents.width - descWidth;
  326.         y = this.textPadding() + lineHeight * 7;
  327.         this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth);
  328.         this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth);
  329.     };
  330.  
  331. })();

Lv4.逐梦者

梦石
0
星屑
8498
在线时间
775 小时
注册时间
2017-11-10
帖子
1231
发表于 2018-3-14 20:27:56 | 显示全部楼层
  1. var name = enemy.battlerName;
  2. var hue = enemy.battlerHue;
复制代码

获取的是敌人战斗图的名字和色相,如果要修改的话...
第一种方式是找到横版的战斗图的图像定义。
再修改上述的脚本内容即可。
第二种方式就是把battler战斗图文件夹的敌人素材换成横版的那张即可。

评分

参与人数 1+1 收起 理由
白魔导师宝儿 + 1 认可答案

查看全部评分

一个只会简单事件的Rm新人,脚本完全不懂。只求做个简单的游戏完成自己的游戏之梦而已。
第一个游戏已经完成,等待各素材的完成和测试。
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
21771
在线时间
8545 小时
注册时间
2011-12-31
帖子
3360
发表于 2018-3-15 11:28:39 | 显示全部楼层
本帖最后由 tseyik 于 2018-3-15 11:32 编辑

https://raw.githubusercontent.co ... er/SceneGlossary.js
代替品
用語辞典プラグイン


多功能自由自在
DYAq83pV4AAT5gb.jpg
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
 楼主| 发表于 2018-3-15 13:43:41 | 显示全部楼层
tseyik 发表于 2018-3-15 11:28
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/SceneGlossary.js
代替品
[fold=用語辞 ...

这个图鉴单独唤出的介绍写在哪里?有没有范例啥的?

点评

插件的説明很清楚了  发表于 2018-3-15 16:06
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
 楼主| 发表于 2018-3-16 14:26:46 | 显示全部楼层
tseyik 发表于 2018-3-15 11:28
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/SceneGlossary.js
代替品
[fold=用語辞 ...

就是因为不懂日文才不会用的
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
872
在线时间
39 小时
注册时间
2013-9-13
帖子
4
发表于 2020-9-19 03:39:14 | 显示全部楼层
tseyik 发表于 2018-3-15 11:28
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/SceneGlossary.js
代替品
[fold=用語辞 ...

研究了一天了,按着步骤一步一步来但是呼出的时候总是说我没设置GlossaryInfo
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
727
在线时间
113 小时
注册时间
2022-2-14
帖子
69
发表于 2023-1-27 21:48:23 | 显示全部楼层
眼中目之瞳 发表于 2018-3-16 14:26
就是因为不懂日文才不会用的

这个插件有汉化的吗?
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
727
在线时间
113 小时
注册时间
2022-2-14
帖子
69
发表于 2023-1-28 15:25:21 | 显示全部楼层
tseyik 发表于 2018-3-15 11:28
https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/SceneGlossary.js
代替品
[fold=用語辞 ...

这个有汉化版吗?完全看不懂啊
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
21771
在线时间
8545 小时
注册时间
2011-12-31
帖子
3360
发表于 2023-1-28 15:50:38 | 显示全部楼层
* 如何使用
  * 1. 從數據庫中註冊要視為術語的項目。
  *
  * 2. 設置參數“GlossaryInfo”。
  *
  * 條款可以通過獲取目標項目來瀏覽,並且有
  * 還有一個自動註冊的功能
  * 當同一個詞出現在顯示句子的命令中時。
  *(也可以指定範圍外的特定術語
  * 自動註冊)
  *
  * 您可以從菜單場景和插件命令切換到
  *詞彙場景。
  *
  * 如何註冊數據
  * 1.在項目數據庫中註冊新數據並
  * 將“項目類型”設置為“隱藏項目 A”或“隱藏項目 B”
  *
  * 2. 設置音符參數
  * <SGDescription:xxx> // 詞彙表說明 *1
  * <SGCategory:xxx> // 詞彙表類別
  * <SGManual> // 從自動註冊中排除條款
  * <SGPicture:filename> // 術語圖片的文件名
  * <SGEnemy:1> // 敵人而不是圖片
  * <SGPicturePosition:text> // 圖片位置
  * 頂部、底部、文本
  * <SGTextPosition:100> // 文本位置
  * <SGPicturePriority:top> // 圖片優先級
  * 頂部,底部
  * <SGPictureScale:0.5> //圖片比例
  * <SGPictureAlign: right> // 圖片對齊
  * 左、中、右
  * <SGNoCollect> // 詞彙表 NoCollect
  * <SGTextColorChange:1,10> // 如果開關 [1] 打開。
  *
  * *1 轉義字符
  * \COMMON[1] // 替換為 aaa(<CommonDescription:aaa>)
  * \mhp[3] // 敵人最大 HP(零填充 3)
  * \mmp[3] // 最大 MP
  * \atk[3] // 攻擊力
  * \def[3] // 定義
  * \mag[3] // 馬格
  * \mdf[3] // 中密度纖維板
  * \agi[3] //敏捷
  * \luk[3] // 盧克
  * \exp[3] // 指數
  * \money[3] // 黃金
  * \drop[1] // 放下項目 1
  * \DATA[prop] // 替換為目標數據的屬性“prop”。 (參考以下)
  * \DATA[description] // 目標數據的描述
  * \DATA[price] // 目標數據的價格
  *
  * 一個學期可以使用多個頁面。
  * 頁面通過方向鍵切換。
  * <SGDescription2:xxx>
  * <SGPicture2:文件名>
  * <SGPicturePosition2:文本>
  *
  * 第 3 頁以後也一樣,最多可以指定 99 頁。
  * 顯示多個頁面時,不要在第一頁附加“1”。
  *異常:<SGDescription1:xxx>
  *
  * 在不同類型的詞典中顯示術語時需要以下標籤。
  * <SGType:2> // 詞彙表類型
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
727
在线时间
113 小时
注册时间
2022-2-14
帖子
69
发表于 2023-1-28 18:36:49 | 显示全部楼层
tseyik 发表于 2023-1-28 15:50
* 如何使用
  * 1. 從數據庫中註冊要視為術語的項目。
  *

谢谢了

现在就一个问题,只显示物品,不显示怪物

<SGType:1>
<SGEnemy:1>
这两个标签,不管哪个放在敌人备注里都没效果
但是我看你发的图片确实是显示的怪物啊
是什么标签不对吗?
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 03:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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