Quests.hs
Eleven quests to start a server with, and a menu to take them from. HyperScript counts what players do and keeps it across restarts; this script only says what the quests are, what they give, and how the menu looks.
by HyperScript TeamHyperScript 1.7.64+3 commands269 linesquestsmenuguirewardsdailyweekly
Put the file in plugins/HyperScript/scripts and it is live. Or type /hyperscript install quests on your server.
# ==============================================================
# Quests.hs - quests with a menu that shows how far you are
# ==============================================================
#
# Requires: 1.7.64
# Author: HyperScript Team
# Tags: quests, menu, gui, rewards, daily, weekly
#
# Eleven quests to start a server with, and a menu to take them
# from. HyperScript counts what players do and keeps it across
# restarts; this script only says what the quests are, what
# they give, and how the menu looks.
#
# /quests open the menu: click a quest to start it
# /questtop the ten players who have done the most quests
# /queststop give up the quests you are on
#
# The quests
# - Miner break 50 stone
# - Lumberjack break 30 oak logs
# - Farmer break 40 wheat
# - Builder place 128 blocks of any kind
# - Hunter kill 10 zombies
# - Baker craft 16 bread
# - Fisher catch 10 things with a rod
# - Saver have 1000 coins
# - Daily walk walk 500 blocks, once a day
# - Speed run walk 300 blocks within 2 minutes, once an hour
# - Weekly slayer kill 100 creatures, once a week
#
# Notes
# - To change a quest, change its "goal:" and "reward:". A goal
# is break, place, kill or craft with a number and a name,
# fish 5, walk 500 blocks, reach 1000 {coins} for a
# variable, or do 3 for one your own scripts count with
# "advance quest".
# - To add one, copy a quest block, give it another name, and
# add its name and an item for it in the menu below, on a
# line like the others.
# - Rewards are coins in {%player%.coins}, and a few items. Use
# your own variable if yours is called something else.
# - "repeat: daily" lets a quest be done again each day, and
# "time limit:" gives it an end. Take the line out for a
# quest that is done once, or that may take as long as it
# takes.
# - "max_active" is how many quests a player may be on at once.
# - Whoever finishes a quest hears a sound and sees a title.
# With "announce" everybody is told when somebody has done 5,
# 10, 25, 50 or 100 of them.
# - How many quests a player has done is kept in
# {%player%.quests_done}, for your own scripts to read.
options:
title: "&8Quests"
# How many quests a player may be on at the same time.
max_active: 3
# Tell everybody when somebody has done 5, 10, 25, 50 or 100 quests.
announce: true
reward_miner: 100
reward_lumberjack: 80
reward_farmer: 80
reward_builder: 120
reward_hunter: 150
reward_baker: 60
reward_fisher: 120
reward_walk: 40
reward_speed: 75
reward_slayer: 500
quest "Miner":
goal: break 50 stone
reward:
add {@reward_miner} to {%player%.coins}
send "&a&lQuest done! &7Miner: &6+{@reward_miner} coins"
quest "Lumberjack":
goal: break 30 oak log
reward:
add {@reward_lumberjack} to {%player%.coins}
send "&a&lQuest done! &7Lumberjack: &6+{@reward_lumberjack} coins"
quest "Farmer":
goal: break 40 wheat
reward:
add {@reward_farmer} to {%player%.coins}
give 5 emerald to player
send "&a&lQuest done! &7Farmer: &6+{@reward_farmer} coins &7and 5 emeralds"
quest "Builder":
goal: place 128 any
reward:
add {@reward_builder} to {%player%.coins}
send "&a&lQuest done! &7Builder: &6+{@reward_builder} coins"
quest "Hunter":
goal: kill 10 zombie
reward:
add {@reward_hunter} to {%player%.coins}
send "&a&lQuest done! &7Hunter: &6+{@reward_hunter} coins"
quest "Baker":
goal: craft 16 bread
reward:
add {@reward_baker} to {%player%.coins}
send "&a&lQuest done! &7Baker: &6+{@reward_baker} coins"
quest "Fisher":
goal: fish 10
reward:
add {@reward_fisher} to {%player%.coins}
send "&a&lQuest done! &7Fisher: &6+{@reward_fisher} coins"
# Done when the player's coins get to a thousand; the other quests are how to get there.
quest "Saver":
goal: reach 1000 {coins}
reward:
give 3 diamond to player
send "&a&lQuest done! &7Saver: &b3 diamonds"
quest "Daily walk":
goal: walk 500 blocks
repeat: daily
reward:
add {@reward_walk} to {%player%.coins}
send "&a&lQuest done! &7Daily walk: &6+{@reward_walk} coins. &7Come back tomorrow."
# Against the clock: when the two minutes are up it has to be started again.
quest "Speed run":
goal: walk 300 blocks
time limit: 2 minutes
repeat: 1 hour
reward:
add {@reward_speed} to {%player%.coins}
send "&a&lQuest done! &7Speed run: &6+{@reward_speed} coins. &7Again in an hour."
quest "Weekly slayer":
goal: kill 100 any
repeat: weekly
reward:
add {@reward_slayer} to {%player%.coins}
give 1 golden apple to player
send "&a&lQuest done! &7Weekly slayer: &6+{@reward_slayer} coins &7and a golden apple"
# What a quest's button says under its name: how far the player is, or what to do next.
local function quest_lore({_quest}):
set {_state} to quest state {_quest}
set {_goal} to quest goal {_quest}
if {_state} is "active":
set {_done} to quest progress {_quest}
set {_bar} to bar of {_done} out of {_goal}
return "&7%{_done}% of %{_goal}%|%{_bar}%"
if {_state} is "done":
return "&aDone"
return "&eClick to start|&7Goal: %{_goal}%"
local function quest_clicked({_quest}):
set {_state} to quest state {_quest}
if {_state} is "none":
set {_mine} to active quests
if size of {_mine} >= {@max_active}:
send "&cYou are on {@max_active} quests already. &7Finish one first, or give them up with /queststop."
stop
start quest {_quest}
send "&eQuest started: &f%{_quest}%"
else if {_state} is "active":
send "&7You are already on &f%{_quest}%&7."
else:
send "&7You have done &f%{_quest}%&7."
# What the book in the menu says: how the player is doing altogether.
local function quest_stats():
set {_done} to {%player%.quests_done}
if {_done} is not set:
set {_done} to 0
set {_coins} to {%player%.coins}
if {_coins} is not set:
set {_coins} to 0
set {_mine} to active quests
return "&7Quests done: &f%{_done}%|&7On right now: &f%size of {_mine}% &7of {@max_active}|&7Coins: &6%{_coins}%"
local function quest_top():
send "&6Most quests done"
set {_place} to 0
for each {_name} in top 10 players by {quests_done}:
add 1 to {_place}
send "&e#%{_place}% &f%{_name}% &7- %{%{_name}%.quests_done}%"
if {_place} is 0:
send "&7Nobody has finished a quest yet."
local function quest_give_up():
set {_mine} to active quests
if size of {_mine} is 0:
send "&7You are not on any quest."
stop
for each {_quest} in {_mine}:
stop quest {_quest}
send "&7You gave up &f%size of {_mine}% &7quests. What was counted for them is gone."
command /quests:
description: Open the quest menu
players only:
trigger:
open gui with title {@title} with 5 rows for player:
border with "black_stained_glass_pane"
refresh every 2 seconds
slot 11 is "iron_pickaxe" named "&6Miner" lore quest_lore("Miner"):
quest_clicked("Miner")
refresh gui
slot 12 is "oak_log" named "&6Lumberjack" lore quest_lore("Lumberjack"):
quest_clicked("Lumberjack")
refresh gui
slot 13 is "wheat" named "&6Farmer" lore quest_lore("Farmer"):
quest_clicked("Farmer")
refresh gui
slot 14 is "bricks" named "&6Builder" lore quest_lore("Builder"):
quest_clicked("Builder")
refresh gui
slot 15 is "rotten_flesh" named "&6Hunter" lore quest_lore("Hunter"):
quest_clicked("Hunter")
refresh gui
slot 16 is "bread" named "&6Baker" lore quest_lore("Baker"):
quest_clicked("Baker")
refresh gui
slot 17 is "fishing_rod" named "&6Fisher" lore quest_lore("Fisher"):
quest_clicked("Fisher")
refresh gui
slot 21 is "gold_ingot" named "&6Saver" lore quest_lore("Saver"):
quest_clicked("Saver")
refresh gui
slot 22 is "leather_boots" named "&bDaily walk" lore quest_lore("Daily walk"):
quest_clicked("Daily walk")
refresh gui
slot 24 is "clock" named "&bSpeed run &7(2 minutes)" lore quest_lore("Speed run"):
quest_clicked("Speed run")
refresh gui
slot 25 is "diamond_sword" named "&dWeekly slayer" lore quest_lore("Weekly slayer"):
quest_clicked("Weekly slayer")
refresh gui
slot 30 is "book" named "&eYour quests" lore quest_stats()
slot 32 is "gold_block" named "&eTop 10" lore "&7Who has done the most quests":
close gui
quest_top()
slot 34 is "barrier" named "&cGive up" lore "&7Stop the quests you are on":
quest_give_up()
refresh gui
command /questtop:
description: The ten players who have done the most quests
trigger:
quest_top()
command /queststop:
description: Give up the quests you are on
players only:
trigger:
quest_give_up()
on quest progress:
send action bar "&6%{_quest}% &7%{_progress}% of %{_goal}%" to player
on quest complete:
add 1 to {%player%.quests_done}
set {_done} to {%player%.quests_done}
play sound "entity.player.levelup" for player
send title "&6Quest done!" with subtitle "&f%{_quest}%" to player
if {@announce} is true:
if {_done} is 5 or {_done} is 10 or {_done} is 25 or {_done} is 50 or {_done} is 100:
broadcast "&6%player.name% &7has finished &f%{_done}% &7quests!"