Difficulty Slider (YEP)

From Yanfly.moe Wiki
Jump to navigation Jump to search

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.



Download

System

This is a plugin created for RPG Maker MV.

For help on how to install plugins, click here.

For help on how to update plugins, click here.

Got errors with your RPG Maker MV plugin? Click here.


Masterarbeit Writer

Required Plugins

The following plugins are required in order to use this plugin.

Place the following plugins above this plugin located in the Plugin Manager.

Yanfly Engine Plugins

This plugin is a part of the Yanfly Engine Plugins library.


Introduction

This plugin requires YEP_EnemyLevels.
Make sure this plugin is located under YEP_EnemyLevels in the plugin list.

Sometimes, players would like to be able to increase or decrease the
difficulty of your game at their own accord. The Difficulty Slider becomes a
feature accessible from the game's option menu with this plugin installed.
There, the player is able to alter the level of the enemies that appear in
battle within a certain range (set by you, the developer).

The Difficulty Slider will only alter the level of the enemies and nothing
else. Therefore, a 200% difficulty will mean only a 200% increase in level
but not necessarily a 200% increase in ATK, for example. The enemies' ATK
value will be based off of its ATK at 200% the original level.

If the Difficulty Slider is disabled in the game, then the level multiplier
will revert back to 100%. You can enable and disable this feature at will
through plugin commands.

Notetags

NotetagsMV.png

RPG Maker MV's editor is unable to allow for custom traits/properties that a game dev may wish to associate with a database object, event, map, etc. Notetags are used to work around such limitations by allowing the game dev to tag certain traits/properties using specific Notetags declared by the related plugin.

Here is a list of Notetag(s) that you may use.

---

There is a notetag you can use for the Difficulty Slider plugin.

Enemy Notetag:

  <Unaffected by Difficulty Slider>
  - This will make the enemy's level unaffected by the difficulty slider,
  meaning the enemy will always be at 100% its current calculated level.

Plugin Commands

PluginCommandsMV.png

Plugin Commands are event commands that are used to call upon functions added by a plugin that aren't inherently a part of RPG Maker MV.

Here is a list of Plugin Command(s) that you may use:

For those who wish to show/hide the Difficulty Slider from the options menu
midway through the game, you can control it using these plugin commands:

Plugin Commands:

  ShowDifficultySlider
  - This will show the Difficulty Slider and enable it making it apply to
  all enemies in the game that do not have an unaffected notetag.

  HideDifficultySlider
  - This will hide the Difficulty Slider and also disable the slider's
  effects on enemy levels in the game.

Additional Info

For those who wish to use the Difficulty Slider in script calls, you can
find out the value the player has set using:

  ConfigManager.difficultySlider

This value will return a whole number. A difficulty setting of 100% will
yield 100 and a difficulty setting of 200% will yield 200. Therefore, if you
wish to make a check that appears only on higher difficulties, you can use
the following:

  if (ConfigManager.difficultySlider >= 200) {
    // Do stuff
  }

Have fun!

Options Core Integration

To integrate options from this plugin into Yanfly's Options Core, use the settings below:

If you are using YEP_OptionsCore.js, you can add a new Option using this
plugin. Here's the following code/parameter settings you can use with it.

---------
Settings:
---------

Name:
\i[87]Enemy Difficulty

Help Description:
Determines the level strength of enemies.

Symbol:
difficultySlider

Show/Hide:
if (Imported.YEP_X_DifficultySlider) {
  show = $gameSystem.showDifficultySlider();
} else {
  show = false;
}

Enable:
enabled = true;

Ext:
ext = 0;

----------
Functions:
----------

Make Option Code:
this.addCommand(name, symbol, enabled, ext);

Draw Option Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var value = this.getConfigValue(symbol);
var rate = value / Yanfly.Param.DSliderMaxDif;
var gaugeColor1 = this.textColor(28);
var gaugeColor2 = this.textColor(29);
this.drawOptionsGauge(index, rate, gaugeColor1, gaugeColor2);
this.drawText(this.statusText(index), titleWidth, rect.y, statusWidth, 'center');

Process OK Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += Yanfly.Param.DSliderChange;
if (value > Yanfly.Param.DSliderMaxDif) value = Yanfly.Param.DSliderMinDif;
value = value.clamp(Yanfly.Param.DSliderMinDif, Yanfly.Param.DSliderMaxDif);
this.changeValue(symbol, value);

Cursor Right Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += Yanfly.Param.DSliderChange;
value = value.clamp(Yanfly.Param.DSliderMinDif, Yanfly.Param.DSliderMaxDif);
this.changeValue(symbol, value);

Cursor Left Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value -= Yanfly.Param.DSliderChange;
value = value.clamp(Yanfly.Param.DSliderMinDif,
Yanfly.Param.DSliderMaxDif);
this.changeValue(symbol, value);

Default Config Code:
// Empty. Provided by this plugin.

Save Config Code:
// Empty. Provided by this plugin.

Load Config Code:
// Empty. Provided by this plugin.

Changelog

Version 1.04:
- Bypass the isDevToolsOpen() error when bad code is inserted into a script
call or custom Lunatic Mode code segment due to updating to MV 1.6.1.

Version 1.03:
- Compatibility update for YEP_OptionsCore.js.

Version 1.02:
- Updated for RPG Maker MV version 1.5.0.

Version 1.01:
- Bug fixed: Error with pressing right on the difficulty slider causing
the game to crash unexpectedly.

Version 1.00:
- Finished Plugin!