Sphinx-ActivateSelfSwitches

Tous mes développements

Sphinx-ActivateSelfSwitches

Comme tous mes plugins, ce script est publié sous licence CC BY 4.0.

//=============================================================================
// Sphinx-ActivateSelfSwitches.js
//=============================================================================

/*:
 * @plugindesc Active à distance les interrupteurs locaux.
 * @author Sphinx
 *
 * @help
 * //==========================================================================
 * // Plugin : Sphinx-ActivateSelfSwitches
 * // Date   : 6 janvier 2018
 * // Auteur : Sphinx
 * //==========================================================================
 * Ce plugin permet d'activer à distance (au moyen d'une commande de plugin)
 * les interrupteurs locaux d'évents.
 * 
 * Commande d'évent :
 *     ActSelfSwi MapId EventId SelfSwitch
 *         Active l'interrupteur local de l'évent ciblé
 *         MapId : ID de la map où se situe l'évent à impacter
 *         EventId : ID de l'évent à impacter
 *         SelfSwitch : A, B, C ou D
 * 
 *     DesSelfSwi MapId EventId SelfSwitch
 *         Désactive l'interrupteur local de l'évent ciblé
 *         MapId : ID de la map où se situe l'évent à impacter
 *         EventId : ID de l'évent à impacter
 *         SelfSwitch : A, B, C ou D
 * 
 * Dépendances :
 *     Aucune
 */
Sphinx_ASS_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
  Sphinx_ASS_Game_Interpreter_pluginCommand.call(this, command, args);
  if(command === "ActSelfSwi") {
    if(args[0] > 0) {
    var key = [args[0], args[1], args[2]];
      $gameSelfSwitches.setValue(key, true);
    }
    return true;
  }
  if(command === "DesSelfSwi") {
    if(args[0] > 0) {
    var key = [args[0], args[1], args[2]];
      $gameSelfSwitches.setValue(key, false);
    }
    return true;
  }
};

Ce plugin permet d’actionner les interrupteurs locaux des évents à partir d’autres events au moyen d’une commande de plugin. Les commandes du plugin sont au nombre de deux :

ActSelfSwi MapId EventId SelfSwitch
DesSelfSwi MapId EventId SelfSwitch

MapId est l’identifiant de la carte où se trouve l’event à impacter ; EventId est l’identifiant de l’event à impacter dans cette carte ; et SelfSwitch est l’interrupteur local à commuter (compris entre A et D).

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *