BodyguardWS: type: world debug: false events: on player join: - if { - inject locally BodyguardRes } on player quits: - if { - ^execute as_server "npc sel " - ^execute as_server "trait sentry" - ^execute as_server "npc despawn" } BodyguardRes: - if { - wait 1s - ^execute as_server "npc spawn " - ^execute as_server "npc sel " - ^execute as_server "trait sentry" - teleport location: - flag "guarding:true" - ^execute as_ "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 "sentry guard " - ^flag "guarding:true" } else if " - ^execute as_server "npc sel " - ^execute as_server "trait sentry" - ^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 "sentry guard " - flag "guarding:true" } else " - ^execute as_server "npc sel " - ^execute as_server "trait sentry" - ^execute as_server "sentry armor 2" - ^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 "sentry guard " - flag "guarding:true" } 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 Bodyguard1 - 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 owner " - ^execute as_server "sentry guard " - ^flag "guarding:true" - narrate "You give $" - narrate ": He is yours untill he dies, be safe out there." - wait 1 - narrate ": Right click on him to enter order mode" - 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 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 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 owner " - ^execute as_server "sentry guard " - flag "guarding:true" - narrate "You give $" - narrate ": Your bodyguard will respawn after 5 minutes if it dies." - wait 1 - narrate ": Right click on him to enter order mode" - 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 sel " - ^spawn - ^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 owner " - ^execute as_server "sentry guard " - flag "guarding:true" - narrate "You give $" - narrate ": Your bodyguard will respawn right away if it dies." - wait 1 - narrate ": Right click on him to enter order mode" - 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?" - narrate ": Stand Guard, Follow You, Change Equipment, Rename or Reskin?" - narrate ": Right click me again to cancel" - narrate "Entering Order Mode." - ^zap step:2 } 2: click trigger: script: - narrate "Exiting Order Mode." - zap step:1 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" - narrate "Exiting Order Mode." - 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" - narrate "Exiting Order Mode." - zap step:1 3: trigger: Id like to /Rename/ you. script: - narrate ": Alright what would you like to rename me as?" - narrate "Exiting Order Mode and Opening Rename Mode" - zap step:3 4: trigger: I want to change your /Reskin/ script: - narrate ": Alright what would you like to change my skin to?" - narrate "Exiting Order Mode and Opening Reskin Mode" - zap step:4 5: trigger: I want to change your /Equipment/. script: - narrate ": Keep in mind if you dont have a respawning bodyguard equipment will be lost on its death" - execute as_op "npc sel " - execute as_op "npc equip" - narrate "Equip Mode will end in 30 seconds." - wait 30 - execute as_op "npc equip" - zap step:1 3: chat trigger: 1: trigger: I want your new name to be /regex:.+/. script: - execute as_server "npc sel " - execute as_server "npc rename " - narrate "Exiting Rename Mode." - zap step:1 4: chat trigger: 1: trigger: I want you to take the skin of /regex:.+/. script: - execute as_server "npc sel " - execute as_server "npc skin " - narrate "Exiting Reskin Mode." - zap step:1 BodyguardSword: type: item material: DIAMOND_SWORD enchantments: - KNOCKBACK:2