Advertisement
ICF-Soft

ICF-Soft Event Extension 1.04 RPG Maker MV

Nov 15th, 2016
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Event Extension
  3. // ICFSoft_EventExtension.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_Events = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.Events = ICF.Events || {};
  11.  
  12. ICF.Events.Version = 104; // 1.04
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.04 This plugin allows more conditions to events.
  17.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  18.  *
  19.  * @param Developer HaltJS
  20.  * @desc When true it throws an error if an custom event condition
  21.  * javascript doesn't work.   NO - false     YES - true
  22.  * @default false
  23.  *
  24.  * @help
  25.  * ============================================================================
  26.  * Introduction
  27.  *
  28.  * Pageevents have a limited set of conditions, there are usefull but sometimes
  29.  * aren't enough.
  30.  * Variables by default aren't versatile enough because they have "greater or
  31.  * equal" only option.
  32.  *
  33.  * With this plugin you can add extra conditions like more switches, unlimited
  34.  * selfswitches, unlimited mapswitches and versatile variables.
  35.  *
  36.  * Mapswitches are special switches that aplies to all events in a map.
  37.  *
  38.  * Partyswitches aren't special switches themselves. If at least one member of
  39.  * the party has this switch returns true.
  40.  *
  41.  * Variables can now be "greater or equal", "greater than", "lower than",
  42.  * "lower or equal", "equal to" or "different than" a value.
  43.  *
  44.  * Self and map variables don't need an explanation on how these work.
  45.  * Partyvariables are actor variables combinations (sum, min, max and average).
  46.  *
  47.  * Now you can assign names to pages to allow calling by name and/or make it
  48.  * dummy to disallow be using inside map.
  49.  *
  50.  * ============================================================================
  51.  * Parameters
  52.  * ============================================================================
  53.  *
  54.  * Developer HaltJS: This is a development variable usefull to check if there is
  55.  * a wrong javascript event condition.
  56.  * When true will throw an error when it found a wrong javascript in lunatic
  57.  * mode.
  58.  * When false it will be ignored and game continues.
  59.  *
  60.  * ============================================================================
  61.  * How to use
  62.  * ============================================================================
  63.  *
  64.  * To add an extra condition to a page just add a comment or note, same
  65.  * format as plugin commands:
  66.  *
  67.  * switch x x x x x x
  68.  * selfswitch x x x x x
  69.  * mapswitch x x
  70.  * partyswitch x x x
  71.  *
  72.  *  - Add specified game, self, map or party switch to conditions.
  73.  *    You can place all same-type switchs you need in same line.
  74.  *
  75.  * [prefix]variable x value
  76.  * [prefix]variablehigh x value
  77.  * [prefix]variableless x value
  78.  * [prefix]variablemax x value
  79.  * [prefix]variableequal x value
  80.  * [prefix]variabledif x value
  81.  *
  82.  *  - Add a variable condition. There are six types: min value, higher than,
  83.  *    lower than, max value, equal and not equal.
  84.  *    Optionaly you can add a prefix to use self, map and party variables
  85.  *    this way:
  86.  *
  87.  * selfvariable x value
  88.  * mapvariable x value
  89.  * partyvariable x value [min/max/avg]
  90.  *
  91.  *  - Partyvariables can have an extra parameter. If omited it will check
  92.  *    sum of party members specified variables.
  93.  *    -min: check minimun of party members specified variables.
  94.  *    -max: check maximun of party members specified variables.
  95.  *    -avg: check average value of party members specified variables.
  96.  *
  97.  * You can also give a name to a page and/or make it dummy with these:
  98.  *
  99.  * pagename name
  100.  *
  101.  *  - Give a name to a page.
  102.  *
  103.  * dummypage [name]
  104.  *
  105.  *  - Disallow a page to be trigered by page conditions.
  106.  *    You can optionally give it a name.
  107.  *
  108.  * ============================================================================
  109.  * Lunatic Mode
  110.  * ============================================================================
  111.  *
  112.  * You can use special conditions to a page by using javascript.
  113.  * There are inside a comment or note like others conditions and if you use more
  114.  * than one all will be merged.
  115.  *
  116.  * customreq: code
  117.  *
  118.  *  result - this is where result is stored. By default is false.
  119.  *
  120.  * ============================================================================
  121.  * Plugin commands
  122.  * ============================================================================
  123.  *
  124.  * CallPage x
  125.  *
  126.  *   - Call page by it's name or page number.
  127.  *
  128.  * CallEventPage 1 2 3
  129.  *
  130.  *   - You can call a page from other event by it's name or page number.
  131.  *     Works different depending on how many arguments have been added.
  132.  *     1: Calls first page from event.
  133.  *     2: Second parameter is the page name or number.
  134.  *     3: Third is the eventid that can be affected by self switchs/vars
  135.  *        or commands. You can use "this" as a param.
  136.  *
  137.  *
  138.  * These other plugin commands are actually included in ICF-Soft Main Utility.
  139.  * Reffer to Main Utility readme for full list.
  140.  *
  141.  * selfswitch x true/false
  142.  * mapswitch x true/false
  143.  *
  144.  *  - Turns on/off specified selfswitch or mapswitch.
  145.  *
  146.  * remoteswitch mapid eventid x true/false
  147.  *
  148.  *  - Turns on/off specified selfswitch or mapswitch remotely.
  149.  *    Use eventid 0 for a mapswitch.
  150.  *
  151.  * ============================================================================
  152.  * Scripting functions
  153.  * ============================================================================
  154.  *
  155.  * event.callPage(name);
  156.  *
  157.  *  - Call an event page by it's name.
  158.  *
  159.  * ============================================================================
  160.  * Incompatibilities
  161.  * ============================================================================
  162.  *
  163.  * There's no known incompatible plugins yet.
  164.  *
  165.  * ============================================================================
  166.  * Known isues
  167.  * ============================================================================
  168.  *
  169.  * Not yet.
  170.  *
  171.  * Plugins that allow to have more than 999 maps without increasing map ids
  172.  * can cause glitches between maps that shares special switches and variables.
  173.  *
  174.  * ============================================================================
  175.  * Changelog
  176.  * ============================================================================
  177.  *
  178.  * Version 1.04:
  179.  * - Added pagenames and dummypages.
  180.  *
  181.  * Version 1.03:
  182.  * - Use of ICF-Soft Main Utility.
  183.  * - Added partyswitchs.
  184.  * - Added self, map and party variables.
  185.  *
  186.  * Version 1.02:
  187.  * - Fixed and improved lunatic mode.
  188.  * - More versatile variables.
  189.  * - Added remote switchs.
  190.  *
  191.  * Version 1.01:
  192.  * - Added lunatic mode.
  193.  *
  194.  * Version 1.00:
  195.  * - Finished plugin!
  196.  *
  197.  * ============================================================================
  198.  *
  199.  * For commercial and non-commercial games.
  200.  * Credit to ICF-Soft.
  201.  * This entire header must be included with plugin.
  202.  *
  203.  * ============================================================================
  204. */
  205. //=============================================================================
  206.  /*:es
  207.  * @plugindesc v1.04 Este complemento permite más condiciones en los
  208.  * eventos.
  209.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  210.  *
  211.  * @param Developer HaltJS
  212.  * @desc Si está activado salta cuando una función personalizada
  213.  * da error.   No - false   Si - true
  214.  * @default false
  215.  *
  216.  * @help
  217.  * ============================================================================
  218.  * Introducción
  219.  * ============================================================================
  220.  *
  221.  * Las páginas de los eventos tienen un número limitado de condiciones, son
  222.  * útiles pero a veces no son suficientes.
  223.  * Las variables por defecto no son muy versátiles pues sólo tienen la opción
  224.  * de "igual o mayor".
  225.  *
  226.  * Con este complemento puedes añadir condiciones extra tales como más
  227.  * interruptores, autointerruptores ilimitados, interruptores de mapa ilimitados
  228.  * y variables más versátiles.
  229.  *
  230.  * Los nuevos interruptores de mapa son unos interruptores especiales similares
  231.  * a los automáticos, que afectan a todos los eventos del mapa.
  232.  *
  233.  * Los partyswitches no son interruptores en sí mismos. Indican si algún
  234.  * personaje del grupo tiene el interruptor activado.
  235.  *
  236.  * Las variables ahora permiten las opciones "igual o mayor", "mayor que",
  237.  * "menor que", "menor o igual", "igual que" o "distinto a".
  238.  *
  239.  * Las variables de evento y mapa no requieren explicar cómo funcionan.
  240.  * Las partyvariables funcionan como combinación de las variables de los
  241.  * personajes que se encuentran en el grupo (suma, min, máx y media).
  242.  *
  243.  * Ahora puedes asignar nombres a las páginas para poder llamarlas y/o hacerlas
  244.  * que no se activen en el mapa.
  245.  *
  246.  * ============================================================================
  247.  * Parámetros
  248.  * ============================================================================
  249.  *
  250.  * Developer HaltJS: Esta es una variable de uso durante el desarrollo del juego
  251.  * útil cuando quieres comprobar si hay alguna función personalizada incorrecta.
  252.  * Cuando está activado al encontrar un error el juego se para.
  253.  * Cuando está desactivado ignora el error y el juego continúa.
  254.  *
  255.  * ============================================================================
  256.  * Uso
  257.  * ============================================================================
  258.  *
  259.  * Para añadir una condición extra en una página simplemente añadir una nota
  260.  * en el mismo formato que un comando de complemento:
  261.  *
  262.  * switch x x x x x
  263.  * selfswitch x x x
  264.  * mapswitch x
  265.  * partyswitch x x x
  266.  *
  267.  *  - Para añadir interruptor, autointerruptor, interruptor de mapa o
  268.  *    interruptor del grupo.
  269.  *    Puedes usar todos los que necesites del mismo tipo en una misma linea.
  270.  *
  271.  * [prefijo]variable x value
  272.  * [prefijo]variablehigh x value
  273.  * [prefijo]variableless x value
  274.  * [prefijo]variablemax x value
  275.  * [prefijo]variableequal x value
  276.  * [prefijo]variabledif x value
  277.  *
  278.  *  - Para añadir condición de variable. Tipos: mínimo, mayor, menos,
  279.  *    máximo, igual y distinto respectivamente.
  280.  *    Opcionalmente puedes utilizar un prefijo para usar autovariables,
  281.  *    de mapa o del grupo.
  282.  *    Quedaría así:
  283.  *
  284.  * selfvariable x value
  285.  * mapvariable x value
  286.  * partyvariable x value [min/max/avg]
  287.  *
  288.  *  - Partyvariables pueden usar un parámetro extra. Si se omite se usará
  289.  *    la suma de la variable de cada personaje del grupo.
  290.  *    -min: para comprobar el mínimo entre la variable de cada personaje
  291.  *          del grupo.
  292.  *    -max: para comprobar el máximo entre la variable de cada personaje
  293.  *          del grupo.
  294.  *    -avg: para comprobar la media de la variable de cada personaje
  295.  *          del grupo.
  296.  *
  297.  * Puedes poner un nombre a una página y/o deshabilitarla en mapa con las
  298.  * siguientes notas:
  299.  *
  300.  * pagename name
  301.  *
  302.  *  - Nombrar una página.
  303.  *
  304.  * dummypage [name]
  305.  *
  306.  *  - Impide que la página pueda ser activada del modo usual.
  307.  *    Opcionalmente puedes ponerle un nombre para que solo se pueda llamar
  308.  *    por el.
  309.  *
  310.  *
  311.  * ============================================================================
  312.  * Lunatic Mode
  313.  * ============================================================================
  314.  *
  315.  * Puedes usar condiciones especiales en una página mediante javascript.
  316.  * Se pone el código en una nota del mismo modo que las demás condiciones.
  317.  * Si usas más de una se juntarán todas.
  318.  *
  319.  * customreq: código
  320.  *
  321.  *  result - aquí se almacena el resultado. Por defecto está desactivado.
  322.  *
  323.  * ============================================================================
  324.  * Comandos de complemento
  325.  * ============================================================================
  326.  *
  327.  * CallPage x
  328.  *
  329.  *   - Llama a una página del evento por su nombre o número.
  330.  *
  331.  * CallEventPage 1 2 3
  332.  *
  333.  *   - Llama a una página de otro evento por su nombre o número.
  334.  *     Funciona diferente según el número de argumentos que le pongas.
  335.  *     1: Llama la primera página del evento.
  336.  *     2: El segundo es nombre de página o número.
  337.  *     3: El tercero es la id del evento que puede ser afectado por las
  338.  *        variables/interruptores locales o comandos como borrar evento.
  339.  *        Puedes usar "this" para que afecte al evento desde donde se llama.
  340.  *
  341.  *
  342.  * El resto de comandos de complemento están actualmente incluidos
  343.  * en ICF-Soft Main Utility.
  344.  * Para ver la lista completa es mejor referirse al archivo leeme
  345.  * del Main Utility.
  346.  *
  347.  * selfswitch x true/false
  348.  * mapswitch x true/false
  349.  *
  350.  *  - Activa o desactiva el autointerruptor o interruptor de mapa.
  351.  *
  352.  * remoteswitch mapid eventid x true/false
  353.  *
  354.  *  - Activa o desactiva el autointerruptor o interruptor de mapa específico
  355.  *    de forma remota. Usar eventid 0 para interruptor de mapa.
  356.  *
  357.  * ============================================================================
  358.  * Funciones de script
  359.  * ============================================================================
  360.  *
  361.  * event.callPage(name);
  362.  *
  363.  *  - Llama a una página del evento por su nombre.
  364.  *
  365.  * ============================================================================
  366.  * Incompatibilidades
  367.  * ============================================================================
  368.  *
  369.  * No se conocen complementos que sean incompatibles hasta la fecha.
  370.  *
  371.  * ============================================================================
  372.  * Problemas conocidos
  373.  * ============================================================================
  374.  *
  375.  * Por el momento ninguno.
  376.  *
  377.  * El uso de complementos que permiten usar más de 999 mapas que no incrementan
  378.  * las id's puede ocasionar bugs entre mapas que compartan interruptores
  379.  * y variables especiales.
  380.  *
  381.  * ============================================================================
  382.  * Historial de versiones
  383.  * ============================================================================
  384.  *
  385.  * Version 1.04:
  386.  * - Se han añadido nombres para páginas y deshabilitación de páginas.
  387.  *
  388.  * Version 1.03:
  389.  * - Se empieza a utilizar el ICF-Soft Main Utility.
  390.  * - Se han añadido los interruptores de grupo.
  391.  * - Se han añadido las variables de evento, mapa y de grupo.
  392.  *
  393.  * Version 1.02:
  394.  * - Modo lunático arreglado y mejorado.
  395.  * - Variables más versátiles.
  396.  * - Se han añadido interruptores remotos.
  397.  *
  398.  * Version 1.01:
  399.  * - Se ha añadido el modo lunático.
  400.  *
  401.  * Version 1.00:
  402.  * - Complemento terminado.
  403.  *
  404.  * ============================================================================
  405.  *
  406.  * Para juegos comerciales y no comerciales.
  407.  * Se debe incluir a ICF-Soft en los créditos.
  408.  * Esta cabecera debe incluirse íntegramente con el plugin.
  409.  *
  410.  * ============================================================================
  411. */
  412. //=============================================================================
  413.  
  414. //=============================================================================
  415. // Parameter Variables
  416. //=============================================================================
  417.  
  418. ICF.Parameters = PluginManager.parameters('ICFSoft_EventExtension');
  419. ICF.Param = ICF.Param || {};
  420.  
  421. ICF.Param.EventExHalt = ICF.Parameters['Developer HaltJS'].toLowerCase() === "true";
  422.  
  423. if (!Imported.ICFSoft_MainUtility) {throw new Error('This plugin requires ICF-Soft Main Utility plugin to work.\nYou can download it at icfsoft.blogspot.com inside plugins section.');}
  424.  
  425. //=============================================================================
  426. // Event Utilities
  427. //=============================================================================
  428.  
  429. ICF.Events.Checking = false;
  430.  
  431. ICF.Events.CustomSwitch = function(mapid, evid, switchname, value) {
  432.     var _key = [mapid, evid, switchname];
  433.     var _value = (value.toLowerCase() === "true");
  434.     $gameSelfSwitches.setValue(_key, _value);
  435. }
  436.  
  437. ICF.Events.ProcessComment = function(page, obj, content) {
  438.     var args = content.split(" ");
  439.     if (ICF.Events.Checking) {
  440.         page._customreq = page._customreq + content + '\n';
  441.     } else if (args[0] !== null && args[1] !== null) {
  442.         if (args[0].toLowerCase() == "dummypage") {
  443.             page._isDummy = true;
  444.             if (args[1] !== null) {obj.pagenames[args[1]] = page;};
  445.         } else if ((args[0].toLowerCase() == "pagename") && (args[1] !== null)) {
  446.             obj.pagenames[args[1]] = page;
  447.         } else if (args[0].toLowerCase() == "switch") {
  448.             args.splice(0, 1);
  449.             page._switchs = page._switchs.concat(args);
  450.         } else if (args[0].toLowerCase() == "selfswitch") {
  451.             args.splice(0, 1);
  452.             page._selfswitchs = page._selfswitchs.concat(args);
  453.         } else if (args[0].toLowerCase() == "mapswitch") {
  454.             args.splice(0, 1);
  455.             page._mapswitchs = page._mapswitchs.concat(args);
  456.         } else if (args[0].toLowerCase() == "partyswitch") {
  457.             args.splice(0, 1);
  458.             page._mapswitchs = page._partyswitchs.concat(args);
  459.         } else if (args[0].toLowerCase().match(/((?:self)|(?:map)|(?:party))?(variable)((?:high)|(?:less)|(?:min)|(?:max)|(?:equal)|(?:dif))?/i)&&(RegExp.$1.length + RegExp.$2.length + RegExp.$3.length == args[0].length)) {
  460.             var code = (RegExp.$3 == "high")? 2 : (RegExp.$3 == "less")? 4 : (RegExp.$3 == "max")? 5 : (RegExp.$3 == "equal")? 0 : (RegExp.$3 == "dif")? 1 : 3;
  461.             if (RegExp.$1 == "self") page._selfvars.push([code, args[1], args[2]]);
  462.             else if (RegExp.$1 == "map") page._mapvars.push([code, args[1], args[2]]);
  463.             else if (RegExp.$1 == "party") page._partyvars.push([code, args[1], args[2], args[3]]);
  464.             else page._vars.push([code, args[1], args[2]]);
  465.         } else if (args[0].toLowerCase() == "customreq:") {
  466.             page._customreq = page._customreq + content.substring(10) + '\n';
  467.             ICF.Events.Checking = true;
  468.         }
  469.     }
  470. }
  471.  
  472. ICF.Events.CheckVar = function(code, value1, value2) {
  473.     switch (code) {
  474.         case 0:
  475.             return (value1 == value2); break;
  476.         case 1:
  477.             return (value1 !== value2); break;
  478.         case 2:
  479.             return (value1 > value2); break;
  480.         case 3:
  481.             return (value1 >= value2); break;
  482.         case 4:
  483.             return (value1 < value2); break;
  484.         case 5:
  485.             return (value1 <= value2); break;
  486.         default:
  487.             return false;
  488.     }
  489. }
  490.  
  491. //=============================================================================
  492. // Game_Event
  493. //=============================================================================
  494.  
  495. ICF.Events.init = Game_Event.prototype.initialize;
  496. Game_Event.prototype.initialize = function(mapId, eventId) {
  497.     ICF.Events.init.call(this, mapId, eventId);
  498.     var pages = this.event().pages;
  499.     this.event().pagenames = {};
  500.     for (i = 0; i < pages.length; i += 1) {
  501.         var page = pages[i];
  502.         page._switchs = [];
  503.         page._selfswitchs = [];
  504.         page._mapswitchs = [];
  505.         page._partyswitchs = [];
  506.         page._vars = [];
  507.         page._selfvars = [];
  508.         page._mapvars = [];
  509.         page._partyvars = [];
  510.         page._customreq = "";
  511.         for (j = 0; j < page.list.length; j += 1) {
  512.             var command = page.list[j];
  513.             if (command.code === 108) {
  514.                 ICF.Events.Checking = false;
  515.                 ICF.Events.ProcessComment(page, this.event(), command.parameters[0]);
  516.             } else if (command.code === 408) {
  517.                 ICF.Events.ProcessComment(page, this.event(), command.parameters[0]);
  518.             }
  519.         }
  520.     }
  521.     this.refresh();
  522. };
  523.  
  524. ICF.Events.meetsConditions = Game_Event.prototype.meetsConditions;
  525. Game_Event.prototype.meetsConditions = function(page) {
  526.     if (page._isDummy) {return false;}
  527.     if (!ICF.Events.meetsConditions.call(this, page)) {return false;}
  528.     if (page._switchs == null) {return true;}
  529.     for (i = 0; i < page._switchs.length; i += 1) {
  530.         if (!$gameSwitches.value(page._switchs[i])) {
  531.             return false;
  532.         }
  533.     }
  534.     for (i = 0; i < page._selfswitchs.length; i += 1) {
  535.         var key = [this._mapId, this._eventId, page._selfswitchs[i]];
  536.         if ($gameSelfSwitches.value(key) !== true) {
  537.             return false;
  538.         }
  539.     }
  540.     for (i = 0; i < page._mapswitchs.length; i += 1) {
  541.         var key = [this._mapId, 0, page._mapswitchs[i]];
  542.         if ($gameSelfSwitches.value(key) !== true) {
  543.             return false;
  544.         }
  545.     }
  546.     for (i = 0; i < page._partyswitchs.length; i += 1) {
  547.         if ($gameParty.selfswitch(page._partyswitchs[i]) !== true) {
  548.             return false;
  549.         }
  550.     }
  551.     for (i = 0; i < page._vars.length; i += 1) {
  552.         if (!ICF.Events.CheckVar(page._vars[i][0], $gameVariables.value(page._vars[i][1]), page._vars[i][2])) {
  553.             return false;
  554.         }
  555.     }
  556.     for (i = 0; i < page._selfvars.length; i += 1) {
  557.         var key = [this._mapId, this._eventId, page._selfvars[i][1]];
  558.         if (!ICF.Events.CheckVar(page._selfvars[i][0], $gameSelfVariables.value(key), page._selfvars[i][2])) {
  559.             return false;
  560.         }
  561.     }
  562.     for (i = 0; i < page._mapvars.length; i += 1) {
  563.         var key = [this._mapId, 0, page._mapvars[i][1]];
  564.         if (!ICF.Events.CheckVar(page._mapvars[i][0], $gameSelfVariables.value(key), page._mapvars[i][2])) {
  565.             return false;
  566.         }
  567.     }
  568.     for (i = 0; i < page._partyvars.length; i += 1) {
  569.         var code = -1;
  570.         if (!!page._partyvars[i][3]) {code = ["min", "max", "avg"].indexOf(page._partyvars[i][3].toLowerCase());}
  571.         if (code == 0) {if (!ICF.Events.CheckVar(page._partyvars[i][0], $gameParty.minselfvariable(page._partyvars[i][1]), page._partyvars[i][2])) {
  572.             return false;}
  573.         } else if (code == 1) {if (!ICF.Events.CheckVar(page._partyvars[i][0], $gameParty.maxselfvariable(page._partyvars[i][1]), page._partyvars[i][2])) {
  574.             return false;}
  575.         } else if (code == 2) {if (!ICF.Events.CheckVar(page._partyvars[i][0], $gameParty.avgselfvariable(page._partyvars[i][1]), page._partyvars[i][2])) {
  576.             return false;}
  577.         } else {if (!ICF.Events.CheckVar(page._partyvars[i][0], $gameParty.selfvariable(page._partyvars[i][1]), page._partyvars[i][2])) {
  578.             return false;}
  579.         }
  580.     }
  581.  
  582.     if (page._customreq.length != "") {
  583.         var result = false;
  584.         try {eval(page._customreq);}
  585.         catch (e) {if(ICF.Param.EventExHalt){throw new Error('Error in custom page condition for event');}}
  586.         return result;
  587.     }
  588.  
  589.     return true;
  590. };
  591.  
  592. Game_Event.prototype.callPage = function(pagename) {
  593.     if (this.event().pagenames[pagename]) $gameMap.interpreter.setupChild(this.event().pagenames[pagename].list, this._eventId);
  594. };
  595.  
  596. Game_Event.prototype.callPageGlobally = function(pagename) {
  597.     if (this.event().pagenames[pagename]) $gameMap.interpreter.setupChild(this.event().pagenames[pagename].list, 0);
  598. };
  599.  
  600. //=============================================================================
  601. // Game_Map
  602. //=============================================================================
  603.  
  604. Game_Map.prototype.interpreter = function() {
  605.     return this._interpreter;
  606. };
  607.  
  608. //=============================================================================
  609. // Game_Interpreter
  610. //=============================================================================
  611.  
  612. ICF.Events.pluginCommand = Game_Interpreter.prototype.pluginCommand;
  613. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  614.     ICF.Events.pluginCommand.call(this, command, args);
  615.     if (command.toLowerCase() == 'CallPage') {
  616.         this.callEventPage(this._mapId, this.eventId(), args[0], this.eventId());
  617.     } else if (command.toLowerCase() == 'CallEventPage') {
  618.         if (args.lenght == 0) return;
  619.         else if (args.lenght == 1) this.callEventPage(this._mapId, args[0], 1, args[0]);
  620.         else if (args.lenght == 2) this.callEventPage(this._mapId, args[0], args[1], args[0]);
  621.         else if (args.lenght == 3 && args[2].toLowerCase() == 'this') this.callEventPage(this._mapId, args[0], args[1], this.eventId());
  622.         else if (args.lenght == 3) this.callEventPage(this._mapId, args[0], args[1], args[2]);
  623.     }
  624. };
  625.  
  626. Game_Interpreter.prototype.callEventPage = function(mapId, eventId, page, source) {
  627.     var event = $gameMap.events[eventId];
  628.     if (!event) return;
  629.     var list = null;
  630.     if (isNaN(Number(page))) {
  631.         list = event.pagenames[page];
  632.     } else {
  633.         list = event.pages[page - 1];
  634.     }
  635.     if (!list) return;
  636.     if (isNaN(Number(source))) source = 0;
  637.     this.setupChild(list, source);
  638. };
  639.  
  640. //=============================================================================
  641. // End of File
  642. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement