デバッグモードを開く
RPGツクールMVでゲームをテスト実行中に、F8キーを押すと開発ツールが起動するらしい。
F8キーを押してみる
しかし、何も起こらなかった…。
「ゲーム > テストプレイ」を実行して、F8キーを押してみる。
chromeのコンソール画面出た。さすがjavascriptのゲーム。
以下のように、わざわざローカルファイルを開かなくてもコンソール見れるのは便利 harusdia.hatenablog.com
F5で更新も行えるらしい。RPGツクールMZ上での編集はしてなくて、javascriptや画像の更新だけならF5で十分そうだ。
chatGPTでRPGツクールMZの保存されているデータの一覧を確認
Consoleタブに移動して、「$data」を入力すると、サジェストで様々な変数が出てくるらしい。

試しに一つ、「$dataActors」を見てみる。
パーティメンバーの名前やIDなど、様々なデータが保存されているようだ。
javascriptで$dataから始まる現在保存されている変数の一覧を出して。
JavaScriptでは、グローバルな変数であれば、windowオブジェクトを使って、それに登録されているすべての変数を一覧にすることができます。
const dataVariables = Object.keys(window).filter(key => key.startsWith('$data'));
console.log(dataVariables);
$dataActors:
内容: ゲーム内のすべてのアクター(プレイヤーキャラクター)の情報が保存されています。各アクターのステータス、スキル、装備可能なアイテムなどの情報が含まれています。
$dataClasses:
内容: ゲーム内のすべての職業(クラス)の情報が保存されています。各クラスのパラメータ曲線、装備可能な武器・防具、スキルの習得レベルなどが含まれています。
$dataSkills:
内容: ゲーム内で使用されるすべてのスキルの情報が保存されています。スキルの名前、説明、効果、使用可能な範囲などが含まれています。
$dataItems:
内容: ゲーム内のすべてのアイテムの情報が保存されています。回復アイテムやクエストアイテムなどの効果、価格、使用可能範囲などが含まれています。
$dataWeapons:
内容: ゲーム内のすべての武器の情報が保存されています。各武器の攻撃力、装備可能な職業、特殊効果などが含まれています。
$dataArmors:
内容: ゲーム内のすべての防具の情報が保存されています。各防具の防御力、装備可能な職業、特殊効果などが含まれています。
$dataEnemies:
内容: ゲーム内のすべての敵キャラクターの情報が保存されています。敵のステータス、使用スキル、ドロップアイテムなどが含まれています。
$dataTroops:
内容: ゲーム内のすべての戦闘隊列(エンカウント時の敵グループ)の情報が保存されています。各戦闘で登場する敵キャラクターの組み合わせや戦闘中のイベントが含まれています。
$dataStates:
内容: ゲーム内のすべてのステート(状態異常やバフ、デバフ)の情報が保存されています。各ステートの効果、持続時間、解除条件などが含まれています。
$dataAnimations:
内容: ゲーム内で使用されるすべてのアニメーションの情報が保存されています。各アニメーションのフレーム、表示位置、音声効果などが含まれています。
$dataTilesets:
内容: ゲーム内のすべてのタイルセット(マップを作成するためのグラフィック)の情報が保存されています。タイルセットに含まれるタイルの通行設定や表示優先度などが含まれています。
$dataCommonEvents:
内容: ゲーム内のすべてのコモンイベントの情報が保存されています。コモンイベントは、どのマップでも呼び出せるイベントで、ゲーム全体で共通して使う処理を記述します。
$dataSystem:
内容: ゲーム全体のシステム設定が保存されています。ゲームタイトル、開始位置、初期アクター、BGM設定、用語設定などが含まれています。
$dataMapInfos:
内容: ゲーム内のすべてのマップの基本情報が保存されています。マップ名やマップID、表示順序、親マップとの関連性などが含まれています。
$dataMap:
内容: 現在のマップの詳細情報が保存されています。タイル配置、イベント情報、通行設定などが含まれています。
chatGPTでRPGツクールMZのプラグインを作る

