Skip to content

Instantly share code, notes, and snippets.

View triacontane's full-sized avatar

トリアコンタン triacontane

View GitHub Profile
@triacontane
triacontane / HiddenEncounterMessage.js
Created October 7, 2017 03:43
エンカウント時のメッセージを表示しない
(function() {
'use strict';
BattleManager.displayStartMessages = function() {};
})();
@triacontane
triacontane / MenuCommandCallCommon.js
Created October 12, 2017 17:13
メニュー画面のコマンドからコモンイベントを呼び出す
(function() {
'use strict';
var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
_Scene_Menu_createCommandWindow.apply(this, arguments);
this._commandWindow.setHandler('equip', this.callCommonEvent.bind(this, 1));
};
Scene_Menu.prototype.callCommonEvent = function(commonEventId) {
@triacontane
triacontane / CallOriginalFunction.js
Created October 26, 2017 15:25
独自関数をGame_Interpreterに追加する方法です。
(function() {
'use strict';
/**
* callOriginalFunction
* オリジナルの関数です。イベントコマンドの「スクリプト」から「this.callOriginalFunction()」で呼べます。
*/
Game_Interpreter.prototype.callOriginalFunction = function() {
// do something
this.wait(60);
@triacontane
triacontane / SampleClass.js
Created October 29, 2017 19:34
クラス(プロトタイプ)を作成するサンプル
function Test() {
this.initialize.apply(this, arguments);
}
Test.prototype.initialize = function() {
this.aaa = 1;
};
var t = new Test();
console.log(t.aaa); // -> 1
@triacontane
triacontane / LearnSkillPlayMe.js
Last active November 4, 2017 07:46
スキル習得時にMEを演奏
(function() {
'use strict';
var _Game_Actor_initSkills = Game_Actor.prototype.initSkills;
Game_Actor.prototype.initSkills = function() {
this._initSkillsComplete = false;
_Game_Actor_initSkills.apply(this, arguments);
this._initSkillsComplete = true;
};
@triacontane
triacontane / UpdateAnimationPattern.js
Last active December 5, 2017 15:46
指定したイベントのアニメーションパターン(0, 1, 2)をスクリプトで更新します。
var eventId = 10;
var character = this.character(eventId);
var pattern = 0;
character._originalPattern = pattern;
character._pattern = pattern;
@triacontane
triacontane / CopyPicture.js
Created January 17, 2018 18:06
ピクチャをコピーするスクリプトです。
var originalId = 1;
var copyId = 2;
var newPicure = JsonEx.makeDeepCopy($gameScreen.picture(originalId));
$gameScreen._pictures[copyId] = newPicure;
@triacontane
triacontane / OverrideSample.js
Created February 22, 2018 19:03
オーバーライドのサンプル
Game_Actor.prototype.die = function() {
// this._equipsはアクターオブジェクトにしか存在しない。
// よってGame_Actorにdieメソッドを定義して親であるGame_Battlerのdieメソッドを呼び出す。
Game_Battler.prototype.die.apply(this, arguments);
if (this._equips) {
this._equips[5].setObject(null);
}
};
@triacontane
triacontane / AddBattleLog.js
Created March 3, 2018 14:14
バトルログに好きなテキストを追加、クリアするスクリプトです。
// バトルログに任意の文章を追加
BattleManager._logWindow.addText('aaa');
// 追加した文字をクリア
BattleManager._logWindow.clear();
@triacontane
triacontane / MemberMpSum.js
Created March 25, 2018 07:23
パーティ全員のMPの合計値を取得します。
$gameParty.members().reduce(function(sum, actor) {return sum + actor.mp;}, 0);