请选择 进入手机版 | 继续访问电脑版
查看: 4833|回复: 28

[技巧教程] NWT | 怎么在原版中设置一个密码锁?

[复制链接]

9

主题

76

帖子

36

积分

Lv.2 石器学徒

UID
16335
小麦
8
金锭
150
下界之星
0
发表于 2017-7-2 19:06:30 | 显示全部楼层 |阅读模式
本帖最后由 Julyξ 于 2017-7-5 19:41 编辑

适用于解密地图
相信大家在制作解密过程中,难免会想做一个密码门,让玩家来输入密码来达到某种目的。
QQ截图20170702175931.png QQ截图20170702175937.png QQ截图20170702180013.png
那么,如何制作以上的密码门呢?
(演示所用的是四位密码,密码为:4 5 7 8)
首先,我们创造几个计分板目标
  1. /scoreboard objectives add pw1 trigger
  2. /scoreboard objectives add pw2 trigger
  3. /scoreboard objectives add pw3 trigger /scoreboard objectives add pw4 trigger /scoreboard objectives add pw5 trigger
复制代码
如果不知道trigger如何使用的
NWT丨trigger指令及应用【新人向】
http://mc.netease.com/thread-5384-1-1.html
(出处: 网易我的世界论坛)

(记得给每个目标都enable哦~)
当然,我们enable了以后,还需要进行以下操作(只需执行一次且在游戏开始时执行
  1. /scoreboard players set @a pw1 0
  2. /scoreboard players set @a pw2 0
  3. /scoreboard players set @a pw3 0 、scoreboard players set @a pw4 0/scoreboard players set @a pw5 0
复制代码
当这些目标创建完毕后,我们就要开始写密码的本体了
首先放置一个玩家能够通过任何方法激活的命令方块。
命令方块内设置成:
  1. /tellraw @a [{"text":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n请输入密码","color":"green"},{"text":"   [鼠标单击输入]","color":"gray"},{"text":"\n[1]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"[2]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"[3]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"\n[4]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 4"}},{"text":"[5]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"[6]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"\n[7]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"[8]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"[9]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"\n [Done]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw5 set 1"}}]
复制代码
用这条指令,即可在所有玩家的聊天框中出现一个模拟密码输入啦,当然因为我比较懒,所以没有进行美化,有需要的玩家可以自行美化,也可以作为将此作为书本命令。
因为我们密码的第一位是4,所以1~3,5~9这些数字用鼠标点击后,执行的命令都是把玩家的 pw1 目标设置为1,只有作为正确密码的4,是把玩家的 pw1 目标设置为4.
然后就比较复杂了。先上图。
QQ截图20170702181317.png
我们一个一个来看。
首先,我们需要用高频在1号命令方块下面放置红石块,来让1号和4号命令方块工作
3,5,4,6号命令方块工作的指令与1,4号处理方法相同
  1. /execute @a[score_pw1_min=1] ~ ~ ~ /setblock x y z minecraft:redstone_block
复制代码
【pw1 pw2 pw3 所设置的红石块位置不同,分别对应1,2,3号命令方块下方】
然后1号,2号,3号命令方块的内容,都是一样的:清空玩家的聊天框。

  1. tellraw @a {"text":"\n\n\n\n\n\\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}
复制代码
接下来,1号命令方块(以下简称cb)激活后,4号连锁型命令方块(以下简称ccb)也会激活
首先4号ccb的命令设置
  1. /tellraw @a [{"text":"请输入密码","color":"green"},{"text":"   [鼠标单击输入]","color":"gray"},{"text":"\n[1]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"[2]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"[3]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw1 set 1"}},{"text":"\n[4]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"[5]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 5"}},{"text":"[6]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"\n[7]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"[8]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"[9]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw2 set 1"}},{"text":"\n [Done]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw5 set 1"}}]
