游客發(fā)表
發(fā)帖時間:2025-11-24 17:44:42
我的世調(diào)用世界1.12版本中,函數(shù)與進度系統(tǒng)的界函教程出現(xiàn),讓命令脫離命令方塊——這句曾經(jīng)說過的數(shù)系湛頭美女約炮(微信181-8279-1445)大保健可上門安排外圍外圍上門外圍女桑拿全套按摩玩笑般的預(yù)言,正式成為可能。模塊命令下面99小編就給大家?guī)砦业墓ヂ允澜绾瘮?shù)系統(tǒng)的模塊調(diào)用攻略。

函數(shù)系統(tǒng)的模塊調(diào)用
對于一個完整的命令系統(tǒng)而言,模塊一般可以分為三類:對執(zhí)行順序先后有要求的函數(shù)高頻模塊、對執(zhí)行順序先后無要求的系統(tǒng)高頻模塊、非高頻模塊。世調(diào)用在函數(shù)系統(tǒng)中,界函教程我們同樣可以將模塊分成這三類。數(shù)系為了方便后續(xù)講解。模塊命令湛頭美女約炮(微信181-8279-1445)大保健可上門安排外圍外圍上門外圍女桑拿全套按摩我們作這樣的攻略設(shè)定:
將 system:_main設(shè)為 glf ,并稱之為主進程或者主時鐘
對于上面講到的版本三類模塊,我們通過三種不同的函數(shù)方式去調(diào)用。
對執(zhí)行順序先后有要求的高頻模塊,在主進程中按照需要的順序排列好來調(diào)用。對執(zhí)行順序先后沒有要求的高頻模塊,在主進程中可以比較隨意放置位置,但是一般不會考慮優(yōu)先執(zhí)行。特別地,如果這個模塊是針對每一個玩家獨立執(zhí)行的,可以使用進度系統(tǒng)中的"tick"觸發(fā)器來調(diào)用,而不需要放在主進程中。僅在特定情況下觸發(fā)的非高頻模塊,在主進程中調(diào)用,但是輔以execute、scoreboard和選擇器參數(shù)去控制其在合適的時候被調(diào)用,這里的選擇器,包括了在1.12 pre-4中新增的if/unless的部分。
非高頻模塊在特定條件下激活,也在很大程度上減少了模塊中大量重復(fù)出現(xiàn)execute的現(xiàn)象,并完全杜絕了超長的Conditional鏈,因為function中并不直接支持Conditional。不直接支持,說明可以間接支持,對吧。我們來看一個例子。
假設(shè)有紅藍兩隊,在開始前考慮到互毆問題不進行分隊,而是采用掛tag的方式。
紅隊以tag=redTeam為標記,藍隊則以tag=blueTeam為標記,準備觀戰(zhàn)的玩家以tag=specTeam為標記
當玩家站在相應(yīng)區(qū)域(紅藍兩隊的所有玩家還需要選擇了職業(yè))添加Ready的標記,視為準備就緒。
如果玩家不在相應(yīng)區(qū)域時就移除Ready的標記。
選擇了職業(yè)的玩家,其記分板項selectClass數(shù)值大于等于1
全部玩家準備就緒后,游戲進入倒計時,倒計時結(jié)束時游戲開始
倒計時未結(jié)束,有玩家脫離準備就緒的狀態(tài),則倒計時中斷
條件比較多,我們先來看看怎么寫這個模塊,再進行分析。在這里,我們準備了一個名為gameStat的aec實體作為標記,所有游戲進程會以tag或者score的形式掛載到該實體上。請看指令部分
execute @p[tag=redTeam,score_selectClass_min=1] ~ ~ ~ execute @p[tag=blueTeam,score_selectClass_min=1] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=gameStat,tag=notGaming] add allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ scoreboard players tag @e[name=gameStat,type=area_effect_cloud,tag=notGaming] remove allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ title @a clear
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ title @a reset
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ scoreboard players reset @s[tag=!allReady] waitTime
scoreboard players add @e[name=gameStat,tag=allReady] waitTime 1
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a times 10 140 10
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"請玩家站在準備區(qū)域不要離開"}]
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a title [{ "color":"yellow","text":"游戲即將開始"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"3"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"2"}]
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"1"}]
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a times 10 30 10
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a title [{ "color":"gold","text":"游戲開始"}]
scoreboard players set @e[name=gameStat,type=area_effect_cloud,score_waitTime_min=100] gameStat 1
scoreboard players reset @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] waitTime
scoreboard players tag @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] remove allReady
execute @e[type=area_effect_cloud,name=gameStat,score_gameStat_min=1,score_gameStat=1] ~ ~ ~ function system:StartGame
接下來我們來慢慢分析。
首先是開始的條件。有紅藍兩隊,那么這兩隊都肯定需要有人,才能夠開始,考慮到同一選擇器中不能重復(fù)使用tag的參數(shù),我們保留了區(qū)分隊伍的參數(shù),而不是區(qū)分是否準備就緒的參數(shù)。因此,第一條指令的意思是,當存在選了職業(yè)并選紅隊的玩家以及選了職業(yè)并選藍隊的玩家,我們給中心實體加上allReady這個標記,以表明可能滿足開始條件。
至于滿足條件嗎?如果有未準備就緒的玩家,就說明不滿足,那我們就讓一個沒有準備就緒的玩家來去掉allReady這個標記好了。
對于3~5行,我們放后面點講。先看后面。滿足開始條件以后,我們會給中心實體加分(使用waitTime這個記分板項),在第一刻加分后出現(xiàn)提示文字提示準備開始,然后進入循環(huán)計時,最后計時滿了,調(diào)用system:startgame這個函數(shù)來開始游戲(這里不是例子的部分,不作說明)。
那么回過頭來看3~5行,這里明顯是打斷的部分。打斷,就是要清掉提示文字、重置計時器。如果此時都還沒有進行過加分,那么我們就不必進行那三條指令,因此可以看到中間有個選擇器里有score_waitTime_min=1的參數(shù)加以限制。
重點來了,我們看到這3條指令前面相當長一串execute是重復(fù)的。因為在以前用cb寫的時候,這里使用了Conditional,而現(xiàn)在函數(shù)不直接支持Conditional,所以用了一大堆execute,但是這里我們可以稍作修改,對不對?請看下面
execute @p[tag=redTeam,score_selectClass_min=1] ~ ~ ~ execute @p[tag=blueTeam,score_selectClass_min=1] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=gameStat,tag=notGaming] add allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ scoreboard players tag @e[name=gameStat,type=area_effect_cloud,tag=notGaming] remove allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ function system:cond_breakstartcount
scoreboard players add @e[name=gameStat,tag=allReady] waitTime 1
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a times 10 140 10
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"請玩家站在準備區(qū)域不要離開"}]
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a title [{ "color":"yellow","text":"游戲即將開始"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"3"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"2"}]
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"1"}]
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a times 10 30 10
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a title [{ "color":"gold","text":"游戲開始"}]
scoreboard players set @e[name=gameStat,type=area_effect_cloud,score_waitTime_min=100] gameStat 1
scoreboard players reset @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] waitTime
scoreboard players tag @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] remove allReady
execute @e[type=area_effect_cloud,name=gameStat,score_gameStat_min=1,score_gameStat=1] ~ ~ ~ function system:StartGame
system:cond_breakstartcount.mcfunction
title @a clear
title @a reset
scoreboard players reset @s waitTime
雖然這個獨立出來的子模塊只有3條指令,但是如果分離出來的是30條而不是3條呢?能夠節(jié)省多少功夫想必不需要解釋了吧?
以上是關(guān)于函數(shù)系統(tǒng)模塊調(diào)用的部分,當中有提到使用進度系統(tǒng)來調(diào)用部分獨立模塊,我們接下來來可以看看函數(shù)系統(tǒng)與進度系統(tǒng)聯(lián)動>>>。
哈爾濱外圍(外圍預(yù)約)外圍價格(微信181-2989-2716)鴛鴦浴水中簫、制服誘惑絲襪
長沙外圍(高端外圍)外圍女(微信181-2989-2716)提供全國及一二線城市外圍模特伴游預(yù)約、空姐、模特、留學生、熟女、白領(lǐng)、老師、優(yōu)質(zhì)資源覆蓋全國
隨機閱讀
熱門排行
友情鏈接