Paste #5383: Edit of P#5380 - Quest

Date: 2014/06/18 14:42:42 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


HorseRetrieveQuest:
    Type: assignment
    Actions:
        on assignment:
        - trigger name: chat toggle:true
        - trigger name: click toggle:true
        - lookclose state:true
    interact scripts:
    - 1 RancherMain

RancherMain:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - narrate "<&lb><red><npc.name><white><&rb><&co> Hello <player.name>, I could really use some help."
                - wait 1
                - narrate "<&lb><red><npc.name><white><&rb><&co> I really need a new horse"
                - wait 1
                - narrate "<&lb><red><npc.name><white><&rb><&co> Could you help me out?"
                - narrate "<dark_gray><&lb>Hint <&co> Yes to accept the quest, No to decline.<&rb>"
            chat trigger:
                1:
                    trigger: /Yes/, I can help you out!
                    script:
                    - narrate "<&lb><red><npc.name><white><&rb><&co> Great! Bring me a horse on a lead."
                    - wait 1
                    - give i@LEASH qty:1
                    - narrate "<&lb><red><npc.name><white><&rb><&co> Come back when you find one!"
                    - zap step:2
                2:
                    trigger: /No/, I am too busy.
                    script:
                    - narrate "<&lb><red><npc.name><white><&rb><&co> Oh, ok. Please come back whenever you have more time!"
        2:
            click trigger:
                script:
                - if <player.location.find.entities[HORSE].within[6].size> >= 1 {
                  - foreach <player.location.find.entities[HORSE].within[6]> {
                    - if <%value%.get_leash_holder> == <player> {
                      - run s@HorseReturn delay:1 def:%value%
                      }
                    }    
                  } else {
                  - narrate "<&lb><red><npc.name><white><&rb><&co> What are you waiting for? Lets go get some horses <player.name>!"
                  - wait 1
                  - narrate "<&lb><red><npc.name><white><&rb><&co> I really need a new horse!"
                  }
        3:
            click trigger:
                script:
                - narrate "<&lb><red><npc.name><white><&rb><&co> Thank you so much for helping me out!"


HorseReturn:
            type: task
            script:
            - narrate "<&lb><red><npc.name><white><&rb><&co> Great, a new horse!"
            - wait 2
            - narrate "<&lb><red><npc.name><white><&rb><&co> Hold on, let me put a post in the ground real quick!"
            - animate <npc> animation:ARM_SWING
            - modifyblock l@-395,72,76,ST m@fence
            - leash %1% holder:l@-395,72,76,ST m@fence
            - wait 1
            - narrate "<&lb><red><npc.name><white><&rb><&co> Thank you, this will make my job so much easier!"
            - wait 2
            - narrate "<&lb><red><npc.name><white><&rb><&co> Take this for helping me out!"
            - wait 1
            - give i@apple qty:10
            - give i@emerald qty:5
            - give xp qty:100
            - zap s@RancherMain step:3
            - run s@HorseCleanup delay:10
            - if <player.inventory.contains[LEASH].qty[1]> {
              - ^take LEASH qty:1 
              }
HorseCleanup:
    type: task
    script:
    - remove <npc.location.find.entities[HORSE].within[5]>
    - modifyblock l@-395,72,76,ST m@air

RancherCleanupWorld:
    type: world
    events:
        on server start:
        - if <l@-395,72,76,ST.material> == m@fence {
          - modifyblock l@-395,72,76,ST m@air
          }