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