Project1

标题: 地图加载这个看不懂 求帮助 [打印本页]

作者: ww74520    时间: 2016-8-9 10:00
标题: 地图加载这个看不懂 求帮助
这个应该从哪里开始复制,设置也不是很懂,插件不懂,求指导



这个插件让你在地图上,加载地图时,将运行一个简单的eval notetag。

介绍

这个插件让你在地图上,加载地图时,将运行一个简单的eval notetag。另外,您也可以设置多达十evals,将每个任何地图加载时运行。请记住,地图加载中发生多次为一个给定的步行通过。每次打开菜单的时间,例如,地图负荷将再次触发。这不应该被用来做一些仅仅是你第一次加载地图,但更多的,你需要在地图上(一般事件设置)的每个重载做的事情。

用法

通过以下notetag添加evals到您的地图:

Map > Notebox > <ON LOAD>code</ON LOAD>

它就是这么简单。你的eval代码现在每次运行的地图加载。另外请注意,“负载”可与“OML”,“地图载入”取代,或“ON地图载入”你的自由裁量权。

这里有几个例子...

<On Load>events.forEach(function(event) {if (event.displayName == "Sneak Thief") event._opacity = 32;});</On Load>



<oml>if (v[123] > 4)$gameTemp.reserveCommonEvent(56);</oml>

在第一个例子,用“贼偷袭”的显示名称的任何事件将在一个非常透明的外观。第二示例运行一个共同的事件,如果一个变量大于4。

支持作者

电子邮件[email protected]



插件

//=============================================================================

// NeMV -地图加载

// NeMV_OnMapLoad.js

//=============================================================================



var Imported = Imported || {};

Imported.NeMV_OnMapLoad = true;



var NeMV = NeMV || {};

NeMV.OML = NeMV.OML || {};



//=============================================================================

/*:

* @plugindesc V1.0.0一个非常简单的插件,它允许你运行JavaScript evals时,地图加载。

* @author Nekoyoubi

*

* @param ---Map Load Evals---

* @default

*

* @param OML Eval 1

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 2

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 3

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 4

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 5

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 6

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 7

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 8

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 9

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @param OML Eval 10

* @desc Set an eval that will be run on every map load.

* Example: if (v[123]>4) $gameTemp.reserveCommonEvent(56);

* @default

*

* @help

* ============================================================================

* Introduction

* ============================================================================

*

* This plugin gives you a simple notetag eval on your maps that will run when

* the map is loaded. Optionally, you can also setup up to ten evals that will

* run each time any map is loaded. Keep in mind that map loading happens many

* times for a given walk-through. Each time you open the menu, for instance,

* the map load will trigger again. This should not be used for doing something

* merely the first time you load a map, but more for things you need to do

* on each reload of the map (typically event settings).

*

* ============================================================================

* Usage

* ============================================================================

*

* Add load evals to your maps via the following notetag:

*

* Map  >  Notebox  >  <ON LOAD>code</ON LOAD>

*

* It's as easy as that. Your eval code will now run everytime that map is

* loaded. Also note that the "ON LOAD" can be replaced with "OML", "MAP LOAD",

* or "ON MAP LOAD" to your discretion.

*

* Here are a couple of examples...

*

* <On Load>

* events.forEach(function(event) {

*   if (event.displayName == "Sneak Thief") event._opacity = 32;

* });

* </On Load>

*

* <oml>

* if (v[123] > 4)

*   $gameTemp.reserveCommonEvent(56);

* </oml>

*

* In the first example, any events with the display name of "Sneak Thief" will

* take on a very transparent appearance. The second example runs a common

* event if a variable is greater than four.

*

* ============================================================================

* Support

* ============================================================================

*

* Should this plugin not work for you for any reason, please notify me by

* creating a GitHub issue, emailing me at lance-at-nekoyoubi.com, or message

* me in any social convention you happen to see me in.

*

* Thanks, and happy loading!

*

* ============================================================================

* Changelog

* ============================================================================

*

* Version 1.0.0:

* - initial plugin

*

*/

//=============================================================================



NeMV.OML.Parameters = PluginManager.parameters('NeMV_OnMapLoad');

NeMV.OML.Param = NeMV.OML.Param || {};



NeMV.OML.Param.Evals = [];

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 1']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 2']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 3']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 4']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 5']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 6']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 7']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 8']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 9']));

NeMV.OML.Param.Evals.push(String(NeMV.OML.Parameters['OML Eval 10']));



NeMV.OML.Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;

Scene_Map.prototype.onMapLoaded = function() {

NeMV.OML.Scene_Map_onMapLoaded.call(this);

NeMV.OML.Param.Evals.forEach(function(ev) {

if (ev !== null && ev.length > 1)

NeMV.OML.evalMapLoad(ev);

});

var omlTag = /<(?:((?:ON)?\s*(?:MAP)?\s*LOAD)|OML)>([\s\S]*)<\/\1>/im;

omlMatch = $dataMap.note.match(omlTag);

if (omlMatch) NeMV.OML.evalMapLoad(omlMatch[2]);

};



NeMV.OML.evalMapLoad = function(code) {

var map = $gameMap;

var s = $gameSwitches._data;

var v = $gameVariables._data;

var events = $gameMap.events();

eval(code);

};




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1