Force Within Screen
All windows listed will be forced to remain within the screen. Use the names from Parameters. Separate with commas.
This plugin allows developers to customize the window set up of battles within their game.
Battle GUI Core
Version 1.00
SumRndmDde
This plugin allows developers to customize the window set up of battles
within their game.
==============================================================================
Window Properties
==============================================================================
There are seven properties that can be customized for the windows:
- X
- Y
- Rows
- Cols
- Width
- Align
- Visible
===========================
X
===========================
The X property determines the X position of the window.
If the window is not at that position, then it will either instantly move
to the position or slide to it based on how far it is.
===========================
Y
===========================
The Y property determines the Y position of the window.
If the window is not at that position, then it will either instantly move
to the position or slide to it based on how far it is.
===========================
Rows
===========================
The Rows property determines the amount of rows on the window.
The number of rows will determine the number shown at once.
If there are more choices than there can be shown, then the number of
rows total will be greater than normal.
===========================
Cols
===========================
The Cols property determines the amount of columns on the window.
The column count will always be constant unless there are less choices
than there are columns.
===========================
Width
===========================
The Width property determines the width of the window.
===========================
Align
===========================
The Align property determines the alignment of the text of the choices.
===========================
Visible
===========================
The Visible property determines the whether the window is visible.
Visibility can be updated dynamically since this property is mainly used with
JavaScript conditions.
However, you can input 'true' to make it use the default visibility settings.
==============================================================================
Motions
==============================================================================
Motions allow you to make windows move in a certain way under certain
conditions. You can create conditions based on other windows and
BattleManager phases.
In order to check whether a phase is active or not, do:
BattleManager._phase === 'phase-name'
Here is a list of all the phases:
- init
- start
- input
- turn
- action
- turnEnd
- aborting
- battleEnd
You can also check various properties of the other windows:
- BattleManager._statusWindow
- BattleManager._actorCommandWindow
- BattleManager._partyCommandWindow
- BattleManager._skillWindow
- BattleManager._itemWindow
- BattleManager._enemyWindow
- BattleManager._actorWindow
- BattleManager._helpWindow
For example:
BattleManager._statusWindow.x
BattleManager._statusWindow.y
BattleManager._statusWindow.width
BattleManager._statusWindow.height
BattleManager._statusWindow.isClosed()
BattleManager._statusWindow.isOpen()
BattleManager._statusWindow.visible
==============================================================================
End of Help File
==============================================================================
Welcome to the bottom of the Help file.
Thanks for reading!
If you have questions, or if you enjoyed this Plugin, please check
out my YouTube channel!
https://www.youtube.com/c/SumRndmDde
Until next time,
~ SumRndmDde
var SRD = SRD || {};
SRD.BattleGUICore = SRD.BattleGUICore || {};
var Imported = Imported || {};
Imported["SumRndmDde Battle GUI Core"] = 1.00;
(function(_) {
"use strict";
//-----------------------------------------------------------------------------
// SRD.BattleStatusCustomizer
//-----------------------------------------------------------------------------
const params = PluginManager.parameters('SRD_BattleGUICore');
_.forceScreens = String(params['Force Within Screen']).split(/\s*,\s*/);
for(let i = 0; i < _.forceScreens.length; i++) _.forceScreens[i] = _.forceScreens[i].toLowerCase();
_.motionSpeed = String(params['Motion Reset Speed']);
_.moveDistance = parseInt(params['Instant Move Distance']);
_.battleStatusMove = String(params['Auto-Move Battle Status']).trim().toLowerCase() === 'true';
_.battleStatusX = String(params['Battle Status X']);
_.battleStatusY = String(params['Battle Status Y']);
_.battleStatusWidth = String(params['Battle Status Width']);
_.battleStatusVisible = String(params['Battle Status Visible']);
_.partyCommandX = String(params['Party Command X']);
_.partyCommandY = String(params['Party Command Y']);
_.partyCommandRows = String(params['Party Command Rows']);
_.partyCommandCols = String(params['Party Command Cols']);
_.partyCommandWidth = String(params['Party Command Width']);
_.partyCommandAlign = String(params['Party Command Align']);
_.partyCommandVisible = String(params['Party Command Visible']);
_.actorCommandX = String(params['Actor Command X']);
_.actorCommandY = String(params['Actor Command Y']);
_.actorCommandRows = String(params['Actor Command Rows']);
_.actorCommandCols = String(params['Actor Command Cols']);
_.actorCommandWidth = String(params['Actor Command Width']);
_.actorCommandAlign = String(params['Actor Command Align']);
_.actorCommandVisible = String(params['Actor Command Visible']);
_.skillListX = String(params['Skill List X']);
_.skillListY = String(params['Skill List Y']);
_.skillListRows = String(params['Skill List Rows']);
_.skillListCols = String(params['Skill List Cols']);
_.skillListWidth = String(params['Skill List Width']);
_.skillListAlign = String(params['Skill List Align']);
_.skillListVisible = String(params['Skill List Visible']);
_.itemListX = String(params['Item List X']);
_.itemListY = String(params['Item List Y']);
_.itemListRows = String(params['Item List Rows']);
_.itemListCols = String(params['Item List Cols']);
_.itemListWidth = String(params['Item List Width']);
_.itemListAlign = String(params['Item List Align']);
_.itemListVisible = String(params['Item List Visible']);
_.enemyListX = String(params['Enemy List X']);
_.enemyListY = String(params['Enemy List Y']);
_.enemyListRows = String(params['Enemy List Rows']);
_.enemyListCols = String(params['Enemy List Cols']);
_.enemyListWidth = String(params['Enemy List Width']);
_.enemyListAlign = String(params['Enemy List Align']);
_.enemyListVisible = String(params['Enemy List Visible']);
_.motions = {};
for(let i = 1; i <= 1; i++) {
const t = String(params['Motion ' + i + ' Window']).toLowerCase();
const c = String(params['Motion ' + i + ' Condition']);
const s = String(params['Motion ' + i + ' Speed']);
const x = String(params['Motion ' + i + ' X Offset']);
const y = String(params['Motion ' + i + ' Y Offset']);
if(t.trim().length > 0 && c.trim().length > 0 && s.trim().length > 0 && x.trim().length > 0 && y.trim().length > 0) {
if(!_.motions[t]) _.motions[t] = [];
const temp = {};
temp.condition = c;
temp.speed = s;
temp.x = x;
temp.y = y;
_.motions[t].push(temp);
}
}
//-----------------------------------------------------------------------------
// BattleManager
//-----------------------------------------------------------------------------
const _BattleManager_initMembers = BattleManager.initMembers;
BattleManager.initMembers = function() {
_BattleManager_initMembers.apply(this, arguments);
this._statusWindows = [];
this._actorCommandWindow = null;
this._partyCommandWindow = null;
this._helpWindow = null;
};
BattleManager.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
};
BattleManager.setActorCommandWindow = function(actorCommandWindow) {
this._actorCommandWindow = actorCommandWindow;
};
BattleManager.setActorListWindow = function(actorWindow) {
this._actorWindow = actorWindow;
};
BattleManager.setSkillListWindow = function(skillList) {
this._skillWindow = skillList;
};
BattleManager.setPartyCommandWindow = function(partyCommandWindow) {
this._partyCommandWindow = partyCommandWindow;
};
BattleManager.setEnemyListWindow = function(enemyList) {
this._enemyList = enemyList;
};
BattleManager.setItemListWindow = function(itemList) {
this._itemWindow = itemList;
};
BattleManager.setHelpWindow = function(helpWindow) {
this._helpWindow = helpWindow;
};
BattleManager.getCurrentActorSprite = function() {
return (this._actorIndex > -1) ? this._spriteset._actorSprites[this._actorIndex] : new Sprite();
};
//-----------------------------------------------------------------------------
// Scene_Battle
//-----------------------------------------------------------------------------
const _Scene_Battle_createDisplayObjects = Scene_Battle.prototype.createDisplayObjects;
Scene_Battle.prototype.createDisplayObjects = function() {
_Scene_Battle_createDisplayObjects.apply(this, arguments);
BattleManager.setStatusWindow(this._statusWindow);
BattleManager.setActorCommandWindow(this._actorCommandWindow);
BattleManager.setPartyCommandWindow(this._partyCommandWindow);
BattleManager.setSkillListWindow(this._skillWindow);
BattleManager.setItemListWindow(this._itemWindow);
BattleManager.setEnemyListWindow(this._enemyWindow);
BattleManager.setActorListWindow(this._actorWindow);
BattleManager.setHelpWindow(this._helpWindow);
BattleManager._bsc_windowsSet = true;
};
const _Scene_Battle_commandFight = Scene_Battle.prototype.commandFight;
Scene_Battle.prototype.commandFight = function() {
_Scene_Battle_commandFight.apply(this, arguments);
this._actorCommandWindow.instantPlacement();
};
//-----------------------------------------------------------------------------
// Consistent Window Functions
//-----------------------------------------------------------------------------
_.updateMovement = function() {
if(Math.abs(this._trueX - this._goalX) > _.moveDistance || Math.abs(this._trueY - this._goalY) > _.moveDistance) {
this.instantPlacement();
}
if(this._trueX < this._goalX) {
this._trueX += 4;
if(this._trueX > this._goalX) this._trueX = this._goalX;
} else if(this._trueX > this._goalX) {
this._trueX -= 4;
if(this._trueX < this._goalX) this._trueX = this._goalX;
}
if(this._trueY < this._goalY) {
this._trueY += 4;
if(this._trueY > this._goalY) this._trueY = this._goalY;
} else if(this._trueY > this._goalY) {
this._trueY -= 4;
if(this._trueY < this._goalY) this._trueY = this._goalY;
}
this.updateOffsetConditions();
this.updateOffset();
this.updateScreenRestrict();
this.x = this._trueX + this._offsetX;
this.y = this._trueY + this._offsetY;
};
_.updateScreenRestrict = function() {
if(this._stayWithinScreen) {
while(this._trueX + this._offsetX + this.width > Graphics.boxWidth) {
this._trueX--;
}
while(this._trueX + this._offsetX < 0) {
this._trueX++;
}
while(this._trueY + this._offsetY + this.height > Graphics.boxHeight) {
this._trueY--;
}
while(this._trueY + this._offsetY < 0) {
this._trueY++;
}
}
};
_.updateOffset = function() {
if(this._offsetX < this._offsetXGoal) {
this._offsetX += this._offsetSpeed;
if(this._offsetX > this._offsetXGoal) this._offsetX = this._offsetXGoal;
} else if(this._offsetX > this._offsetXGoal) {
this._offsetX -= this._offsetSpeed;
if(this._offsetX < this._offsetXGoal) this._offsetX = this._offsetXGoal;
}
if(this._offsetY < this._offsetYGoal) {
this._offsetY += this._offsetSpeed;
if(this._offsetY > this._offsetYGoal) this._offsetY = this._offsetYGoal;
} else if(this._offsetY > this._offsetYGoal) {
this._offsetY -= this._offsetSpeed;
if(this._offsetY < this._offsetYGoal) this._offsetY = this._offsetYGoal;
}
};
_.updateOffsetConditions = function() {
let isOn = false;
if(this._motionsInfos) {
for(let i = 0; i < this._motionsInfos.length; i++) {
const info = this._motionsInfos[i];
if(info && eval(info.condition)) {
this._offsetXGoal = eval(info.x);
this._offsetYGoal = eval(info.y);
this._offsetSpeed = eval(info.speed);
this._offsetOpenness = eval(info.open);
isOn = true;
break;
}
}
if(!isOn) {
this._offsetXGoal = 0;
this._offsetYGoal = 0;
this._offsetSpeed = eval(_.motionSpeed);
}
}
};
_.instantPlacement = function() {
this._trueX = this._goalX;
this._trueY = this._goalY;
};
_.initializePositions = function() {
this._offsetX = 0;
this._offsetY = 0;
this._offsetXGoal = 0;
this._offsetYGoal = 0;
this._offsetSpeed = 0;
this._trueX = this.x;
this._trueY = this.y;
};
//-----------------------------------------------------------------------------
// Window_PartyCommand
//-----------------------------------------------------------------------------
if(!Imported["SumRndmDde Battle Status Customizer"]) {
if(!_.battleStatusMove) {
Scene_Battle.prototype.updateWindowPositions = function() {};
}
const _Window_BattleStatus_initialize = Window_BattleStatus.prototype.initialize;
Window_BattleStatus.prototype.initialize = function() {
_Window_BattleStatus_initialize.apply(this, arguments);
this.initializePositions();
if(_.motions['battle status']) this._motionsInfos = _.motions['battle status'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('battle status'));
};
const _Window_BattleStatus_update = Window_BattleStatus.prototype.update;
Window_BattleStatus.prototype.update = function() {
_Window_BattleStatus_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_BattleStatus.prototype.updatePlacement = function() {
this._goalX = eval(_.battleStatusX);
this._goalY = eval(_.battleStatusY);
if(_.battleStatusVisible !== 'true') this.visible = eval(_.battleStatusVisible);
this.updateMovement();
};
Window_BattleStatus.prototype.instantPlacement = _.instantPlacement;
Window_BattleStatus.prototype.updateMovement = _.updateMovement;
Window_BattleStatus.prototype.initializePositions = _.initializePositions;
Window_BattleStatus.prototype.updateOffset = _.updateOffset;
Window_BattleStatus.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_BattleStatus.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_BattleStatus.prototype.windowWidth = function() {
return eval(_.battleStatusWidth);
};
}
//-----------------------------------------------------------------------------
// Window_PartyCommand
//-----------------------------------------------------------------------------
const _Window_PartyCommand_initialize = Window_PartyCommand.prototype.initialize;
Window_PartyCommand.prototype.initialize = function() {
_Window_PartyCommand_initialize.apply(this, arguments);
this.initializePositions();
if(_.motions['party command']) this._motionsInfos = _.motions['party command'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('party command'));
};
const _Window_PartyCommand_update = Window_PartyCommand.prototype.update;
Window_PartyCommand.prototype.update = function() {
_Window_PartyCommand_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_PartyCommand.prototype.updatePlacement = function() {
this._goalX = eval(_.partyCommandX);
this._goalY = eval(_.partyCommandY);
if(_.partyCommandVisible !== 'true') this.visible = eval(_.partyCommandVisible);
this.updateMovement();
};
Window_PartyCommand.prototype.instantPlacement = _.instantPlacement;
Window_PartyCommand.prototype.updateMovement = _.updateMovement;
Window_PartyCommand.prototype.initializePositions = _.initializePositions;
Window_PartyCommand.prototype.updateOffset = _.updateOffset;
Window_PartyCommand.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_PartyCommand.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_PartyCommand.prototype.numVisibleRows = function() {
return eval(_.partyCommandRows);
};
Window_PartyCommand.prototype.maxCols = function() {
return eval(_.partyCommandCols);
};
Window_PartyCommand.prototype.windowWidth = function() {
return eval(_.partyCommandWidth);
};
Window_PartyCommand.prototype.itemTextAlign = function() {
return _.partyCommandAlign;
};
//-----------------------------------------------------------------------------
// Window_ActorCommand
//-----------------------------------------------------------------------------
const _Window_ActorCommand_initialize = Window_ActorCommand.prototype.initialize;
Window_ActorCommand.prototype.initialize = function() {
_Window_ActorCommand_initialize.apply(this, arguments);
this.initializePositions();
if(_.motions['actor command']) this._motionsInfos = _.motions['actor command'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('actor command'));
};
const _Window_ActorCommand_update = Window_ActorCommand.prototype.update;
Window_ActorCommand.prototype.update = function() {
_Window_ActorCommand_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_ActorCommand.prototype.updatePlacement = function() {
this._goalX = eval(_.actorCommandX);
this._goalY = eval(_.actorCommandY);
if(_.actorCommandVisible !== 'true') this.visible = eval(_.actorCommandVisible);
this.updateMovement();
};
Window_ActorCommand.prototype.instantPlacement = _.instantPlacement;
Window_ActorCommand.prototype.updateMovement = _.updateMovement;
Window_ActorCommand.prototype.initializePositions = _.initializePositions;
Window_ActorCommand.prototype.updateOffset = _.updateOffset;
Window_ActorCommand.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_ActorCommand.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_ActorCommand.prototype.numVisibleRows = function() {
return eval(_.actorCommandRows);
};
Window_ActorCommand.prototype.maxCols = function() {
return eval(_.actorCommandCols);
};
Window_ActorCommand.prototype.windowWidth = function() {
return eval(_.actorCommandWidth);
};
Window_ActorCommand.prototype.itemTextAlign = function() {
return _.actorCommandAlign;
};
//-----------------------------------------------------------------------------
// Window_BattleSkill
//-----------------------------------------------------------------------------
const _Window_BattleSkill_initialize = Window_BattleSkill.prototype.initialize;
Window_BattleSkill.prototype.initialize = function() {
_Window_BattleSkill_initialize.apply(this, arguments);
this.height = this.fittingHeight(this.numVisibleRows());
this.initializePositions();
if(_.motions['skill list']) this._motionsInfos = _.motions['skill list'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('skill list'));
};
const _Window_BattleSkill_update = Window_BattleSkill.prototype.update;
Window_BattleSkill.prototype.update = function() {
_Window_BattleSkill_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_BattleSkill.prototype.updatePlacement = function() {
this._goalX = eval(_.skillListX);
this._goalY = eval(_.skillListY);
if(_.skillListVisible !== 'true') this.visible = eval(_.skillListVisible);
this.updateMovement();
};
Window_BattleSkill.prototype.instantPlacement = _.instantPlacement;
Window_BattleSkill.prototype.updateMovement = _.updateMovement;
Window_BattleSkill.prototype.initializePositions = _.initializePositions;
Window_BattleSkill.prototype.updateOffset = _.updateOffset;
Window_BattleSkill.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_BattleSkill.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_BattleSkill.prototype.numVisibleRows = function() {
return eval(_.skillListRows);
};
Window_BattleSkill.prototype.maxCols = function() {
return eval(_.skillListCols);
};
Window_BattleSkill.prototype.windowWidth = function() {
return eval(_.skillListWidth);
};
Window_BattleSkill.prototype.itemTextAlign = function() {
return _.skillListAlign;
};
//-----------------------------------------------------------------------------
// Window_BattleItem
//-----------------------------------------------------------------------------
const _Window_BattleItem_initialize = Window_BattleItem.prototype.initialize;
Window_BattleItem.prototype.initialize = function() {
_Window_BattleItem_initialize.apply(this, arguments);
this.height = this.fittingHeight(this.numVisibleRows());
this.initializePositions();
if(_.motions['item list']) this._motionsInfos = _.motions['item list'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('item list'));
};
const _Window_BattleItem_update = Window_BattleItem.prototype.update;
Window_BattleItem.prototype.update = function() {
_Window_BattleItem_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_BattleItem.prototype.updatePlacement = function() {
this._goalX = eval(_.itemListX);
this._goalY = eval(_.itemListY);
if(_.itemListVisible !== 'true') this.visible = eval(_.itemListVisible);
this.updateMovement();
};
Window_BattleItem.prototype.instantPlacement = _.instantPlacement;
Window_BattleItem.prototype.updateMovement = _.updateMovement;
Window_BattleItem.prototype.initializePositions = _.initializePositions;
Window_BattleItem.prototype.updateOffset = _.updateOffset;
Window_BattleItem.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_BattleItem.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_BattleItem.prototype.numVisibleRows = function() {
return eval(_.itemListRows);
};
Window_BattleItem.prototype.maxCols = function() {
return eval(_.itemListCols);
};
Window_BattleItem.prototype.windowWidth = function() {
return eval(_.itemListWidth);
};
Window_BattleItem.prototype.itemTextAlign = function() {
return _.itemListAlign;
};
//-----------------------------------------------------------------------------
// Window_BattleEnemy
//-----------------------------------------------------------------------------
if(!(Imported.YEP_BattleEngineCore && Yanfly.Param.BECEnemySelect)) {
const _Window_BattleEnemy_initialize = Window_BattleEnemy.prototype.initialize;
Window_BattleEnemy.prototype.initialize = function() {
_Window_BattleEnemy_initialize.apply(this, arguments);
this.initializePositions();
if(_.motions['enemy list']) this._motionsInfos = _.motions['enemy list'];
this._stayWithinScreen = Boolean(_.forceScreens.contains('enemy list'));
};
const _Window_BattleEnemy_update = Window_BattleEnemy.prototype.update;
Window_BattleEnemy.prototype.update = function() {
_Window_BattleEnemy_update.apply(this, arguments);
if(BattleManager._bsc_windowsSet) this.updatePlacement();
};
Window_BattleEnemy.prototype.updatePlacement = function() {
this._goalX = eval(_.enemyListX);
this._goalY = eval(_.enemyListY);
if(_.enemyListVisible !== 'true') this.visible = eval(_.enemyListVisible);
this.updateMovement();
};
Window_BattleEnemy.prototype.instantPlacement = _.instantPlacement;
Window_BattleEnemy.prototype.updateMovement = _.updateMovement;
Window_BattleEnemy.prototype.initializePositions = _.initializePositions;
Window_BattleEnemy.prototype.updateOffset = _.updateOffset;
Window_BattleEnemy.prototype.updateOffsetConditions = _.updateOffsetConditions;
Window_BattleEnemy.prototype.updateScreenRestrict = _.updateScreenRestrict;
Window_BattleEnemy.prototype.numVisibleRows = function() {
return eval(_.enemyListRows);
};
Window_BattleEnemy.prototype.maxCols = function() {
return eval(_.enemyListCols);
};
Window_BattleEnemy.prototype.windowWidth = function() {
return eval(_.enemyListWidth);
};
Window_BattleEnemy.prototype.itemTextAlign = function() {
return _.enemyListAlign;
};
}
})(SRD.BattleGUICore);