BodyguardWS:
type: world
debug: false
events:
on player join:
- if <player.has_flag[bodyguard]> {
- inject locally BodyguardRes
}
BodyguardRes:
- wait 1s
- teleport <player.flag[BodyGuard]> location:<player.location>
- flag <player.flag[BodyGuard]> "guarding:true"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "sentry guard <player.name>"
BodyguardSalesMan:
type: assignment
debug: false
default constants:
BodyguardCost: 20
BodyGuardRespawnCost: 2000
BodyGuardInstant: 20000
interact scripts:
- 10 BgSalesMan
BgSalesMan:
type: interact
steps:
1:
click trigger:
script:
- if <player.has_flag[Bodyguard]> {
- narrate "<green><npc.name>:<gold> You already have a bodyguard, Come back if he dies."
} else {
- narrate "<green><npc.name>:<gold> Hello <player.name> Welcome to my shop."
- wait 1
- narrate "<green><npc.name>:<gold> As of this moment i only have three types of bodyguard available."
- wait 1
- narrate "<green><npc.name>:<gold> Would you like to hire a <green>normal<gold> bodyguard for $<npc.constant[BodyguardCost]>?"
- wait 1
- narrate "<green><npc.name>:<gold> Or would you like one that <green>respawns<gold> for $<npc.constant[BodyGuardRespawnCost]> or one that respawns <green>instantly<gold> for $<npc.constant[BodyGuardInstant]>?"
}
chat trigger:
1:
trigger: <gold>I am interested in purchasing a /normal/ bodyguard.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardCost]>."
- if <player.money> < <npc.constant[BodyguardCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardCost]>
- flag player Bodyguard2
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn -1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc assignment --set BgInteractions"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- ^flag <player.flag[BodyGuard]> "guarding:true"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardCost]>"
- narrate "<green><npc.name>:<gold> He is yours untill he dies, be safe out there."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
2:
trigger: <gold>I am interested in purchasing a bodyguard that /respawns/.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardRespawnCost]>."
- if <player.money> < <npc.constant[BodyguardRespawnCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardRespawnCost]>
- flag player Bodyguard3
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 300"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc assignment --set BgInteractions"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardRespawnCost]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn after 5 minutes if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
3:
trigger: <gold>I am interested in purchasing a bodyguard that /instantly/ respawns.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyGuardInstant]>."
- if <player.money> < <npc.constant[BodyGuardInstant]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyGuardInstant]>
- flag player Bodyguard3
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry armor 2"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 5"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc assignment --set BgInteractions"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyGuardInstant]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn right away if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
4:
trigger: <gold>/No/, I dont want a bodyguard right now
script:
- engage
- random {
- narrate "<green><npc.name>:<gold> Alright come back if you change your mind."
- narrate "<green><npc.name>:<gold> You know where to find me if you get yourself in over your head"
}
- disengage
BodyguardAssignment:
type: assignment
- debug: true
+ debug: false
interact scripts:
- 10 BgInteractions
actions:
on death:
- if player.flag[Bodyguard1] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- flag player Bodyguard:!
- flag player Bodyguard1:!
- flag npc guarding:!
} elseif player.flag[Bodyguard2] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- wait 300s
- teleport npc location:<npc.owner.location>
} else player.flag[Bodyguard3] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- wait 1s
- teleport npc location:<npc.owner.location>
}
BgInteractions:
type: interact
steps:
1:
click trigger:
script:
- if <npc.owner> != <player> {
- narrate "<green><npc.name>:<gold> Im sorry im not your bodyguard."
- } else if {
+ } else {
- narrate "<green><npc.name>:<gold> What would you like me to do?"
- wait 1
- narrate "<green><npc.name>:<gold> <red>Stand <gold>Guard, <red>Follow <gold> You?"
+ - ^zap step:2
+ }
+ 2:
chat trigger:
1:
trigger: <gold>/Follow/ me.
script:
- narrate "<green><npc.name>:<gold> Alright i will follow you"
- ^execute as_npc "npc sel <npc.id>"
- ^execute as_npc "sentry guard <player.name>"
- ^flag npc "guarding:true"
+ - zap step:1
2:
trigger: <gold>/Stand/ here.
script:
- narrate "<green><npc.name>:<gold> I will guard this spot, talk to me again if you wish for me to follow you again."
- ^execute as_npc "npc sel <npc.id>"
- ^execute as_npc "sentry guard"
- ^flag npc "Guarding:false"
+ - zap step:1
-
BodyguardSword:
type: item
material: DIAMOND_SWORD
enchantments:
- KNOCKBACK:2
-
-