07-18-2020, 05:18 AM
WCKuests XP
by Kyonides Arkanthes
Current Status
Under Development
Introduction
This is just a simple attempt to make a Warcraft 3 like Quest Menu for RMXP.
No, I don't * care if anybody else already did this.
I started developing it because I've spent quite some time with the WC3 world editor lately. That's all.
Even so I still encourage you test it during this development stage to help me fix bugs or add useful features or GUI elements.
Keep in mind I suck as a graphic designer.
XP Script
Code:
# * WCKuests XP
# Scripter : Kyonides Arkanthes
# v0.2.0 - 2020-07-17
# This scriptlet attempts to emulate several basic features of those famous
# Warcraft 3 menus many fans love. Sadly, I will not add mouse support. :P
# You will need to make one text file per quest following this format:
# human01.txt or siren01.txt
# Place them in your WCKuests directory. This folder should not be distributed!
# * Script Calls * #
# To Accept Main and Optional Quests
# -> Race is a "string" or a :symbol
# $game_party.add_wc_quest(Race, chapter_number)
# $game_party.optional_wc_quest(Race, chapter_number)
module WCK
QUEST_UNKNOWN = 'Undiscovered Quest'
QUEST_CHAPTER = "Chapter %s"
QUEST_CHAPTER_Y = 20
QUEST_CHAPTER_FONT_BOLD = true
QUEST_CHAPTER_FONT_SIZE = 12
QUEST_CHAPTER_TITLE_Y = 24
QUEST_CHAPTER_TITLE_FONT_BOLD = true
QUEST_CHAPTER_TITLE_FONT_SIZE = 14
QUEST_BUTTON_EXIT = 'Done'
QUEST_BUTTON_FONT_BOLD = true
QUEST_BUTTON_FONT_SIZE = 14
# X and Y Coordinates plus X Offset for the Right Column of Buttons
QUEST_NAMEBOX_XY_OFFSET = [12, 24, 340]
QUEST_NAME_FONT_BOLD = true
QUEST_NAME_FONT_SIZE = 14
QUEST_SECTION_LOWER_LIMIT_X = 180
#----- Do Not Edit This Section! --------#
QUEST_SCENE_SKINS = skins = {}
@quests = {}
@quests.default = []
class << self
def skin_data() QUEST_SCENE_SKINS[@skin] end
attr_accessor :skin, :quests
end
#----- Continue customizing the menu. ---#
@skin = :human # You can set it to any other race!
# Here you can add or remove as many races alias skins as it pleases you.
# The OPTIONS below only accept filenames.
# :box means the button itself
# :hilite stands for the selected button visual mark
# :exit is used for the Done or Exit button
skins[:human] = {
:box => '', :button => '',
:hilite => '', :exit => '' }
skins[:orc] = {
:box => '', :button => '',
:hilite => '', :exit => '' }
skins[:nightelf] = {
:box => '', :button => '',
:hilite => '', :exit => '' }
skins[:undead] = {
:box => '', :button => '',
:hilite => '', :exit => '' }
end
class WCKRequire
def initialize
@title = ''
@completed = false
end
attr_accessor :title, :completed
end
class WCKuest
def initialize
@race = ''
@chapter = 0
@title = ''
@description = []
@primary = [WCKRequire.new]
@optional = []
@discovered = false
@completed = false
end
attr_accessor :race, :chapter, :title, :primary, :optional, :description
attr_accessor :discovered, :completed
end
module WCKParser
def start
dir = 'WCKuests/'
filenames = Dir['*.txt'].sort
filenames.each{|fn| read_file(fn) }
save_data(WCK.quests, 'Data/WCKuests.rxdata')
end
def read_file(filename)
kuest = WCKuest.new
kuest.race = filename.sub(/\d+.txt/i, '')
kuest.chapter = filename.scan(/\d+/)[0].to_i
lines = File.readlines(filename)
kuest.title = lines.shift.split(/: /)[1].chomp
lines.shift
4.times{ kuest.description << lines.shift.chomp }
kuest.discovered = (lines.shift = /yes/i) != nil
lines_max = lines.shift.scan(/\d+/)[0].to_i
lines_max.times do
req = WCKRequire.new
req.title = lines.shift.chomp
kuest.primary << req
end
lines_max = lines.shift.scan(/\d+/)[0].to_i
lines_max.times do
req = WCKRequire.new
req.title = lines.shift.chomp
kuest.optional << req
end
WCK.quests[kuest.race.to_sym] << kuest
end
start if $DEBUG
end
class Game_Party
alias :kyon_wck_gm_party_init :initialize
def initialize
kyon_wck_gm_party_init
@kuests = {}
@optional_kuests = {}
@kuests.default = [nil]
@optional_kuests.default = [nil]
end
def add_wc_quest(race, chapter_number)
race = race.to_sym
@kuests[race][chapter_number] = WCK.quests[race][chapter_number]
end
def optional_wc_quest(race, number)
race = race.to_sym
@optional_kuests[race][number] = WCK.optional_quests[race][number]
end
attr_reader :kuests, :optional_kuests
end
class WCKuestButton
def initialize(bx, by, selected)
@box = Sprite.new
@select = Sprite.new
@text = Sprite.new
@select.visible = selected
self.x = bx
self.y = by
skin = WCK.skin_data
@box.bitmap = RPG::Cache.pictures(skin[:button]).dup
@select.bitmap = RPG::Cache.pictures(skin[:hilite]).dup
end
def title=(qname)
bit = @box.bitmap
@text.bitmap = Bitmap.new(bit.width - 16, bit.height - 8)
size = WCK::QUEST_NAME_FONT_SIZE
@text.bitmap.font.bold = WCK::QUEST_NAME_FONT_BOLD
@text.bitmap.font.size = size
@text.bitmap.draw_text(0, 0, bit.width - 16, size + 2, qname)
end
def x=(nx)
@box.x = bx
@select.x = bx
@text.x = bx + 8
end
def y=(ny)
@box.y = by
@select.y = by
@text.y = by + 4
end
def xy(nx, ny)
self.x = bx
self.y = by
end
def dispose
@box.bitmap.dispose
@select.bitmap.dispose
@text.bitmap.dispose
@box.dispose
@select.dispose
@text.dispose
end
end
class WCKuestScene
def initialize(pos)
@index = pos
@kuest = WCK.quests[@index]
end
def main
@sprites = []
@quest_buttons = []
@optional_buttons = []
@kmax = @kuest.primary.size
@omax = @kuest.optional.size
x, y, off = WCK::QUEST_NAMEBOX_XY_OFFSET
@sprites << @chapter = Sprite.new
@chapter.x = (640 - 200) / 2
@chapter.y = WCK::QUEST_CHAPTER_Y
@chapter.bitmap = bit = Bitmap.new(200, 24)
bit.font.bold = WCK::QUEST_CHAPTER_FONT_BOLD
bit.font.size = size = WCK::QUEST_CHAPTER_FONT_SIZE
bit.draw_text(0, 0, 200, size, @kuest.chapter, 1)
@sprites << @title = Sprite.new
@title.x = (640 - 320) / 2
@title.y = WCK::QUEST_CHAPTER_TITLE_Y
@title.bitmap = bit = Bitmap.new(320, 28)
bit.font.bold = WCK::QUEST_CHAPTER_TITLE_FONT_BOLD
bit.font.size = size = WCK::QUEST_CHAPTER_TITLE_FONT_SIZE
bit.draw_text(0, 0, 320, size, @kuest.title, 1)
@kmax.times do |n|
button = WCKuestButton.new(x, y + n * 32, n == 0)
button.title = @kuest.primary[n].title
@quest_buttons << button
end
@omax.times do |n|
button = WCKuestButton.new(x + off, y + n * 32, false)
button.title = @kuest.optional[n].title
@optional_buttons << button
end
Graphics.transition
while $scene == self
Graphics.update
Input.update
update
end
terminate
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
def terminate
Graphics.freeze
@optional_buttons.each{|b| b.dispose }
@quest_buttons.each{|b| b.dispose }
@sprites.each{|b| b.dispose }
@optional_buttons.clear
@quest_buttons.clear
@sprites.clear
end
end
Quest Template
Code:
TITLE:
DESCRIPTION
Some description
4 lines maximum
DISCOVERED: YES
PRIMARY QUESTS 1
Some Title
OPTIONAL QUESTS 0
Terms & Conditions
Free for non commercial games.
Include my nickname in your game credits.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE