-50%
Le deal à ne pas rater :
-50% sur les sacs à dos pour ordinateur portable Urban Factory ...
19.99 € 39.99 €
Voir le deal

Aller en bas
LightNox
LightNox
Membre

Nombre de messages : 1759
Age : 33
Localisation : Chez Moi ^^
Date d'inscription : 10/04/2008

LN_TeleportMV Empty LN_TeleportMV

Dim 2 Oct 2016 - 16:27
Auteur: LightNox
Fonction: Système de téléportation.
Utilisation: Voir le fichier d'aide dans le gestionnaire de plugin.
Nom du JS:LN_TeleportMV.js à mettre dans le dossier js/plugins/
Ressources:

  • Votre map monde à nomme comme ceci : WorldMap.png à placer dans le dossier picture/

Code JS:
Code:
/******************************************************************************/
// LN-TeleportMV.js
/******************************************************************************/
/*:
 * @plugindesc Système de téléportation depuis une map monde.
 * @author LightNox.
 *
 * @param Nom option
 * @desc Nom de l'option téléportation dans le menu.
 * @default Teleportation
 *
 * @param Dans menu
 * @desc 0 => Pas d'option, 1 => Option dans le Menu.
 * @default 1
 *
 * @help Pour ajouter un point de teleportation créer un évènement et mettez y ceci :
 *
 *          addTeleportPoint nom_de_la_ville
 *          
 *          /!\nom_de_la_ville étant à remplacer par le nom de votre ville/!\
 *          
 *       Pour enlever un point de teleportation créer un évènement et mettez y
 *       ceci :
 *      
 *          remTeleportPoint nom_de_la_ville
 *          
 *          /!\nom_de_la_ville étant à remplacer par le nom de votre ville/!\
 *          
 *       Pour paramétrer vos villes il faut modifier a partir de la ligne N°
 *          bonafon: ["Bonafon", 578, 189, 1, 8, 6, 20],
 *          
 *       bonafon: => renommer le pour le nom de votre ville en respectant
 *                   l'écriture.
 *       "Bonafon" => renommer le pour le nom de votre ville.
 *       549 => coordonnée x de votre button.
 *       100 => coordonnée y de votre button.
 *       1 => Id de la map ou va être teleporter votre équipe.
 *       12 => position x d'apparition de votre équipe sur la map.
 *       03 => position y d'apparition de votre équipe sur la map.
 *       20 => Argent à payer pour la teleportation.
 *      
 *       Si dans le cas ou le paramètre Dans menu est égale à 0, vous pouvez
 *       appelez la Scene_Teleport via un appel dans un évènement.
 *      
 *       Donc dans un évènement mettez y une commande de module est écrivez
 *       ceci :
 *      
 *          TeleportScene
 *          
 *       /!\Attention prenez garde a bien respecter Majuscule et Minuscule des
 *       mots/!\
 *          
 *       /!\De plus pour faire fonctionner ce plugin, le plugin Tonyryu_Gui.js
 *          sera indispensable, sans ça il ne fonctionnera pas/!\
 */
/******************************************************************************/
// BEGIN
/******************************************************************************/
var parameters = PluginManager.parameters('LN-TeleportMV');
var param_dansMenu = Number(parameters['Dans menu'] || 1);
var param_nomOption = String(parameters['Nom option'] || 'Teleportation');
/******************************************************************************/
// Tableau des téléportations.
// Configuration :
// ville: ["nom_de_la_ville", x, y, id, x, y, gold
// (voir le fichier d'aide pour plus d'info)
// Vous pouvez rajoutez vos ville à la suite en respectant la syntaxe.
/******************************************************************************/    
var _listTeleport = {
    maville: ["Maville", 578, 189, 1, 8, 6, 20],
};
/******************************************************************************/
// Méthode : Game_Party
// Fonction : Ajout des fonctions de téléportation dans Game_Party.
/******************************************************************************/
var _GameParty_Teleport_Init = Game_Party.prototype.initialize;

Game_Party.prototype.initialize = function(){
    _GameParty_Teleport_Init.call(this);
    this._teleportPoint = [];
};

Game_Party.prototype.addTeleportPoint = function(pNomPoint){
    if(this._teleportPoint.indexOf(pNomPoint) === -1)
        this._teleportPoint.push(pNomPoint);
};

Game_Party.prototype.remTeleportPoint = function(pNomPoint){
    var idx = this._teleportPoint.indexOf(pNomPoint);
    this._teleportPoint.splice(idx, 1);
};
/******************************************************************************/
// Méthode : Window_Teleport
// Fonction : Création de la fenêtre d'affichage.
/******************************************************************************/  
function Window_Teleport(){
    this.initialize.apply(this, arguments);
}

Window_Teleport.prototype = Object.create(Window_Gui.prototype);
Window_Teleport.prototype.constructor = Window_Teleport;

