【汉化】YEP.162– Advanced Switches & Variables (YEP)

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

1 Download

2 System

3 Yanfly Engine Plugins

4 Introduction

5 Instructions

6 Plugin Commands

7 Examples

8 Changelog


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 302VisitorsMasterarbeit 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!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,039评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,426评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 165,417评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,868评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,892评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,692评论 1 305
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,416评论 3 419
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,326评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,782评论 1 316
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,957评论 3 337
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,102评论 1 350
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,790评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,442评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,996评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,113评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,332评论 3 373
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,044评论 2 355

推荐阅读更多精彩内容