【汉化】YEP.162 – Advanced Switches & Variables (YEP)
没有找到YEP.162 – Advanced Switches & Variables (YEP)的汉化翻译,也可能自己没有找到,所以找到Message Core (YEP) - Yanfly.moe Wiki原文,用软件做了翻译,便于自己学习。也同时分享给喜欢研究的人员。
From Yanfly.moe Wiki
Jump to navigation Jump to search
Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.
Contents
Download
System
This is a plugin created for RPG Maker MV.
For help on how to install plugins, click here.
For help on how to update plugins, click here.
Got errors with your RPG Maker MV plugin? Click here.
这是为 RPG Maker MV 创建的插件。
有关如何安装插件的帮助,请单击此处。
有关如何更新插件的帮助,请单击此处。
您的 RPG Maker MV 插件出现错误?单击此处。
Total: 2 108 302Visitors
Masterarbeit Writer
Yanfly Engine Plugins
This plugin is a part of the Yanfly Engine Plugins library.
该插件是 Yanfly 引擎插件库的一部分。
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)”的开关将返回真值,无论演员 1 是否已学习技能 5。这可用于制作具有“真实视野”的技能,以及如果演员拥有该技能,则使某些事物在地图上可见。
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.
虽然变量可以借助“控制变量”事件中的“脚本”选项轻松插入自己的 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
Plugin Commands are event commands that are used to call upon functions added by a plugin that aren't inherently a part of RPG Maker MV.
插件命令是用于调用插件添加的函数的事件命令,这些函数本身不是 RPG Maker MV 的一部分。
Here is a list of Plugin Command(s) that you may use:
以下是您可以使用的插件命令列表:
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.
* 注意:如果您正在使用战斗引擎核心,那么大多数时候都不需要使用它。
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).
- 这将检查演员 1(在数据库中)是否已学习技能 5(在数据库中)。这可用于某些技能,如“真实视野”,以使某些事件在地图上以不同的方式显示,或使某些事件在战斗中发生(如看穿敌人的伪装)。
Eval: $gameActors.actor(2).isStateAffected(10)
- This will make a check to see if Actor 2 is affected by state 10 (in the database). If the actor is affected by it, then the switch will return true.Otherwise, it will return false.
- 这将检查 Actor 2 是否受到状态 10(在数据库中)的影响。如果 Actor 受其影响,则开关将返回 true。否则,它将返回 false。
Eval: $gameActors.actor(3).isEquipped($dataWeapons[100])
- This will make a check to see if Actor 3 (in the database) has Weapon 100 (in the database) equipped. If it does, then the switch will return true. Otherwise, it will return false.
- 这将检查 Actor 3(在数据库中)是否装备了 Weapon 100(在数据库中)。如果装备了,则开关将返回 true。否则,它将返回 false。
Eval: $gameActors.actor(4).isEquipped($dataArmors[200])
- This will make a check to see if Actor 4 (in the database) has Armor 200 (in the database) equipped. If it does, then the switch will return true.Otherwise, it will return false.
- 这将检查 Actor 4(在数据库中)是否装备了 Armor 200(在数据库中)。如果装备了,则开关将返回 true。否则,它将返回 false。
Eval: $gameActors.actor(5).isDead()
- This will make a check to see if Actor 5 is currently dead. Being dead will require that the actor is afflicted with the death state. If the actor is dead, the switch will return true. Otherwise, it will return false.
- 这将检查 Actor 5 目前是否已死亡。死亡意味着 Actor 处于死亡状态。如果 Actor 已死亡,则开关将返回 true。否则,它将返回 false。
Eval: $gameActors.actor(6).isAlive()
- This will make a check to see if Actor 6 is currently alive. Being alive will require that the actor is not afflicted with the death state. If the actor is alive, the switch will return true. Otherwise, it will return false.
- 这将检查 Actor 6 目前是否还活着。活着意味着 Actor 未处于死亡状态。如果 Actor 还活着,则开关将返回 true。否则,它将返回 false。
Eval: $gameVariables.value(2) < 3
- You know how map event page conditions can only make checks if a variable is only greater than or equal to a value? Well, now you can do the opposite and check if a variable is less than a certain value. The example used above will check if Variable 2 has a value less than 3 (but not equal to).
- 您知道地图事件页面条件如何仅检查变量是否大于或等于某个值吗?好吧,现在您可以做相反的事情并检查变量是否小于某个值。上面使用的示例将检查变量 2 的值是否小于 3(但不等于)。
Eval: $gameSelfSwitches.value([10,20,'A'])
- This will allow an event to use another event's self switch case to determine its condition. The example above checks if Map 10, Event 20's 'A' self switch is turned on.
- 这将允许一个事件使用另一个事件的自开关情况来确定其条件。上面的示例检查地图 10、事件 20 的“A”自开关是否打开。
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.
- 这将返回小队队长的演员 ID。这对于某些事件很有用,这些事件可能会根据当时小队队长的不同而产生不同的反应。
Eval: $gameParty.gold()
- This will return the party's exact amount of gold. This can also be used in some event's pages to make bags of gold appear in the player's HQ to show just how rich the player is.
- 这将返回队伍的确切金币数量。这也可以在某些活动页面中使用,使金币袋出现在玩家的总部,以显示玩家的富有程度。
Eval: $gameParty.steps()
- This will return the amount of steps the player has walked. This can be used in ways where a trophy may appear in the player's HQ depending on how many steps the player has walked.
- 这将返回玩家走过的步数。这可以用于根据玩家走过的步数在玩家总部出现奖杯。
Eval: $gameParty.aliveMembers().length
- This will return the number of alive members in the current party. Best if used in battle when trying to make different things happen depending on the number of allies currently alive in battle.
- 这将返回当前队伍中存活成员的数量。最好在战斗中使用,当尝试根据战斗中当前存活盟友的数量来做不同的事情时使用。
Eval: $gameParty.deadMembers().length
- This will return the opposite: the number of dead members in the current party. Also best used in battle when trying to make different things happen depending on the number of allies that are dead in battle.
- 这将返回相反的结果:当前队伍中死亡成员的数量。在战斗中,当尝试根据战斗中死亡的盟友数量来做出不同的事时,这也是最有效的方法。
Eval: $gameParty.highestLevel()
- This will return the party's current highest level member. In battle, this will refer to the active party in action. Outside of battle, it pertains to any of the members in the active party or reserve party.
- 这将返回队伍当前最高等级的成员。在战斗中,这将指行动中的活跃队伍。在战斗之外,它涉及活跃队伍或预备队中的任何成员。
Eval: $gameParty.numItems($dataItems[1])
Eval: $gameParty.numItems($dataWeapons[2])
Eval: $gameParty.numItems($dataArmors[3])
- This will return the actual number of items as the condition instead of whether or not the party has that item. For weapons and armors, this will not include those that are equipped.
- 这将返回物品的实际数量作为条件,而不是队伍是否拥有该物品。对于武器和装甲,这将不包括已装备的物品。
Changelog
Version 1.02:
- Bypass the isDevToolsOpen() error when bad code is inserted into a script call or custom Lunatic Mode code segment due to updating to MV 1.6.1.
- 当由于更新到 MV 1.6.1 而将错误代码插入脚本调用或自定义 Lunatic Mode 代码段时,绕过 isDevToolsOpen() 错误。
Version 1.01:
- Bug fixed to prevent compatibility problems with the Debugger.
- 修复错误以防止与调试器的兼容性问题。
Version 1.00:
- Finished Plugin!