Window_Teleport.prototype.initialize = function(x, y, width, height){
    Window_Gui.prototype.initialize.call(this, x, y, width, height);
    this.padding = 0;
    this.addGui('guiTeleport', new Gui_Base({x:0, y:0, width:1366, height:768, imageUrl:"img/pictures/newhud/WorldMap.png"}));
    this.addGui('guiTxtTel', new Gui_Base({x:637, y:13, width:88, height:20, text:'Filgaia', fontSize:18, textAlign:'center', textColor:'#a5bfe1'}));
    this.addGui('guiPrice', new Gui_Base({x:580, y:736, width:210, height: 20, text:'Vous devez payez :', fontSize:18, textAlign:'center', textColor:'#a5bfe1'}));
    this.addGui('guiCancel', new Gui_Button({x:1315, y:718, width:49, height:47, imageUrl:"img/pictures/newhud/Button11.png"}));
    for(var idxPoint = 0; idxPoint < $gameParty._teleportPoint.length; idxPoint++){
        var nomPoint = $gameParty._teleportPoint[idxPoint];
        this.addGui('guiTxtBtn' + _listTeleport[nomPoint][0], new Gui_Base({x:_listTeleport[nomPoint][1] - 30, y:_listTeleport[nomPoint][2] - 23, width:80, height:25, text:_listTeleport[nomPoint][0], textColor:'#a5bfe1', fontSize:14, textAlign:'center'}));
        this.addGui('guibtn' + _listTeleport[nomPoint][0], new Gui_Button({x:_listTeleport[nomPoint][1], y:_listTeleport[nomPoint][2], width:19, height:19, imageUrl:"img/pictures/newhud/cursorMap.png"}));
    }
};
/******************************************************************************/
// Méthode : Scene_Teleport
// Fonction : Gestion de la téléportation.
/******************************************************************************/
function Scene_Teleport(){
    this.initialize.apply(this, arguments);
}

Scene_Teleport.prototype = Object.create(Scene_Base.prototype);
Scene_Teleport.prototype.constructor = Scene_Teleport;

Scene_Teleport.prototype.create = function(){
    this._winTeleport = new Window_Teleport(0, 0, 1366, 768);
    this._winTeleport.activate();
    for(var idxPoint = 0; idxPoint < $gameParty._teleportPoint.length; idxPoint++){
        var nomPoint = $gameParty._teleportPoint[idxPoint];
        this._winTeleport.setHandlerGui('guibtn' + _listTeleport[nomPoint][0], 'onclick', this.onClickPoint.bind(this, nomPoint));
        this._winTeleport.setHandlerGui('guibtn' + _listTeleport[nomPoint][0], 'onrollover', this.onRollOver.bind(this, nomPoint));
    }
    this._winTeleport.setHandlerGui('guiCancel', 'onclick', this.popScene.bind(this));
    this.addWindow(this._winTeleport);
};

Scene_Teleport.prototype.onClickPoint = function(nomPoint){
    if($gameParty.gold() >= _listTeleport[nomPoint][6]){
        $gameParty.gainGold(-_listTeleport[nomPoint][6]);
        $gamePlayer.reserveTransfer(_listTeleport[nomPoint][3], _listTeleport[nomPoint][4], _listTeleport[nomPoint][5]);
        SceneManager.clearStack();
        //AudioManager.playSe('Absorb1');
        SceneManager.goto(Scene_Map);
    }
    else{
       http://AudioManager.playSe('Buzzer1');
    }
};

Scene_Teleport.prototype.onRollOver = function(nomPoint){
    this._winTeleport.getGui('guiPrice').setOptions({text:'Vous devez payez : ' + String(_listTeleport[nomPoint][6] + ' pour ' + String(_listTeleport[nomPoint][0]))});
};
/******************************************************************************/
// Méthode : Window_MenuCommande
// Fonction : Ajout de la commande de téléportation au menu.
/******************************************************************************/
var _Window_MenuCommand_addMainCommands = Window_MenuCommand.prototype.addMainCommands;

Window_MenuCommand.prototype.addMainCommands = function() {
    _Window_MenuCommand_addMainCommands.call(this);
    if(param_dansMenu === 1){
        var enabled = this.areMainCommandsEnabled();
        if (this.needsCommand('teleport')){
            this.addCommand(param_nomOption, 'teleport', enabled);
        }
    }
};
/******************************************************************************/
// Méthode : Scene_Menu
// Fonction : Modification du Scene_Menu.
/******************************************************************************/
var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;

Scene_Menu.prototype.createCommandWindow = function(){
    _Scene_Menu_createCommandWindow.call(this);
    if(param_dansMenu === 1)
        this._commandWindow.setHandler('teleport', this.commandTeleport.bind(this));
};

Scene_Menu.prototype.commandTeleport = function() {
    SceneManager.push(Scene_Teleport);
};
/******************************************************************************/
// Méthode : Game_Interpreter
// Fonction : Commande de Module personnalisé.
/******************************************************************************/
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;

Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if(command === 'addTeleportPoint')
        $gameParty.addTeleportPoint(args[0]);
    if(command === 'remTeleportPoint')
        $gameParty.remTeleportPoint(args[0]);
    if(command === 'TeleportScene')
        SceneManager.push(Scene_Teleport);
};
/******************************************************************************/
// END
/******************************************************************************/
Lien du plugin.js:LN_TeleportMV.js
Screenshot:
Spoiler:
Les villes présentes sur le screenshot ne sont pas bien configurer mais c'est juste pour montrer xD.
Désolé pour le screenshot je ne sait pas pourquoi il est flou.

Ce plugin nécessite les GUI de tonyryu pour fonctionner vous pouvez les trouver ici : Tonyryu_Gui.js
(Le plugin de GUI étant toujours en développement)

Bon making a tous ! Smile
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum