# Written by Mwthorn # # Credits for the original Bodyguards goes to Cromis # You can find that script here: http://mcmonkey.org/denizen/repo/entry/34 # # This version currently only has 1 bodyguard available. But this bodyguard have a "easier" way to give commands to. # # Chest Guard is basically a bodyguard system (like the original). The main differences are that you are using a chest-inventory instead of the chat to give commands and orders to either the shop or your bodyguard(s). # This version for now allows you to have infinite bodyguards (which may be a problem for some servers) unless you change the price to a higher value. # # REQUIREMENTS: # - All players MUST have the permission: citizens.npc.select # (I'll try to fix this requirement if possible in the future) # (If this permission is not added. No orders will function) # # Though my version has its pros and cons... I basically wanted to use chest-inventory instead of using chat to send commands to a bodyguard (same goes with the shop) # # Command to setup the shop: # /npc assignment --set ChestGuardMain # # Version 1.0 (First Release) ChestGuardEvents: type: world debug: false events: on server starts: - execute as_server "denizen reload -a" on reload scripts: - flag server ChestGuardCost1:5000 # Shop Menu on player clicks ChestGuardBuy1 in ChestGuardShop: - if < { - narrate "You do not have enough money." } else { - take money qty: - ^execute as_server "npc create &aBodyGuard --at :::world" - ^execute as_server "trait sentry" - ^execute as_server "sentry equip STONE_SWORD" - ^execute as_server "sentry equip LEATHER_HELMET" - ^execute as_server "sentry equip LEATHER_CHESTPLATE" - ^execute as_server "sentry equip LEATHER_LEGGINGS" - ^execute as_server "sentry equip LEATHER_BOOTS" - ^execute as_server "sentry respawn 120" - ^execute as_server "sentry follow 3" - ^execute as_server "sentry speed 1.5" - ^execute as_server "sentry healrate 10" - ^execute as_server "sentry health 20" - ^execute as_server "sentry strength 5" - ^execute as_server "sentry range 10" - ^execute as_server "sentry target add entity:monster" - ^execute as_server "sentry target add entity:slime" - ^execute as_server "npc assignment --set ChestGuardBody1" - ^execute as_server "npc owner " - ^execute as_server "sentry guard " - ^narrate "You have succesfully purchased a bodyguard!" } - determine cancelled on player clicks ChestGuardBuy2 in ChestGuardShop: - ^determine cancelled on player clicks ChestGuardBuy3 in ChestGuardShop: - ^determine cancelled on player clicks ChestGuardClose in ChestGuardShop: - inventory close d: - ^determine cancelled # Guard Menu on player clicks ChestGuardFollow in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "sentry guard " - ^execute as_server "sentry follow 2" - ^execute as_server "sentry speed 1.4" - ^execute as_server "npc speed 1.4" - ^narrate "The Guard is now following you." - ^inventory close d: - ^determine cancelled on player clicks ChestGuardStand in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "sentry guard" - ^execute as_server "sentry spawn" - ^narrate "The Guard will now stay at its current position." - ^inventory close d: - ^determine cancelled on player clicks ChestGuardBow in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "sentry equip bow" - ^execute as_server "sentry attackrate 1.5" - ^execute as_server "sentry strength 4" - ^execute as_server "sentry range 25" - ^narrate "The Guard will now use a bow." - ^inventory close d: - ^determine cancelled on player clicks ChestGuardSword in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "sentry equip STONE_SWORD" - ^execute as_server "sentry strength 5" - ^execute as_server "sentry range 10" - ^narrate "The Guard will now use a sword." - ^inventory close d: - ^determine cancelled on player clicks ChestGuardRefresh in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "sentry equip STONE_SWORD" - ^execute as_server "sentry equip LEATHER_HELMET" - ^execute as_server "sentry equip LEATHER_CHESTPLATE" - ^execute as_server "sentry equip LEATHER_LEGGINGS" - ^execute as_server "sentry equip LEATHER_BOOTS" - ^execute as_server "sentry respawn 120" - ^execute as_server "sentry follow 3" - ^execute as_server "sentry speed 1.5" - ^execute as_server "sentry healrate 10" - ^execute as_server "sentry health 20" - ^execute as_server "sentry strength 5" - ^execute as_server "sentry range 10" - ^execute as_server "sentry target add entity:monster" - ^execute as_server "sentry target add entity:slime" - ^execute as_server "npc assignment --set ChestGuardBody1" - ^execute as_server "sentry guard " - ^narrate "Guard succesfully updated!" - ^inventory close d: - ^determine cancelled ## Flag npc ?? # - if == true { # - ^flag player.selected_npc "Guarding:false" # - ^execute as_server "sentry guard" # - ^execute as_server "sentry spawn" # - ^narrate "The Guard will now stay at its current position." # } else { # - ^flag player.selected_npc "Guarding:true" # - ^execute as_server "sentry guard " # - ^narrate "The Guard is now following you." # } ## on player clicks ChestGuardConfirmYes in ChestGuardMenu: - execute as_player "npc select" - ^execute as_server "npc select " - ^execute as_server "npc remove" - take money qty: - ^narrate "The Guard will now use a sword." - ^inventory close d: - ^determine cancelled on player clicks ChestGuardClose in ChestGuardShop: - inventory close d: - ^determine cancelled on player clicks ChestGuardClose in ChestGuardMenu: - inventory close d: - ^determine cancelled ChestGuardMain: type: assignment debug: false interact scripts: - 10 ChestGuardSales ChestGuardSales: type: interact steps: 1: click trigger: script: - ^narrate ": Hello Welcome to my shop." - ^inventory open d:in@ChestGuardShop ChestGuardBody1: type: assignment debug: false interact scripts: - 10 ChestGuardOrders ChestGuardOrders: type: interact steps: 1: click trigger: script: - ^if != { - ^narrate "Sorry. I'm not your owner." } else { - ^narrate "What would you like me to do?" - ^inventory open d:in@ChestGuardMenu } ChestGuardShop: type: inventory inventory: CHEST title: Bodyguard Shop Menu size: 9 definitions: Weak: i@ChestGuardBuy1 Medium: i@ChestGuardBuy2 Heavy: i@ChestGuardBuy3 Close: i@ChestGuardClose slots: - "[Weak] [Medium] [Heavy] [] [] [] [] [] [Close]" ChestGuardMenu: type: inventory inventory: CHEST title: Bodyguard Menu size: 9 definitions: Follow: i@ChestGuardFollow Stand: i@ChestGuardStand Close: i@ChestGuardClose Sword: i@ChestGuardSword Remove: i@ChestGuardRemove Update: i@ChestGuardRefresh Bow: i@ChestGuardBow slots: - "[Follow] [Stand] [Sword] [Bow] [] [] [Update] [Remove] [Close]" ChestGuardClose: type: item material: BARRIER display name: Close lore: - Closes the menu. ChestGuardBuy1: type: item material: IRON_INGOT display name: Weak Bodyguard lore: - Costs <&ds> ChestGuardBuy2: type: item material: GOLD_INGOT display name: Comming Soon lore: - Work in progress... ChestGuardBuy3: type: item material: DIAMOND display name: Comming Soon lore: - Work in progress... ChestGuardFollow: type: item material: WOOD_PLATE display name: Follow lore: - Makes the guard follow you. ChestGuardStand: type: item material: STONE_PLATE display name: Hold lore: - Makes the guard stand still. ChestGuardBow: type: item material: BOW display name: Bow lore: - Makes the guard equip a bow. ChestGuardSword: type: item material: STONE_SWORD display name: Sword lore: - Makes the guard equip a sword. ChestGuardRemove: type: item material: PAPER display name: Dismiss lore: - Removes the guard. - Refunds half the price. (<&ds>) ChestGuardRefresh: type: item material: REDSTONE display name: Refresh lore: - Updates your guard.