我的世度系動函世界函數(shù)系統(tǒng)與進度系統(tǒng)的聯(lián)動怎么樣呢?下面99小編就給大家?guī)砦业氖澜绾瘮?shù)系統(tǒng)于進度系統(tǒng)的聯(lián)動,函數(shù)系統(tǒng)的界函基礎(chǔ)基礎(chǔ)使用攻略。

函數(shù)系統(tǒng)與進度系統(tǒng)的聯(lián)動
advancement,亦簡稱adv,統(tǒng)進統(tǒng)聯(lián)統(tǒng)目前wiki翻譯叫進度。攻略這里就不多作介紹了。世度系動函在17w17b中MOJANG允許進度返回指令作為達成進度的界函基礎(chǔ)獎勵,讓不少玩家發(fā)現(xiàn)了新大陸。數(shù)系數(shù)系使用隨后在17w18b中,統(tǒng)進統(tǒng)聯(lián)統(tǒng)MOJANG進一步完善進度系統(tǒng),攻略使其可以完全獨立于命令方塊而建立起一個命令系統(tǒng);在1.12 pre1中,世度系動函MOJANG又作出了修改,界函基礎(chǔ)將進度系統(tǒng)中的數(shù)系數(shù)系使用珠海美女約炮(電話微信180-4582-8235)大保健可上門安排外圍外圍上門外圍女桑拿全套按摩命令部分拿出來做成了如今的函數(shù)系統(tǒng)。
但是統(tǒng)進統(tǒng)聯(lián)統(tǒng)這并不意味著進度系統(tǒng)就不可以參與到命令系統(tǒng)中來,因為如今的攻略進度系統(tǒng)可以返回函數(shù)作為達成進度的獎勵。
相信很多人已經(jīng)知道進度系統(tǒng)的結(jié)構(gòu)了,但仍有相當(dāng)一部分朋友還沒有了解,在這里我們不妨來溫習(xí)一下。
自定義的進度,所有文件都保存在存檔目錄/data/advancements/下,在這里新建的文件夾同樣都稱為命名空間,命名空間下存放各種進度文件。進度文件使用 json 格式。這里展示一個用于進度命令系統(tǒng)的例子
所涉及的兩個文件分別是data/advancements/system/HelloTitle.json和data/functions/system/HelloTitle.mcfunction,這里進度和函數(shù)都用同樣的命名空間和文件名方便記憶和管理,可以看到函數(shù)文件是 .mcfunction,而進度文件是 .json
system:HelloTitle.json
{
"criteria":{
"custom_name":{
"trigger":"minecraft:tick"
}
},
"rewards":{
"function":"system:hellotitle"
}
}
system:HelloTitle.mcfunction
#revoke adv,用于下次再激活
advancement revoke @s only system:hellotitle
#命令部分
scoreboard objectives add helloTitle stat.leaveGame
scoreboard players tag @s[tag=HelloTitle,score_helloTitle_min=1] remove HelloTitle
tellraw @s[tag=!HelloTitle] ["",{ "text":"Hello ","color":"yellow"},{ "selector":"@s"},{ "text":"! Welcome to Minecraft!","color":"yellow"}]
scoreboard players tag @s[tag=!HelloTitle] add HelloTitle
scoreboard players reset @s[score_helloTitle_min=1] helloTitle
這個進度會在下一個游戲刻達成,對象是全體在線玩家,達成進度后會執(zhí)行HelloTitle.mcfunction中的指令。其實現(xiàn)的效果是,當(dāng)玩家進入這個世界時,會在聊天框看見問候語(其他人看不到)。
可以看到,相比于以前命令方塊高頻,這里采用了進度系統(tǒng)的 tick 觸發(fā)器和@s選擇器。如果單純用命令方塊高頻或者函數(shù)系統(tǒng),那么只需要這樣
scoreboard objectives add helloTitle stat.leaveGame
scoreboard players tag @a[tag=HelloTitle,score_helloTitle_min=1] remove HelloTitle
execute @a[tag=!HelloTitle] ~ ~ ~ tellraw @s ["",{ "text":"Hello ","color":"yellow"},{ "selector":"@s"},{ "text":"! Welcome to Minecraft!","color":"yellow"}]
scoreboard players tag @a[tag=!HelloTitle] add HelloTitle
scoreboard players reset @a[score_helloTitle_min=1] helloTitle
區(qū)別就是選擇器上的不一樣。如果大家覺得進度系統(tǒng)很麻煩,可以不去使用,但是接下來我們會看到一個使用進度系統(tǒng)的其他觸發(fā)器來調(diào)用函數(shù)的例子。例如,要讓所有冒險模式玩家入水即死。
rules:DieInWater.json
{
"criteria":{
"1":{
"trigger":"enter_block",
"condition":{
"block":"water"
}
}
},
"rewards":{
"function":"rules:dieinwater"
}
}
rules:DieInWater.mcfunction
#revoke
advancement revoke @s only rules:dieinwater
#commands
scoreboard players tag @p[m=2,r=0] add waterKill
execute @s[tag=waterKill] ~ ~ ~ tellraw @a [{ "selector":"@s"},{ "color":"white","text":" 被水淹沒了"}]
execute @s[tag=waterKill] ~ ~ ~ gamerule showDeathMessages false
kill @s[tag=waterKill]
execute @s[tag=waterKill] ~ ~ ~ gamerule showDeathMessages true
scoreboard players tag @s[tag=waterKill] remove waterKill
當(dāng)玩家踏入水中時,我們要給玩家加上一個tag,然后殺掉他。至于為什么用@p而不用@s呢?因為@p不能選中死人,而@s可以,如果不想看到聊天框刷屏,就不要選擇用@s。
以上是利用進度系統(tǒng)的 enter_block(玩家進入方塊) 這一觸發(fā)器來實現(xiàn)落水即死功能的,如果單純依靠函數(shù),不依靠進度系統(tǒng)去實現(xiàn)的話,可以這樣寫
rules:DieInWater_FUNCONLY.mcfunction
execute @a[m=2] ~ ~ ~ detect ~ ~ ~ water -1 scoreboard players tag @p[r=0] add waterKill
execute @a[tag=waterKill] ~ ~ ~ tellraw @a [{ "selector":"@s"},{ "color":"white","text":" 被水淹沒了"}]
execute @a[tag=waterKill] ~ ~ ~ gamerule showDeathMessages false
kill @a[tag=waterKill]
execute @a[tag=waterKill] ~ ~ ~ gamerule showDeathMessages true
scoreboard players tag @a[tag=waterKill] remove waterKill
然后將這個函數(shù)扔進主進程中高頻執(zhí)行即可。
我們講完了函數(shù)系統(tǒng)與進度系統(tǒng)的聯(lián)動部分。道理而言已經(jīng)講完了函數(shù)系統(tǒng)的基礎(chǔ)使用,那么在最后,我們來聊聊函數(shù)系統(tǒng)與命令方塊系統(tǒng)的對比吧,看看它們各自的優(yōu)缺點。




.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)



