Skip to content

Instantly share code, notes, and snippets.

@elleonard
Created November 5, 2021 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elleonard/2253020b8abbcb6b4a15309fb8c22207 to your computer and use it in GitHub Desktop.
Save elleonard/2253020b8abbcb6b4a15309fb8c22207 to your computer and use it in GitHub Desktop.
特定のカテゴリを選択済みの状態でアイテムシーンを開くプラグインコマンド
(function () {
'use strict';
let selectedCategory = '';
const _Scene_Item_start = Scene_Item.prototype.start;
Scene_Item.prototype.start = function () {
_Scene_Item_start.call(this);
if (selectedCategory) {
this._categoryWindow.selectSymbol(selectedCategory);
this._categoryWindow.deactivate();
this._itemWindow.activate();
this._itemWindow.selectLast();
selectedCategory = '';
}
};
const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
/**
* プラグインコマンド: sceneItemWithCategory 開きたいカテゴリ
* 開きたいカテゴリに指定できるもの:
* item
* weapon
* armor
* keyItem
*/
if (command === 'sceneItemWithCategory') {
selectedCategory = args[0];
SceneManager.push(Scene_Item);
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment