跳至主要內容

建立事件

webapp_banner.jpg

本指南適用於 EliteMobs 10 及以上版本

什麼是自訂事件?

這裡的自訂事件指的是在遊戲中隨機發生的事件,無論是基於玩家動作或具有定時觸發。外掛預載了多個自訂事件,例如炎魔(Balrog)事件、海怪(Kraken)事件與寶藏哥布林(Treasure Goblin)事件,僅舉幾例。

這套系統之所以稱為自訂事件,是因為這些事件不僅可以自訂,還能從零開始建立。以下是一份關於如何建立與自訂你自己的事件的指南。

建立你的自訂事件

自訂事件設定檔應建立於: plugins/EliteMobs/customevents/

檔案必須使用 .yml 格式。檔名(不含 .yml 副檔名)會成為事件識別碼。

範例:my_cool_event.yml 會以 my_cool_event 來引用

通用設定

以下設定可/應同時用於動作事件與定時事件。


isEnabled

設定事件是否啟用。

KeyValuesDefault
isEnabledBooleantrue
範例
isEnabled: true

eventType

設定事件的類型。

KeyValuesDefault
eventTypeDEFAULT / BREAK_BLOCK / FISH / TILL_SOIL / TIMEDnone

請注意,BREAK_BLOCKFISHTILL_SOIL動作事件,而 TIMED定時事件DEFAULT 用於透過其他方式或特殊條件觸發的事件。

範例
eventType: BREAK_BLOCK

bossFilenames

設定將被生成的 BOSS 列表。必填!

KeyValuesDefault
bossFilenamesString Listnone
範例
bossFilenames:
- balrog.yml
- my_event_boss.yml

announcementPriority

設定公告優先度

KeyValuesDefault
announcementPriorityInteger0
範例
announcementPriority: 1

startMessage

設定在事件開始時發送的訊息。

KeyValuesDefault
startMessageStringnone
範例
startMessage: An event has started!

create_events_start_message.jpg


endMessage

設定在事件結束時發送的訊息。

KeyValuesDefault
endMessageStringnone
範例
endMessage: An event has ended!

create_events_end_message.jpg


eventStartCommands

設定在事件開始時執行的指令。

KeyValuesDefault
eventStartCommandsString Listnone
範例
eventStartCommands:
- say The event now starts!!
- "$chance=0.5$ say What a spawn!"

create_events_start_commands.jpg


eventEndCommands

設定在事件結束時執行的指令。

KeyValuesDefault
eventEndCommandsString Listnone
範例
eventEndCommands:
- say The event ends, so sad.
- "$chance=0.5$ say Too slow bud!"

create_events_end_commands.jpg


事件設定範例
isEnabled: true
bossFilenames:
- "cool_boss.yml"
- "other_cool_boss.yml"
announcementPriority: 3
startMessage: "Cool event is starting!"
endMessage: "Cool event is ending!"
eventStartCommands:
- say The event started!
eventEndCommands:
- say The event ended!

完整定時事件範例
isEnabled: true
eventType: TIMED
bossFilenames:
- "my_timed_boss.yml"
announcementPriority: 3
startMessage: "A timed event has started!"
endMessage: "The timed event has ended!"
eventStartCommands:
- say The timed event began!
eventEndCommands:
- say The timed event concluded!
spawnType: "my_spawn_location.yml"
localCooldown: 120
globalCooldown: 30
weight: 100
eventDuration: 15
endEventWithBossDeath: true
minimumPlayerCount: 1

動作事件

在特定動作(例如破壞方塊或釣魚)發生時有機率執行的事件。

註:動作事件會自動套用每位玩家的冷卻時間,以防止同一位玩家反覆觸發事件。冷卻時間預設為 4 分鐘,可透過 events.yml 中的 actionEventMinimumCooldownMinutes 設定。

chance

設定當動作發生時,事件發生的機率。

KeyValuesDefault
chance0.01.0 之間的數值0
範例
chance: 0.001

breakableMaterials

設定當動作設為 BREAK_BLOCK 時要檢查的材質列表。

KeyValuesDefault
breakableMaterials材質列表none
範例
breakableMaterials:
- BEEHIVE
- BIRCH_WOOD

設定範例
chance: 0.001
breakableMaterials:
- COAL_ORE

設定在破壞煤礦石方塊時有 0.1% 的機率執行事件,前提是事件類型為 BREAK_BLOCK


完整動作事件範例
isEnabled: true
eventType: BREAK_BLOCK
bossFilenames:
- "mining_boss.yml"
announcementPriority: 2
startMessage: "You've awakened something..."
chance: 0.001
breakableMaterials:
- DIAMOND_ORE
- EMERALD_ORE

定時事件

定時事件是在可設定的時間間隔發生的事件。一旦某個定時事件的冷卻結束,系統會根據事件的權重,從定時事件列表中隨機挑選一個定時事件。

spawnType

設定事件所使用的自訂生成,它定義了 BOSS 可以生成的位置。

KeyValuesDefault
spawnTypeFilenamenone
範例
spawnType: nether_spawn.yml

localCooldown

設定此事件再次被挑選之前的時間量(以分鐘計)。

KeyValuesDefault
localCooldownDouble0
範例
localCooldown: 120

globalCooldown

設定下一個事件被挑選之前的時間量(以分鐘計)。

KeyValuesDefault
globalCooldownDouble0
範例
globalCooldown: 60

weight

設定事件的權重,影響它被挑選的機率相對於其他事件的高低。建議值:100

權重系統決定事件被選中的相對機率。例如:

  • 權重 100 的事件 A 對上權重 50 的事件 B = 事件 A 被選中的可能性是兩倍
  • 權重越高 = 被挑選的機率越高
  • 定時事件排程器會在伺服器啟動後約 5 分鐘開始,接著每分鐘檢查一次全域冷卻是否已過、是否可以挑選事件
KeyValuesDefault
weightDouble0
範例
weight: 60.5

eventDuration

設定事件的最大持續時間(以分鐘計)。

KeyValuesDefault
eventDurationDouble0
範例
eventDuration: 30

endEventWithBossDeath

設定事件是否隨 BOSS 死亡而結束。

KeyValuesDefault
endEventWithBossDeathBooleantrue
範例
endEventWithBossDeath: true

eventEndTime

設定事件結束時的遊戲內時間(以刻 ticks 計)。使用 Minecraft 的時間系統,其中 0=黎明、6000=正午、12000=黃昏、18000=午夜、23000=深夜。設為 -1 可停用基於時間的結束。

KeyValuesDefault
eventEndTimeInteger(0-24000,-1 為停用)-1
範例
eventEndTime: 23000

minimumPlayerCount

設定事件開始前所需的最低線上玩家數。

KeyValuesDefault
minimumPlayerCountInteger1
範例
minimumPlayerCount: 5

請注意,事件會被排入佇列,意思是它們只會在 spawnType 中定義的條件被滿足後才開始。

事件設定範例
isEnabled: true
bossFilenames:
- "cool_boss.yml"
- "other_cool_boss.yml"
announcementPriority: 3
startMessage: "Cool event is starting!"
endMessage: "Cool event is ending!"
eventStartCommands:
- say The event started!
eventEndCommands:
- say The event ended!
spawnType: "myCoolSpawn.yml"
localCooldown: 30
globalCooldown: 15
weight: 100
eventDuration: 20
endEventWithBossDeath: true
eventEndTime: 10000
minimumPlayerCount: 5