复制代码
(你也可以把 1 2 3号cb分别与 4 5 6号ccb里面的指令结合起来,1 2 3号cb的指令在4 5 6号ccb指令之前)
有没有注意到和最初的指令很相似呢?
因为我们密码的第二位是5,所以除了5以外其他所有的数字对应的,都是把目标 pw2 设置为1.而作为正确密码的5是把玩家的pw2目标设置为 5
接下来是5号ccb设置
  1. /tellraw @a [{"text":"请输入密码","color":"green"},{"text":"   [鼠标单击输入]","color":"gray"},{"text":"\n[1]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"[2]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"[3]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"\n[4]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"[5]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"[6]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"\n[7]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 7"}},{"text":"[8]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"[9]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw3 set 1"}},{"text":"\n [Done]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw5 set 1"}}]
复制代码
那么我们第三位密码是7,具体与上面一致,就不多说了.
6号ccb设置
  1. /tellraw @a [{"text":"请输入密码","color":"green"},{"text":"   [鼠标单击输入]","color":"gray"},{"text":"\n[1]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"[2]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"[3]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"\n[4]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"[5]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"[6]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"\n[7]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"[8]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 8"}},{"text":"[9]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw4 set 1"}},{"text":"\n [Done]","color":"green","clickEvent":{"action":"run_command","value":"/trigger pw5 set 1"}}]
复制代码
与之前相同。

那么,大家都有注意到,每个指令最后[Done]这个按钮的设置都没有变,这是为什么呢?
原因是,pw5这个目标是控制密码是否输入完成的
QQ截图20170702184146.png
我们需要同样高频一段指令来让pw5对应的cb能够运作
  1. /execute @a[score_pw5_min=1] ~ ~ ~ /setblock x y z minecraft:redstone_block
复制代码
设置的x y z应该能激活最下面的cb
让我们来分区解读命令
首先是A区
cb的命令是:
  1. /testfor @a[score_pw1_min=4,score_pw1=4,score_pw2_min=5,score_pw2=5,score_pw3_min=7,score_pw3=7,score_pw4_min=8,score_pw4=8]
复制代码
这就是检测玩家有没有输入正确密码,如果正确,则激活上方ccb。上方ccb应该都是条件制约,且命令的排序为从下到上
  1. tellraw @a {"text":"\n\n\n\n\n\\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}
复制代码
这个ccb就是刷屏
  1. /tellraw @a {"text":"密码正确","color":"blue"}
复制代码
提示玩家密码正确
然后A区最上面一个ccb设置的指令就是开门等你想在玩家输入正确密码后做的事情
其次我们来讲B区
B区最下面的ccb不是条件制约,而B区其他的ccb都是条件制约
  1. /testfor @a[score_pw4=1]
复制代码
这个ccb的作用就是探测玩家密码错误的,因为密码输入错误的玩家,如果只输入了1位,或者输错任意一位,那么他的pw4肯定为0或者1,那么可以被探测到错误。随后输出
  1. tellraw @a {"text":"\n\n\n\n\n\\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}
复制代码
同样是刷屏

  1. tellraw @a[score_pw4=1] {"text":"密码错误","color":"red"}
复制代码
密码错误提示
随后是C区,C区所有的ccb都不需要条件制约
  1. /fill x1 y1 z1 x2 y2 z2 air 0 replace redstone_block
复制代码
把之前你放置的红石块清除
然后上面几个就是清空你的分数
  1. /scoreboard players set @a pw1 0
  2. /scoreboard players set @a pw2 0
  3. /scoreboard players set @a pw3 0  /scoreboard players set @a pw4 0 /scoreboard players set @a pw5 0
复制代码
适用于单人解密,只在1.10~1.10.2版本测试,1.9~1.12版本未测试
以上为原版密码
本人短时间内想出来教大家的(水贴)的
如果有da lao 有更好更简单的方法,欢迎更正.如果你实在看不懂我能怎么办我也很绝望啊
By July_Sunset




评分

参与人数 2 金锭 +2 收起 理由
1497673696 + 1 因吹丝汀
籽岷的金粉 + 1 优秀作品

查看全部评分

0

主题

1

帖子

1

积分

Lv.1 新手木匠

UID
16688
小麦
1
金锭
13
下界之星
0
发表于 2017-7-2 19:16:41 | 显示全部楼层
小安前来水一发2333333顺便码这么多字辛苦了

0

主题

2

帖子

1

积分

Lv.1 新手木匠

UID
16732
小麦
0
金锭
6
下界之星
0
发表于 2017-7-2 19:38:53 来自手机 | 显示全部楼层
哇哇哇   好有用啊~

25

主题

3441

帖子

1565

积分

Lv.7 下界居民

UID
3326
小麦
675
金锭
4533
下界之星
0

内测精英勋章

发表于 2017-7-2 19:38:57 | 显示全部楼层
支持一下233话说有没有快捷一点的换密码功能呢233
Love you(づ ̄3 ̄)づ╭Minecraft~~
送小麦不会扣除自己的的小麦哦!快点击下方评分给我送几个小麦吧2333


我才不会告诉你图片可以点的啦
愿世界和平233

3

主题

23

帖子

13

积分

Lv.1 新手木匠

UID
16482
小麦
4
金锭
83
下界之星
0

内测精英勋章

发表于 2017-7-2 19:42:17 | 显示全部楼层
666July大神!膜拜

11

主题

225

帖子

85

积分

Lv.3 矿物能手

UID
7944
小麦
16
金锭
452
下界之星
0
发表于 2017-7-2 19:48:37 | 显示全部楼层
好有用的东西 膜拜大佬
每天茶几上看风景的茶壶。

19

主题

2078

帖子

653

积分

Lv.6 附魔大师

UID
2440
小麦
110
金锭
3
下界之星
0

内测精英勋章问答斯基的方向盘

发表于 2017-7-2 23:59:43 | 显示全部楼层
!  很高级! 命令方块完胜mod
再也不见

38

主题

5411

帖子

2143

积分

玩家版主

UID
8616
小麦
747
金锭
3747
下界之星
0

一周年纪念勋章内测精英勋章

发表于 2017-7-3 00:33:35 来自手机 | 显示全部楼层
厉害了 这种命令

0

主题

3

帖子

2

积分

Lv.1 新手木匠

UID
16996
小麦
1
金锭
20
下界之星
0
发表于 2017-7-3 13:32:44 | 显示全部楼层
拜膜大佬

115

主题

7805

帖子

2517

积分

玩家版主

LV.-9最弱玩家版主

UID
1030
小麦
442
金锭
4289
下界之星
0

内测精英勋章

发表于 2017-7-4 12:27:56 | 显示全部楼层
这东西貌似,特别有用

9

主题

76

帖子

36

积分

Lv.2 石器学徒

UID
16335
小麦
8
金锭
150
下界之星
0
 楼主| 发表于 2017-10-29 16:08:34 | 显示全部楼层
我总觉得没留言是大家都看不懂。。。的确我自己也很难看懂我写了什么,如果真的有需要的话,我把地图放上来。

36

主题

381

帖子

204

积分

Lv.5 农牧专家

UID
16359
小麦
66
金锭
991
下界之星
0
发表于 2017-10-29 16:37:56 | 显示全部楼层

15

主题

693

帖子

204

积分

Lv.5 农牧专家

UID
2714903
小麦
15
金锭
704
下界之星
0
发表于 2017-11-1 14:49:03 来自手机 | 显示全部楼层
这个你可以借助实体啊。通过红石电路和命令方块结合,正确顺序按压四次就可以召唤沙子了,/tfb如果有沙子就激活铁门就好了。不过需要按按钮,不能在聊天框里输入。这样至少会简单一些,换密码的时候直接把方块编号按钮换了就好了。

15

主题

693

帖子

204

积分

Lv.5 农牧专家

UID
2714903
小麦
15
金锭
704
下界之星
0
发表于 2017-11-1 15:58:25 来自手机 | 显示全部楼层
老萌新给你们讲一个相对简单的逻辑:
当玩家按下对应按钮时(为了节省时间,我使用了石头按钮),在左侧空地上会出现对应的沙(包括沙土、砂砾、红沙)。我们在y=7的高度召唤沙子,沙子会落下至y=4的高度。一共有4格高度,玩家每次在三种数字中输入1个,共输入4个。在第二张截图中的命令方块探测对应方块是否正确,选择“条件限制”模式即可。如果四个方块都对,则放置一个红石块激活铁门。
这是一套借助方块的逻辑,当然,为了更高的安全性和美观,需要使用其他指令将输入方法和开门方法加以更改。
当然,如果你想要十个数字的密码组合,需要用逻辑方法。首先,无论你输入几,都在一个固定位置放置一个方块。
接着,加一个testforblock指令,如果已经有了方块,就跳过第一个位置,进行第二个位置。依次类推,设置n个“条件限制”命令方块,和多个红石比较器。最多跳过n-1(n为你的密码的位数)个方块。这样你每次输入就会在对应位置放上方块。可以在第n个位置上设置一个自动检测组合,这样就不用点击确认了。之后如果正确,开门,不正确,清理所有方块。这个工程量会比较大,慢慢做吧![attach]undefined[/attach]

y

y

y

y
[attach]undefined[/attach][attach]undefined[/attach]

11

主题

214

帖子

69

积分

Lv.3 矿物能手

UID
264800
小麦
3
金锭
26
下界之星
0
发表于 2017-11-1 18:27:13 | 显示全部楼层
欢迎收看好帖没人看系列
=跪求小麦=
=不会扣除自身的=
       =谢谢=
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

返回顶部