跳到主要内容

Escort Objective

Escort an NPC along a route

字段

字段类型默认值描述
questRef<QuestEntry>——
displayVar<String>Escort Objective—
maxHealthVar<Double>20.0Maximum health of the escort mob
regenPerSecVar<Double>0.0Health regenerated per second. 0 = no regeneration
damageReductionPctVar<Double>0.0Percent of incoming damage to negate (0-100)
mobHitDamageVar<Double>1.0Amount of health lost each time the escort mob is hit by another mob
invulnerableVar<Boolean>falseIf true the escort mob is completely invulnerable
hurtSoundVar<Sound>EMPTYCustom sound to play when the escort mob takes damage
guardRadiusVar<Double>10.0Radius the player must stay within to keep the escort active
loseToleranceSecVar<Int>5Seconds the player is allowed to exceed the guard radius before failing
globalTimeLimitSecVar<Int>0Time limit in seconds for the whole escort. 0 = unlimited
nodeReachRadiusVar<Double>1.0Distance considered as reaching a waypoint
spawnRadiusVar<Double>40.0Radius around the spawn node to spawn the NPC
startRadiusVar<Double>5.0Distance from the NPC required to start the escort
npcRef<out SimpleEntityInstance>—Existing NPC instance used for the escort visual
ambushesList<AmbushSpec>emptyOptional ambush triggers executed at checkpoints
AmbushSpec(2)
字段类型默认值描述
checkpointIndexInt0—
triggersList<Ref<TriggerableEntry>>empty—
enableScoreboardVar<Boolean>falseIf true, display a scoreboard tracking progress
enableBossBarVar<Boolean>falseIf true, display a bossbar showing escort health
onEscortStartRef<TriggerableEntry>—Trigger executed when the escort starts
onCheckpointRef<TriggerableEntry>—Trigger executed when the escort reaches a waypoint
onEscortLostRef<TriggerableEntry>—Trigger executed when the player leaves the guard radius
onEscortRecoveredRef<TriggerableEntry>—Trigger executed when the player returns within the guard radius
onEscortResetRef<TriggerableEntry>—Trigger executed when the escort resets after being too far or the player dying
onEscortCompleteRef<TriggerableEntry>—Trigger executed when the escort completes successfully
onEscortFailRef<TriggerableEntry>—Trigger executed when the escort fails
hideObjectiveVar<Boolean>falseWhether to hide this objective from the tracking menu (scoreboard/placeholders) unless the quest is tracked.
TypeWriter 通用字段(criteria, children, priorityOverride)
字段类型默认值描述
criteriaList<Criteria>empty—
childrenList<Ref<AudienceEntry>>empty—
priorityOverrideOptional<Int>——

How to use it​

The objective needs a quest, an npc entity instance whose activity is a Path Escort Activity, and the road network nodes listed by that activity. The first node is where the escort starts and the last one is where it ends.

Starting. A player who is in the objective's audience and within startRadius of the first node starts the escort automatically. The NPC appears when the player is within spawnRadius of the first node, and the escort begins when the player comes within startRadius of the NPC. If the player leaves spawnRadius before that, the pending escort is cancelled. You can also start it with the Escort Start action.

NPC protection. maxHealth, regenPerSec (applied each second), damageReductionPct (0 to 100), mobHitDamage (damage taken from each mob hit, replacing the vanilla damage) and invulnerable. hurtSound plays when the NPC is hurt. Players cannot damage the escort NPC.

Keeping the player close. guardRadius is the distance within which the player must stay. After loseToleranceSec seconds outside it, the escort goes back to its last checkpoint. Reaching a node. nodeReachRadius (default 1.0) is the distance, in blocks, at which the NPC counts a node as reached: as soon as it is within this radius of its target node (the limit included), the node is reached, even if the NPC has not finished walking to it or the node's own radius is smaller. Arrival is still decided by the Path Escort Activity, which receives the radius from the objective. 0 or less turns this check off, and arrival then only comes from the end of the walk.

Limits and display. globalTimeLimitSec (0 means no limit) fails the escort when it runs out. enableScoreboard shows health, checkpoint and time as a sidebar, and enableBossBar shows the NPC's health in a boss bar named by display.

Triggers. onEscortStart, onCheckpoint, onEscortLost, onEscortRecovered, onEscortReset, onEscortComplete and onEscortFail. ambushes runs its triggers once when the matching checkpointIndex is reached.

Hiding. With hideObjective on, the objective is hidden from tracking menus unless the player is tracking its quest.

Only one escort can run per player at a time.