RPGツクールMZでメニューの右下の金額欄の上に新しい枠を作りたい
以下は、メニューの右下に新しい枠を追加するための基本的な手順です。
//=============================================================================
// CustomMenuWindow.js 2024/08/27
// The MIT License (MIT)
//=============================================================================
/*:
* @plugindesc テスト用プラグイン
* @author haru
*
* @help このプラグインにはプラグインコマンドはありません。
* テスト用に作成したものなので、実際に利用する場合には適当にリネームしてください
*/
(() => {
// Custom window class to display additional information
class Window_CustomInfo extends Window_Base {
constructor(rect) {
super(rect);
this.refresh();
}
refresh() {
this.contents.clear();
// Customize the information you want to display here
const value = $gameParty.gold(); // Example: Displaying the current gold
this.drawText("Gold: " + value, 0, 0, this.contentsWidth(), "center");
}
}
// Extending the Scene_Menu to add the custom window
const _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this.createCustomInfoWindow();
};
Scene_Menu.prototype.createCustomInfoWindow = function() {
const rect = this.customInfoWindowRect();
this._customInfoWindow = new Window_CustomInfo(rect);
this.addWindow(this._customInfoWindow);
};
Scene_Menu.prototype.customInfoWindowRect = function() {
const ww = 240; // Width of the window
const wh = this.calcWindowHeight(1, true); // Height of the window
const wx = Graphics.boxWidth - ww - 20; // Position X (aligned with right side)
const wy = Graphics.boxHeight - this._goldWindow.height - wh - 20; // Position Y (above the gold window)
return new Rectangle(wx, wy, ww, wh);
};
})();
chatGPTあればスクリプト作り放題では??
ゲーム内日付のプラグインを作る
ゲーム内日付を導入したい。ベッドで寝ると翌日に進むシステム
ゲーム内の年は、1年目、2年目、3年目…のような感じで、
ゲーム内の月は、春の月、夏の月、秋の月、冬の月
ゲーム内の日は、1~30日
プラグインファイル作って
下は、指定されたゲーム内日付のシステムを実装するためのプラグインコードです。このコードをコピーして、GameDateSystem.js というファイル名で保存してください。
//=============================================================================
// GameDateSystem.js 2024/08/27
// The MIT License (MIT)
//=============================================================================
/*:
* @plugindesc ゲーム内日付システムを実装するプラグインです。ベッドで寝ると翌日に進みます。
* @author haru
*
* @help このプラグインにはプラグインコマンドはありません。
* ゲーム内で日付を管理し、年、月、日が進むシステムを実装します。
*/
(() => {
// ゲーム開始時の日付を初期化する
const gameYear = 1; // 1年目
const gameMonth = 1; // 春の月
const gameDay = 1; // 1日
// Scene_Boot の start メソッドで日付の初期化を行う
const _Scene_Boot_start = Scene_Boot.prototype.start;
Scene_Boot.prototype.start = function() {
_Scene_Boot_start.call(this);
this.initializeGameDate();
};
Scene_Boot.prototype.initializeGameDate = function() {
console.log('新しいゲームを開始した時に、日付のデフォルト値を設定する');
if ($gameVariables.value(1) === 0) {
$gameVariables.setValue(1, gameYear); // 年を初期化
$gameVariables.setValue(2, gameMonth); // 月を初期化
$gameVariables.setValue(3, gameDay); // 日を初期化
}
};
// ゲーム内の日付を1日進める
Game_System.prototype.advanceDate = function() {
let year = $gameVariables.value(1);
let month = $gameVariables.value(2);
let day = $gameVariables.value(3);
// 日を進める
day += 1;
// 月末(1ヶ月は30日)をチェック
if (day > 30) {
day = 1;
month += 1;
}
// 年末(4ヶ月:春、夏、秋、冬)をチェック
if (month > 4) {
month = 1;
year += 1;
}
// 新しい日付を変数に更新
$gameVariables.setValue(1, year);
$gameVariables.setValue(2, month);
$gameVariables.setValue(3, day);
};
// 現在の月名を取得する
Game_System.prototype.getMonthName = function() {
const month = $gameVariables.value(2);
switch (month) {
case 1:
return "春の月";
case 2:
return "夏の月";
case 3:
return "秋の月";
case 4:
return "冬の月";
default:
return "不明"; // 月が範囲外の場合、不明と表示
}
};
// 日付の情報を表示するためのカスタムウィンドウクラス
class Window_GameDateInfo extends Window_Base {
constructor(rect) {
super(rect);
this.refresh();
}
refresh() {
const year = $gameVariables.value(1) + "年目";
const monthValue = $gameVariables.value(2);
const month = $gameSystem.getMonthName(); // $gameSystemを使用してgetMonthNameを呼び出す
const day = $gameVariables.value(3) + "日";
this.contents.clear();
// ここで表示したい情報をカスタマイズする
this.drawText(`${year} ${month} ${day}`, 0, 0, this.contentsWidth(), "center");
}
}
// Scene_Menuを拡張してカスタムウィンドウを追加する
const _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this.createGameDateInfoWindow();
};
Scene_Menu.prototype.createGameDateInfoWindow = function() {
const rect = this.GameDateInfoWindowRect();
this._GameDateInfoWindow = new Window_GameDateInfo(rect);
this.addWindow(this._GameDateInfoWindow);
};
Scene_Menu.prototype.GameDateInfoWindowRect = function() {
const ww = 240; // ウィンドウの幅
const wh = this.calcWindowHeight(1, true); // ウィンドウの高さ
const wx = Graphics.boxWidth - ww; // X座標(右側に揃える)
const wy = Graphics.boxHeight - this._goldWindow.height - wh; // Y座標(ゴールドウィンドウの上に配置)
return new Rectangle(wx, wy, ww, wh);
};
})();

ベッドにイベントをつけて、以下のスクリプトを呼び出せば日付を進めることが出来る
$gameSystem.advanceDate()
chatGPT優秀過ぎるな…。牧場物語風のプラグインを作っていくことも夢じゃないかもしれない。