Paste #7521: Untitled Paste

Date: 2014/07/27 17:17:19 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


BodyguardStartScript:
    type: world
    debug: true
    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
          }


Bodyguardflagfalse:
    type: world
    debug: true
    events:
        on bodyguard command:
        - if <player.in_group[Leader]> {
          - flag BodyGuardSpawned:null
          - narrate "Bodyguard Flagg set to Null"
          }
        - determine FULFILLED
        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

#    speed: 0

#   - ^execute as_server "npc create BodyGuard --at '<player.location.add[<1,0,0>]>.formatted.citizens>'"


BodyguardSpawn:
    type: task
    debug: true
    script:
    - create player BodyGuard <player.location.add[1,0,0]> 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 5"
    - ^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 ignore add entity:player"
    - ^execute as_server "sentry healrate 10"
    - ^execute as_server "sentry killdrops false"
    - ^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


#    - ^flag npc <npc.id> Bodyguard
#    - flag global "<npc> Bodyguard:<npc.id>"
#    - flag global <npc.id> Bodyguard
#    - remove "<npc>" "target:<npc.flag[<npc.id> Bodyguard]>"     
#    - trigger name:click state:true

#-------------------------------------------------------------------------------Removal NPC-------------------------------------------------------------------------

BodyGuardQuitAssignment:
    type: world
    debug: true
    events:
        on player quits:
        - run s@EraseBodyGuard
        on server start:
        - run s@EraseBodyGuard


EraseBodyGuard:
    type: task
    debug: true
    script:
    - wait 2
    - remove <player.flag[BodyGuard]>
    - flag <player> BodyGuardSpawned:null


#    /ex narrate "<player.flag[BodyGuard]>"
#    - remove "<npc>" "target:<npc.flag[<npc.id> Bodyguard]>"
#- ^narrate "Congratulations, You have defeated one horde of dragons! But be warned, soon and the event's will start from the beginning." "target:<global.flag[<context.entity> DragonAttacker]>"

#------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bodyguardattackplayerscript:
    type: task
    debug: true
    script:
    - ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
    - ^execute as_server "sentry target add player:<player.name>"
    - wait 3
    - ^execute as_server "sentry target remove player:<player.name>"

BodyGuardSpawnAssignment:
  type: assignment
  debug: true
  actions:
    on damaged:
    - if <context.damager.is_player> {
      - if <context.damager.flag[AttacksBodyGuard]> == true {
        - run s@Bodyguardattackplayerscript as:<context.damager>
        }
        }
        else if <context.damager.is_player> {
        - narrate "Hey! stop that or I<&sq>ll attack you!" "target:<context.damager>"
        - flag <context.damager> AttacksBodyGuard:true duration:10
        }
    on assignment:
    - execute as_npc "sentry follow 5"
    - run s@BodyGuardConversationScript as:<npc.owner>
    - trigger name:proximity state:true radius:10
    on click:
    - execute as_npc "sentry follow 5"
    - if <npc.owner> != <player> {
      - random {
        - chat "<yellow>I<&sq>m sorry <yellow><player.name><green> but I<&sq>m already guading <yellow><npc.owner.name>."
        - chat "<yellow>O, hey! <yellow><player.name><green> I<&sq>m with <yellow><npc.owner.name> on a journey so I<&sq>m afraid I cant help you."
        - chat "<yellow>Greetings <yellow><player.name><green> Do you know <yellow><npc.owner.name>? He<&sq>s a verry nice person."
        }
        }
      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: true
  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"
            }


BodyGuardConversationScript:
    type: task
    debug: true
    script:
    - wait 250
    - if <player.flag[BodyGuardConversation]> == null {
      - if <player.is_online> {
        - chat "Right click me to toggle between guarding/following" 
        - random {
          - chat "Hey, lets go to moria and claim the 50.000 reward!"
          - chat "Hmm I wonder what the /cmd command does, dont you?"
          - chat "If you'll lose me simply reconnect and I'll be back!"
          }
          }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I absolutely love those enderchest on the /spawn, they make life easier!"
            - chat "Herobrine gives me the creeps, lets hope he wont come after us!"
            - chat "Lets search for Diamond Mountains using /tc biome"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I heard Diamond mountains can be found in Custom survival"
            - chat "I heard Diamond mountains apear like 15000 blocks away from x<&co>0 z<&co>0 in Custom Survival"
            - chat "I heard that falling in void takes you to another realm!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Let<&sq>s not build in regular survival since the world often gets destroyed!"
            - chat "Did you heard? People riding dragons! The world gone mad!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Hey, lets go to moria and claim the 50.000 reward!"
          - chat "Hmm I wonder what the /cmd command does, dont you?"
          - chat "If you'll lose me simply reconnect and I'll be back!"
          }
          }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I absolutely love those enderchest on the /spawn, they make life easier!"
            - chat "Herobrine gives me the creeps, lets hope he wont come after us!"
            - chat "Lets search for Diamond Mountains using /tc biome"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I heard Diamond mountains can be found in Custom survival"
            - chat "I heard Diamond mountains apear like 15000 blocks away from x<&co>0 z<&co>0 in Custom Survival"
            - chat "I heard that falling in void takes you to another realm!" targets:<player.name>
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Let<&sq>s not build in regular survival since the world often gets destroyed!"
            - chat "Did you heard? People riding dragons! The world gone mad!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Hey, lets go to moria and claim the 50.000 reward!"
            - chat "Hmm I wonder what the /cmd command does, dont you?"
            - chat "If you'll lose me simply reconnect and I'll be back!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I absolutely love those enderchest on the /spawn, they make life easier!"
            - chat "Herobrine gives me the creeps, lets hope he wont come after us!"
            - chat "Lets search for Diamond Mountains using /tc biome"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I heard Diamond mountains can be found in Custom survival"
            - chat "I heard Diamond mountains apear like 15000 blocks away from x<&co>0 z<&co>0 in Custom Survival"
            - chat "I heard that falling in void takes you to another realm!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Let<&sq>s not build in regular survival since the world often gets destroyed!"
            - chat "Did you heard? People riding dragons! The world gone mad!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Hey, lets go to moria and claim the 50.000 reward!"
            - chat "Hmm I wonder what the /cmd command does, dont you?"
            - chat "If you'll lose me simply reconnect and I'll be back!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I absolutely love those enderchest on the /spawn, they make life easier!"
            - chat "Herobrine gives me the creeps, lets hope he wont come after us!"
            - chat "Lets search for Diamond Mountains using /tc biome"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "I heard Diamond mountains can be found in Custom survival"
            - chat "I heard Diamond mountains apear like 15000 blocks away from x<&co>0 z<&co>0 in Custom Survival"
            - chat "I heard that falling in void takes you to another realm!"
            }
            }
        - wait 500
        - if <player.is_online> && <player.flag[BodyGuardConversation]> == null {
          - random {
            - chat "Let<&sq>s not build in regular survival since the world often gets destroyed!"
            - chat "Did you heard? People riding dragons! The world gone mad!"
            }
            }
            }