BodyGuards


Author: NLBlackEagle
Created: 2014-04-29T19:41:07-0400
Edited: 2014-07-24T05:16:11-0400
Denizen Version: 0.9.4 (build 1483)
Views: 15
Downloads: 880
Likes: 0


WGET
Description: Script created by: NLBlackEagle
Explaination:

This script adds bodyguards to your server! They will be created when a player joins.
The bodyguard will follow this player, however you can command it to stop or continues following you with right clicking the bodyguard.

This bodyguard script also comes with a announcement script wich will narrate tips as example!

This script does not need any changes in order to work.

Have fun!

#-----------------------------------------------------------Bodyguard Start script-----------------------------------------------------------------------------------------

BodyguardStartScript:
    type: world
    debug: false
    events:
        on player joins:
        - if <player.flag[BodyGuardSpawned]> == null {
          - flag <player> BodyGuardSpawned:true
          - run s@BodyguardSpawn
          - run s@BodyGuardConversationScript
          }
        - if <player.flag[BodyGuardConversation]> == true {
          - run s@Bodyguardconversation101
 
#-------------------------------------------------------------------------------Toggle Announce -------------------------------------------------------------------------     
# This part of the script will toggle BodyGuard Announcements on/off using the /BCON command.
     
Bodyguardflagfalse:
    type: world
    debug: false
    events:
        on BCON command:
        - if <player.flag[BodyGuardConversation]> == null {
          - flag BodyGuardConversation:true
          - narrate " "
          - narrate "<red>Bodyguard Conversations<&co> <green><bold> OFF"
          - narrate " "
          }
          else if <player.flag[BodyGuardConversation]> == true {
          - flag BodyGuardConversation:null
          - narrate " "
          - narrate "<red>Bodyguard Conversations<&co> <green><bold> ON"
          - narrate " "
          }
        - determine FULFILLED
 
 
#-------------------------------------------------------------------------------BodyGuard Creation-------------------------------------------------------------------------
# you may change value's here to your likings but sentry follow seems to be a bit buggy. Make sure if you change this line you change it everywhere else in the script! 
 
 
BodyguardSpawn:
    type: task
    debug: false
    script:
    - create player BodyGuard <player.location> save:BodyGuard"
    - flag player Bodyguard:<entry[BodyGuard].created_npc>
    - ^engage
    - ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
    - ^execute as_server "trait sentry"
    - ^execute as_server "sentry strength 6"
    - ^execute as_server "sentry armor 5"
    - ^execute as_server "sentry equip DIAMOND_SWORD"
    - ^execute as_server "sentry equip IRON_HELMET"
    - ^execute as_server "sentry equip IRON_CHESTPLATE"
    - ^execute as_server "sentry equip IRON_LEGGINGS"
    - ^execute as_server "sentry equip IRON_BOOTS"
    - ^execute as_server "sentry health 20"
    - ^execute as_server "sentry invincible false"
    - ^execute as_server "sentry respawn 60"
    - ^execute as_server "sentry speed 1.2"
    - ^execute as_server "sentry follow 5"
    - ^execute as_server "npc owner <player.name>"
    - ^execute as_server "npc skin knight8"
    - ^execute as_server 'npc assign --set "BodyGuardSpawnAssignment"'
    - ^execute as_server "sentry guard <player.name>"
    - ^disengage
 
 
#-------------------------------------------------------------------------------Removal NPC-------------------------------------------------------------------------
# This part controls the removal of the NPC on server quit
 
 
BodyGuardQuitAssignment:
    type: world
    debug: false
    events:
        on player quits:
        - run s@EraseBodyGuard
        on server start:
        - run s@EraseBodyGuard
 
 
EraseBodyGuard:
    type: task
    debug: false
    script:
    - wait 2
    - remove <player.flag[BodyGuard]>
    - flag <player> BodyGuardSpawned:null
 
 
 
#-------------------------------------------------------------------------------Assignment/Click/Proximity script-------------------------------------------------------------------------------
# this is where the click and proximity events of the bodyguard are handeled.
 
BodyGuardSpawnAssignment:
  type: assignment
  debug: false
  actions:
    on assignment:
    - execute as_npc "sentry follow 5"
    - trigger name:proximity state:true radius:10
    on click:
    - if <npc.owner> != <player> {
      - chat "<yellow>I'm sorry <yellow><player.name><green>, but I'm guarding <yellow><npc.owner><green> so I'm not going to take orders from you."
      }
      else if "<npc.flag[Guarding]>" == "true" {
      - random {
        - ^chat "<yellow>Oh all right <player.name>, I'll wait back here for you."
        - ^chat "<yellow>Don't worry about me, I'll stay back here. Please don't forget about me."
        - ^chat "<yellow>I'll wait around for you..but please don't forget about me."
        - ^chat "<yellow>You want me to hang back? Ok, no problem."
        - ^chat "<yellow>Ok, I'll guard this spot."
        - ^chat "<yellow>I'll stand here and wait until you come get me again."
        }
      - ^execute as_npc "npc sel <npc.id>"
      - ^execute as_npc "sentry guard"
      - ^flag npc "Guarding:false"
      }
      else {
      - random {
        - ^chat "<yellow>Ok, I'm following you."
        - ^chat "<yellow>Great <white><player.name><yellow>, I'm right behind you."
        - ^chat "<yellow>You lead the way boss."
        - ^chat "<yellow>Watching your back. Let's go."
        - ^chat "<yellow>Great, let's go for a walk."
        - ^chat "<yellow>Hope we're going to crush some zombie skulls. Let's move."
        }
      - ^execute as_npc "npc sel <npc.id>"
      - ^execute as_npc "sentry guard <player.name>"
      - ^flag npc "Guarding:true"
      }
  interact scripts:
  - 10 BodyGuardSpawnAssignment1
 
BodyGuardSpawnAssignment1:
  type: interact
  debug: false
  steps:
    1:
      proximity trigger:
        entry:
          script:
          - if <player> == <npc.owner> {
            - execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
            - execute as_server "sentry follow 5"
            }
 
#--------------------------------------------------------------------------------BodyGuard Conversation Script-----------------------------------------------------------
# Place here your announcements!   
 
 
BodyGuardConversationScript:
    type: task
    debug: false
    script:
    - wait 500
    - if <player.flag[BodyGuardConversation]> == null {
      - if <player.is_online> {
        - random {
          - narrate "<green>[BodyGuard] -> You<&co> <yellow> Type /BCON to toggle announcements on/off"
          - narrate "<green>[BodyGuard] -> You<&co> <yellow> Type /BCON to toggle announcements on/off"
          - narrate "<green>[BodyGuard] -> You<&co> <yellow> Type /BCON to toggle announcements on/off"
          }
          }          
# Here some prepared lines for extra announcements!
#
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }
#      - wait 500
#        - if <player.is_online> {
#          - random {
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            - narrate "<green>[BodyGuard] -> You<&co> <yellow>"
#            }
#            }            




Comments
No one has posted a comment! Post one below: