Original Source
- Original title: Turan's Terrific Tweaks
- Original author: ATT_Turan
- Original date: November 5, 2021
- Source thread: https://forums.rpgmakerweb.com/threads/turans-terrific-tweaks.141865/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > JS Plugin Releases (RMMV)
Summary
With the closure of the forums imminent, I've created a repository of all my plugins. It includes a document with all the tweaks below: Download link This thread is a compilation of tweaks and snippets I've written as I work through my game or respond to requests on these forums.
Archived First Post
Download link
This thread is a compilation of tweaks and snippets I've written as I work through my game or respond to requests on
these forums.
A couple of small things are by me to fulfill requests, but most of this is for the Yanfly Engine Plugins, both fixes and modifications.
Due to Yanfly's terms of use, I can't post the full fixes in plugin format, so they will require some user installation. You'll want a text editor, such as Notepad++, that will show you line numbers (the common shortcut to go to a specific line is Ctrl+G).
I use three common instructions here:
- Save a plugin indicates the following code can be copied into an empty text file, saved as a .js file in your plugins folder, and then added in your plugin manager.
- Add a line means you go to the specified line number, place your cursor at the end of that line, then press Enter and paste the code as a new line.
- Change a line to read means you go to the specified line number, highlight it, and replace the entirety of that line with the code I provided.
// Allow two events to move through each other if they both have the <passable> notetag
Game_Event.prototype.isCollidedWithEvents = function(x, y) {
var events = $gameMap.eventsXyNt(x, y);
return $dataMap.events[this._eventId].meta["passable"] && events.length>0 ? !events.some(event => $dataMap.events[event._eventId].meta["passable"]) : events.length>0;
};
It's compatible with both MV and MZ.
for (qParamIndex = 0; qParamIndex < QuasiParams._custom.length; qParamIndex++)
{
if (QuasiParams._custom[qParamIndex].abr == param)
break;
}
if (qParamIndex < QuasiParams._custom.length)
paramValue = parseInt(QuasiParams.equipParamsPlus(item)[qParamIndex + 17]);
This modification corrects all of those behaviors to pay the cost once when the skill is performed and to treat TP costs as expected.
Go to line 1980. Select from 1980 through 1988 and delete it.
Then go up to line 1883. Replace that whole function from 1883 through 1891 with:
Game_Actor.prototype.paySkillCost = function(skill) {
var classMagic = FROG.Magic.getClassMagic(this, skill.stypeId);
if (classMagic)
{
switch (classMagic.resource) {
case "Spell Slots":
FROG.Magic.gainSlotUsed(this, skill, 1);
// Only remove the spell for Prepared casters, not Hybrid ones
if (classMagic.casterType == "Prepared") {
FROG.Magic.gainSpellPrepared(this, skill, -1);
}
break;
case "Magic Points":
this._mp -= this.skillMpCost(skill);
break;
case "Powers":
FROG.Magic.gainPowerUsed(this, skill, 1);
break;
}
FROG.Magic.useSpellComponents(this, skill);
FROG.Magic.gainSpellXp(this, skill);
}
this._tp -= this.skillTpCost(skill);
}
Window_PictureChoiceList.prototype.updateTone = function()
{
this.setTone(0, 0, 0);
};
var elmtnValue = item.damage.elementId<0 ? subject.attackElements() : [item.damage.elementId];
elmtnValue = elmtnValue.reduce(function(r, elementId) {
this.setActionIcon();
VictorEngine.BattleStatusWindow.onSelectAction.call(this);
VictorEngine.getAllElements = function(subject, action)
{
let item = (action instanceof Game_Action) ? action.item() : action;
if (item.damage.elementId < 0)
return subject.attackElements();
else
return [item.damage.elementId];
};
Game_Event.prototype.meetsConditions = function(page) {
var c = page.conditions;
if (c.switch1Valid) {
if (!$gameSwitches.value(c.switch1Id)) {
return false;
}
}
if (c.switch2Valid) {
if (!$gameSwitches.value(c.switch2Id)) {
return false;
}
}
if (c.variableValid) {
if ($gameVariables.value(c.variableId) < c.variableValue) {
return false;
}
}
if (c.selfSwitchValid) {
var key = [this._mapId, this._eventId, c.selfSwitchCh];
if ($gameSelfSwitches.value(key) !== true) {
return false;
}
}
if (c.itemValid) {
var item = $dataItems[c.itemId];
if (!$gameParty.hasItem(item)) {
return false;
}
}
if (c.actorValid) {
var actor = $gameActors.actor(c.actorId);
if (!$gameParty.members().contains(actor)) {
return false;
}
}
var condition = VictorEngine.EventConditions.getCustomCondition(page);
if (condition)
return eval(condition[1]);
return true;
};
// Make Yanfly barrier block indirect damage
Game_Battler.prototype.gainHp = function(value) {
var blocked=false;
if (value<0 && !BattleManager._subject && this.barrierPoints()>0)
{
var damage=-value;
damage = this.loseBarrier(damage, 1, 0);
if (!damage)
blocked=true;
else
value=-damage;
}
if (!blocked)
{
this._result.hpDamage = -value;
this._result.hpAffected = true;
this.setHp(this.hp + value);
}
};
this.x += Math.round($gameScreen.shake());
To fix this, save a plugin with the following code beneath the Sideview Enemies:
Sprite_Enemy.prototype.revertToNormal = function() {
this._shake = 0;
this.blendMode = 0;
this.opacity = 255;
this.setBlendColor([0, 0, 0, 0]);
if (this._svBattlerEnabled)
{
this._mainSprite.setBlendColor([0, 0, 0, 0]);
this._mainSprite.blendMode=0;
}
};
Save a plugin with the following code and place beneath Animated Enemies in your plugin manager:
Sprite_Enemy.prototype.updateScale = function()
{
if (!this._svBattlerEnabled)
{
var mirror = this.scale.x > 0 ? 1 : -1;
this.scale.x = this._enemy.spriteScaleX();
this.scale.x = Math.abs(this.scale.x) * mirror;
}
else
this.scale.x = this._enemy.spriteScaleX();
this.scale.y = this._enemy.spriteScaleY();
if (this._stateIconSprite)
{
var safe = 1 / 100000;
var sprite = this._stateIconSprite;
sprite.scale.x = 1 / Math.max(safe, Math.abs(this.scale.x));
sprite.scale.y = 1 / Math.max(safe, Math.abs(this.scale.y));
}
};
Game_BattlerBase.prototype.setCopy = function(value) {
this.isCopy=value;
};
Window_EquipItem.prototype.updateHelp = function() {
Window_ItemList.prototype.updateHelp.call(this);
if (this._actor && this._statusWindow) {
var actor = JsonEx.makeDeepCopy(this._actor);
actor.setCopy(true);
actor.forceChangeEquip(this._slotId, this.item());
this._statusWindow.setTempActor(actor);
}
};
this._oldPassives=this._passiveStatesRaw;
if (!this.isCopy && this._oldPassives && !this._oldPassives.contains(raw[i]))
this.addStateEffects(raw[i]);
if (!this.isCopy && this._oldPassives)
{
for (i=0; i<this._oldPassives.length; i++)
{
if (!raw.contains(this._oldPassives[i]) && !this._checkPassiveStateCondition.contains(this._oldPassives[i]))
this.removeStateEffects(this._oldPassives[i]);
}
}
this._oldPassives=undefined;
this._oldPassives=this._passiveStatesRaw;
this._oldPassives=this._passiveStatesRaw;
// Fix for switch conditions
Game_Map.prototype.refresh = function() {
this.events().forEach(function(event) {
event.refresh();
});
this._commonEvents.forEach(function(event) {
event.refresh();
});
this.refreshTileEvents();
$gamePlayer.refresh();
this._needsRefresh = false;
};
target variable. To add this functionality, select lines 1347 - 1353 and delete them. Replace them with: var group = this.getActionGroup();
if (condition.includes("target"))
{
let target;
for (let i = 0; i < group.length; i++)
{
if (!group[i])
continue;
target = group[i];
try
{
if (!eval(condition))
{
group.splice(i, 1);
i--;
}
}
catch (e)
{
Yanfly.Util.displayError(e, condition, 'A.I. EVAL ERROR');
return false;
}
}
if (group.length > 1)
{
this.setProperTarget(group);
return true;
}
else
return false;
}
try
{
if (!eval(condition))
return false;
}
catch (e)
{
Yanfly.Util.displayError(e, condition, 'A.I. EVAL ERROR');
return false;
}
Window_BattleLog.prototype.displayHpDamage = function(target) {
if (target.result().hpAffected) {
this.push('addText', this.makeHpDamageText(target));
}
};
Game_BattlerBase.prototype.clearStates = function()
{
if (this._states)
{
for (let i=0; i<this._states.length; i++)
{
if (Imported.YEP_X_StateCategories && this.isCustomClearStates() && (($gameTemp._deathStateClear && $dataStates[this._states[i]].category.contains('BYPASS DEATH REMOVAL')) || ($gameTemp._recoverAllClear && $dataStates[this._states[i]].category.contains('BYPASS RECOVER ALL REMOVAL'))))
continue;
this.removeStateEffects(this._states[i]);
}
}
this._states = [];
this._stateTurns = {};
};
Game_Actor.prototype.expForLevel = function(level, classId) {
var c = classId ? $dataClasses[classId] : this.currentClass();
var basis = c.expParams[0];
var extra = c.expParams[1];
var acc_a = c.expParams[2];
var acc_b = c.expParams[3];
return Math.round(basis*(Math.pow(level-1, 0.9+acc_a/250))*level*
(level+1)/(6+Math.pow(level,2)/50/acc_b)+(level-1)*extra);
};
if (this.expForLevel(level + 1, classId) > this._exp[classId]) break;
Line 1227:
} else if (line.match(/ATTACKER[ ]([^\s]*)[ ](.*)/i)) {Line 1229
var value2 = String(RegExp.$2);Line 1232
} else if (line.match(/DEFENDER[ ]([^\s]*)[ ](.*)/i)) {Line 1234
var value2 = String(RegExp.$2);Thanks to @caethyril for this fix.
if (!this.meetCounterConditionsEval(skill, subject, target)) return false;
if (skill.counterConditionEval=='') return true;
var code = skill.counterConditionEval;
return this._subject.attackElements().contains(elementId) || this._action.getItemElements().contains(elementId);
elements.sort(function(a, b) {return target.elementRate(b)-target.elementRate(a)});
var tpMode = skill.learnUnlockedTpModes[i];
Yanfly.Param.GabAntiRepeat = Yanfly.Parameters['Anti-Repeat'] == "true";
// if (!item.note) return false;
var TUR_endBattle = BattleManager.endBattle;
BattleManager.endBattle = function(result)
{
this._instantCasting=false;
TUR_endBattle.call(this, result);
};
value = eval(code);
/*:
* @target MV
* @plugindesc Patches YEP Message Backlog - prevent error on selecting null item.
* @author Caethyril
* @url https://forums.rpgmakerweb.com/threads/159752/
* @help Load this plugin after YEP_X_MessageBacklog.
*
* Free to use and/or modify for any project, no credit required.
*/
;void (function(alias) {
Window_EventItem.prototype.backlogAddSelectedChoice = function() {
if (this.item()) // only if item is truthy
alias.apply(this, arguments);
};
})(Window_EventItem.prototype.backlogAddSelectedChoice);
case 'ALIVE': return 'aliveAll';
if (type=='' || questData.type === type) result.push(questId);
var evalResult;
evalResult = eval(code);
return evalResult;
user in a Custom Select Condition always refer to the first actor to choose their action that turn. To make these notetags function correctly, save a plugin with the following code:var origSetActionState = Game_Battler.prototype.setActionState;
Game_Battler.prototype.setActionState = function(actionState) {
origSetActionState.call(this, actionState);
if (actionState == "inputting")
$gameTemp.clearSelectionControlCache();
};
It will be more intuitive to make sure the actors are always scrolled through in party order (and this works particularly well with "Use Up/Down," below).
Place your cursor at the beginning of line 1555 and type /* to begin a comment. Place your cursor at the end of line 1560 and type */ to end the comment. This makes the code non-functional without deleting it.
Then add a new line and paste in:
this._enemies.sort(function(a, b) {
if (a.isActor() && b.isActor())
return a.index() - b.index();
else if (a.isActor() != b.isActor())
return a.isActor() ? 1 : -1;
else if (a.spritePosX() === b.spritePosX()) {
return a.spritePosY() - b.spritePosY();
}
else
return a.spritePosX() - b.spritePosX();
});
Change lines 766, 777, and 787 to read:
if (DataManager.isItem(item)) {
However, when using a skill that has been modified with selection control (you can only target party members afflicted with blind for your cure-blind spell), up and down no longer work, and you're forced to use left and right. The below plugin will restore the ability to use up and down again.
// Make up and down work with Yanfly Selection Control
Window_Selectable.prototype.processCursorMove = function() {
if (this.isCursorMovable()) {
var lastIndex = this.index();
if (Input.isRepeated('down')) {
if (SceneManager._scene._enemyWindow && SceneManager._scene._enemyWindow.active)
this.cursorRight(Input.isTriggered('right'));
else
this.cursorDown(Input.isTriggered('down'));
}
if (Input.isRepeated('up')) {
if (SceneManager._scene._enemyWindow && SceneManager._scene._enemyWindow.active)
this.cursorLeft(Input.isTriggered('left'));
else
this.cursorUp(Input.isTriggered('up'));
}
if (Input.isRepeated('right')) {
this.cursorRight(Input.isTriggered('right'));
}
if (Input.isRepeated('left')) {
this.cursorLeft(Input.isTriggered('left'));
}
if (!this.isHandled('pagedown') && Input.isTriggered('pagedown')) {
this.cursorPagedown();
}
if (!this.isHandled('pageup') && Input.isTriggered('pageup')) {
this.cursorPageup();
}
if (this.index() !== lastIndex) {
SoundManager.playCursor();
}
}
};
visible=eval(code);
To fix this, go to line 1703, add a line, and paste in:
if (Imported.YEP_ClassChangeCore)
this._commandWindow._index=0;
Now, using a Learn Show Eval will make a skill show up in the actor's list, but it will be greyed out and disabled until they actually meet the requirements.
value += ap;
if (this.isSTB() && subject.isActor() && subject.canInput()) {
Game_Action.prototype.isForAll = function() {
return this.checkItemScope([2, 8, 10, "EVERYBODY"]);
};
On lines 421, 426, and 430, change it to read:
return this._cacheWeaponAni;Then, on line 446, change it to read
if (this.weapons().length>1 && this.getUniqueWeaponAni()) return this.getUniqueWeaponAni();
Standalone plugins:
Custom Hit Formula for MZ
Chanting Animations for MZ/MV
Activate Equipment
Release Enemies
Action Sequence Rotation Extension
Action Sequence Targets Extension
Subclass Mods Extension
Party Approval
Profanity Filter for MZ/MV
Eval Tags MZ
Christmas Calendar Plugins
Dynamic Battlebacks for MV/MZ
Attack Sounds for MV/MZ
Loading Map for MV/MZ
Equipment Levels
Encounter Control for MV/MZ
Step Variance for MV/MZ
Battle Macros for MV/MZ
Combo Actions for MV/MZ
Level Cap for MV/MZ
Press Turn Battle
Rotate Move (MV/MZ)
Item Suite MZ
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Due to Yanfly's terms of use, I can't post the full fixes in plugin format, so they will require some user installation. You'll want a text editor, such as Notepad++, that will show you line numbers (the common shortcut to go to a specific line is Ctrl+G). I use three common instructions here: Save a plugin indicates the following code can be copied into an empty text file, saved as a .js file in your plugins folder, and then added...
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...