当方丸宝堂 2024/04/29 18:21

【備忘録】Text2Frameの一括コモンイベント入力のやり方/変数の全保存

※この記事は備忘録が主です

大海工房さんのText2Frameを一括で読み込む方法

https://github.com/yktsr/Text2Frame-MV
https://newrpg.seesaa.net/article/475509661.html
Text2Frame.jsとNRP_EvalPluginCommand.jsを入れたうえで以下の通りにイベントを組むと、テキストファイルを一括でコモンイベントに入力できます(※指定ミスと上書きに注意)

回想部屋に入る前に以下のスクリプトを実行することでゲームの状態を保存できます

・アクターの現在情報
$gameVariables.setValue(1, JsonEx.makeDeepCopy($gameActors._data));
・パーティの所持金
$gameVariables.setValue(2, $gameParty.gold());
・パーティのアイテム所持情報
$gameVariables.setValue(3, JsonEx.makeDeepCopy($gameParty._items));
・パーティの武器装備情報
$gameVariables.setValue(4, JsonEx.makeDeepCopy($gameParty._weapons));
・パーティの防具装備情報
$gameVariables.setValue(5, JsonEx.makeDeepCopy($gameParty._armors));
・全変数の記録
$gameVariables.setValue(6, JsonEx.makeDeepCopy($gameVariables._data));
・全スイッチの状態
$gameVariables.setValue(7, JsonEx.makeDeepCopy($gameSwitches._data));
・全セルフスイッチの状態
$gameVariables.setValue(8, JsonEx.makeDeepCopy($gameSelfSwitches._data));
このスクリプトを実行した状態で
・アイテム全消去
$gameParty.initAllItems();
・所持金消去
$gameParty._gold = 0;
・必要な変数、スイッチを消去
・パーティの装備を消去
$gameParty.allMembers().forEach(member => member.clearEquipments());
・パーティの全スキルを消去
$gameParty.allMembers().forEach(actor => actor.initSkills());
以上を行うことでまっさらな状態で回想部屋に入ることができます。

そして回想部屋から出る際以下のスクリプトを実行
$gameActors._data = JsonEx.makeDeepCopy($gameVariables.value(1));
$gameParty._gold = JsonEx.makeDeepCopy($gameVariables.value(2));
$gameParty._items = JsonEx.makeDeepCopy($gameVariables.value(3));
$gameParty._weapons = JsonEx.makeDeepCopy($gameVariables.value(4));
$gameParty._armors = JsonEx.makeDeepCopy($gameVariables.value(5));
$gameSwitches._data = JsonEx.makeDeepCopy($gameVariables.value(7));
$gameSelfSwitches._data = JsonEx.makeDeepCopy($gameVariables.value(8));
$gameVariables._data = JsonEx.makeDeepCopy($gameVariables.value(6));
これにより回想部屋に入る前の状態を復元します。

注意点として、
1.セーブデータが肥大化するため回想部屋ではセーブできないようにし、必ず記録した変数(1~8)に0を代入すること
2.復元する際は必ず変数を最後に戻すこと
の二点だけ気を付けてください。

記事のタグから探す

月別アーカイブ

限定特典から探す

記事を検索