Paste #41402: Untitled Paste

Date: 2017/04/17 15:49:29 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


quest:
  type: assignment
  interact scripts:
    - 1 Kill Quest
  default constants:
    npc_amount: 5
    npc_target: 'zombies'
    quest_cooldown: 3600
  actions:
    on assignment:
      - trigger name:click toggle:true cooldown:0s
      - trigger name:chat toggle:true radius:5

"Kill Quest":
  type: interact
  steps:
    1:
      click trigger:
        script:
          - run "Clicked NPC"
    2:
      chat trigger:
        1:
          trigger: /Si/, deseo aceptar tu aventura!
          script:
            - run "Accepted Quest"
        2:
          trigger: /No/, no tengo tiempo ahora.
          script:
            - run "Declined Quest"
        3:
          trigger: /REGEX:.+/
          script:
            - narrate "<&c><&o>Respuesta Invalida, por favor intentalo de nuevo."
      click trigger:
        script:
          - zap "s@Kill_Quest" step:1

"Clicked NPC":
  type: task
  speed: 0
  script:
    - if <player.has_flag[cooldown_click]> queue clear
    - flag player cooldown_click duration:5s
    - if <player.has_flag[kill_cooldown]> {
      - narrate format:cchat "Puedes repetir esta quest en <player.flag[kill_cooldown].expiration.formatted>"
      - queue clear
      }
    - if <player.has_flag[kill_count]> {
      - if <player.flag[kill_count]> < <npc.constant[npc_amount]> {
        - narrate format:cchat "No has terminado la quest. Has matado <player.flag[kill_count].as_int> <npc.constant[npc_target]>, te falta matar <math.as_int:<npc.constant[npc_amount]>-<player.flag[kill_count]>>."
        - queue clear
        }
      - if <player.flag[kill_count]> == <npc.constant[npc_amount]> {
        - run "Complete Quest"
        - queue clear
        }
      }
    - narrate format:cchat "Buenos dias, te gustaria ganar un premio?"
    - wait 10t
    - narrate format:cchat "Si estas de acuerdo, necesito que mates a <npc.constant[npc_amount]> <npc.constant[npc_target]> para mi"
    - wait 10t
    - narrate format:cchat "Deseas aceptar la aventura?"
    - wait 10t
    - execute as_server 'tellraw <player.name> ["",{"text":"["},{"text":"Si","color":"green","bold":true,"italic":true,"clickEvent":{"action":"run_command","value":"si"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Me gustaria ayudarte","color":"green"}]}}},{"text":"/","color":"none","bold":false,"italic":false},{"text":"No","color":"red","bold":true,"italic":true,"clickEvent":{"action":"run_command","value":"no"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"No tengo tiempo actualmente","color":"red"}]}}},{"text":"]","color":"none","bold":false,"italic":false}]'
    - zap "s@Kill Quest" step:2

"Accepted Quest":
  type: task
  script:
    - narrate format:cchat "Genial!"
    - narrate "[<&c>Mata <npc.constant[npc_amount]> <npc.constant[npc_target]><&f>]"
    - flag player quest_started
    - flag player kill_count:0

"Declined Quest":
  type: task
  script:
    - random {
      - narrate format:cchat "Que lastima!"
      - narrate format:cchat "Si cambias de opinion, puedes volver a hablarme"
      - narrate format:cchat "Aqui estare si deseas ayudarme"
      }
    - zap "s@Kill Quest" step:1

"Complete Quest":
  type: task
  script:
    - narrate format:cchat "Buen trabajo! Has terminado la aventura. Toma tu recompensa"
    - give i@diamond
    - flag player kill_count:!
    - flag player kill_cooldown duration:<npc.constant[quest_cooldown]>

# Editar el world script
Kill_listener_World:
  type: world
  events:
    # Poner el tipo de NPC que hay que matar
    on player kills zombie:
      - if !<player.has_flag[quest_started]> queue clear
      - flag player kill_count:++
      # Poner la cantidad de NPC que hay que matar
      - if <player.flag[kill_count]> == 5 {
        - narrate "<&c><&o>[Vuelve con el NPC]"
        - flag player quest_started:!
        }

cchat:
  type: format
  format: "<&b><npc.name><&co> <&7><text>"