【汉化】YEP.162 – Advanced Switches

2018-03-04  本文已影响1259人  沧笙

Introduction

For the advanced users out there with JavaScript experience, you can set certain switches and variables to return data about the game through pieces of code on the get go. This can be used for event page conditions, enemy AI conditions, troop page conditions, and more!

对于那些具有JavaScript经验的用户,您可以设置某些开关和变量,通过代码随时返回游戏的数据。包括事件条件,敌方AI条件,敌群条件等。

Instructions

To use this plugin, name the switches or variables that you want to utilize code effects with the following format:
要使用此插件,请使用以下格式命名要使用代码效果的开关或变量

Eval: code

This will make the switch or variable run the piece of code after the ‘Eval:’ marker. The code is used for a switch, it ought to return a ‘true’ or ‘false’ boolean. If the code is used for a variable, it ought to return a numeric value for comparison.

这将在Eval之后运行一段代码。如果代码用于开关,它应该返回一个'true'或'false'布尔值。如果代码用于变量,它应该返回一个数值进行比较。

For example, a switch named ‘Eval: $gameActors.actor(1).isLearnedSkill(5)’, then it will return true if Actor 1 has skill 5 learned or not. This can be used for things like making a skill with ‘True Sight’ and making certain things appear visible on the map if the actor has that skill.

例如,一个名为Eval:$ gameActors.actor(1).isLearnedSkill(5)的开关,如果Actor 1有技能5学习,它将返回true。这可以用于像'真实之眼'这样的技能,如果演员拥有该技能,则可以在地图上显示某些东西。

While variables can insert their own JavaScript code easily thanks to the help of the ‘Script’ option in the Control Variables event, you can save yourself the extra step by just naming a variable ‘Eval: $gameParty.gold()’. This will automatically make it calculate the amount of gold the party has and reference it with the variable.

虽然变量可以通过Control Variables事件中Script选项的帮助轻松插入自己的JavaScript代码,但你也可以通过命名变量Eval:$ gameParty.gold()来简化步骤。这将自动计算队伍金币数量并将其与变量进行比较。

!! WARNING !!

If you are using this as an event’s page condition, keep in mind that any changes made from events on the map will not reflect the changes made to reference those switches immediately. For that, you will have to refresh the map, which can be done using the plugin command below:

如果您将此作为事件页面的条件使用,请记住,由地图上的事件所做的任何更改都不会立即引用这些开关所做的更改。所以,您必须刷新地图使其生效,这可以使用下面的插件命令完成:

Plugin Commands

These plugin commands can be used to immediately refresh a map or troop troop event to ensure that switch/variable data gets noticed and triggered or updated upon your call.

这些插件命令可用于立即刷新地图或队伍事件,以确保在切换开关或变量数据时可以触发或更新。

Plugin Command:

RefreshMap

– This will refresh all of the map’s events. This will update any page conditions with Advanced Switches or Variables that may have changed values prior to using this plugin command. This can only be used outside of battle!
-这将刷新所有地图的事件。这将更新所使用的所有页面条件。这只能在战斗之外使用!

RefreshTroop

– This will refresh the current event interpreter in battle. This will update any page condition within the current troop that utilizes Advanced Switches or Variables that may have changed values prior to using this plugin command.

NOTE: If you are using the Battle Engine Core, using this won’t be necessary for the majority of the time.
注意:如果您使用的是Battle Engine Core,那么在大多数情况下使用它并不是必需的。

Examples

Here are some examples that you can use Advanced Switches and Variables for!

以下是一些示例,您可以使用这个插件做到的事情!

Switches

Eval: $gameActors.actor(1).isLearnedSkill(5)

– This will make a check if Actor 1 (in the database) has learned skill 5 (in the database). This can be used for some skills like ‘True Sight’ to certain events appear differently on the map or certain events happen in battle (like seeing through an enemy’s disguise).

Variables

Eval: $gameParty.leader().actorId()

– This will return the party leader’s actor ID. This can be useful for certain events that may have different reactions depending on who your party leader is at the time.

Happy RPG Making!

上一篇 下一篇

猜你喜欢

热点阅读