gameface101
Member
got the script, yet don't have the correct graphics for the $scene...
(here's the script if anyone wants to have "word" codes to open special chests)
use: $scene = Scene_Wordlock.new (1,260)
1=chest position in the script 260=the switch if word is correct.
this was a great idea I would like to fancy up... I would like the graphic files
that were custom made for this...
anyone...? Zeriab??
(here's the script if anyone wants to have "word" codes to open special chests)
Code:
#==============================================================================
# ** Wordlock Chests
#------------------------------------------------------------------------------
# Zeriab
# V 1
# 25-08-2006
#==============================================================================
module Wordlock_Chest
#--------------------------------------------------------------------------
# * The filename of the default Panorame picture
# It must be placed in 'Panoramas'
#--------------------------------------------------------------------------
PanoramaDefault = '001-Sky01'
#--------------------------------------------------------------------------
# * This is if you want more panorama pictures
# If you want another panorame picture for chest no. 10
# just put this inside the {}:
# 10 => 'Riddle_Chest2.png'
# The text in the '' is just the filename on the panorama.
# Must be placed in 'Panorams'
#
# If you want more special chest just seperate with a comma (,)
#--------------------------------------------------------------------------
Panorama = {}
#--------------------------------------------------------------------------
# * Pictures used for the riddle.
# Usage: Write the name on the filename to be used.
# Must be in 'Pictures'
#
# The position determines the chest number.
# First position is for chest 1, second for chest 2 and so on.
#--------------------------------------------------------------------------
Pic = ['ting', '', '']
#--------------------------------------------------------------------------
# * Here are the information on the chests.
# For each chest it is arrange so:
# [letter1, letter2, ... , letterX]
# Where letter1 determines the possible letters for the first place
# letter2 likewise and so on
#
# Each letter is represent by a string. The characters in the string
# will be those the player cycles through
#
# Make an array per chest.(Remember the comma - ,)
#
# The position determines the chest number.
# First position is for chest 1, second for chest 2 and so on.
#--------------------------------------------------------------------------
Chest = [
['TJYR', 'IQNS', 'PNOU', 'RGCE'], #wordlock chest #1
['WGHN', 'EORH', 'MPLI', 'HTEO', 'IDFS'], #wordlock chest #2
['SCWA', 'ATHR', 'ERLS', 'TLON', 'EURS', 'STDY'] #wordlock chest #3
]
#--------------------------------------------------------------------------
# * Here are the solutions for the chests
# The number is the correct character for the corresponding letter
#
# For example. We have above the first letter of the first chest
# containing the string 'TJYR'. If you look down you can see that at
# the same location is the number 4. This means that 'R' correct.
# Had it been 3, then 'Y' would be correct.
#
# The position determines the chest number.
# First position is for chest 1, second for chest 2 and so on.
#--------------------------------------------------------------------------
Solution = [
[1,1,1,2], #wordlock chest #1
[3,2,3,3,4], #wordlock chest #2
[3,1,3,4,2,2] #wordlock chest #3
]
end
#==============================================================================
# ** Window_Wordlock
# Contains the static pictures
#==============================================================================
class Window_Wordlock
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(chest)
@contents = Sprite.new(Viewport.new(0, 0, 640, 480))
@contents.bitmap = Bitmap.new(32, 32)
refresh(chest)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(chest)
@contents.bitmap.dispose
# Gets the filename on the Panorama
filename = Wordlock_Chest::Panorama[chest]
# Checks if default should be used
if filename == nil
filename = Wordlock_Chest::PanoramaDefault
end
# Loads the panorama
@contents.bitmap = Bitmap.new('Graphics\\Panoramas\\' + filename)
# Draws the riddle
@contents.bitmap.blt(0, 0, Bitmap.new('Graphics\\Pictures\\' +
Wordlock_Chest::Pic[chest]), Rect.new(0, 0, 640, 480))
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@contents.bitmap.dispose
@contents.dispose
end
end
#==============================================================================
# ** Window_Gamos_Selection
#==============================================================================
class Window_Wordlock_Selection
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(chest)
# Letters
@letter_bitmap = [Bitmap.new("Graphics\\Characters\\Letters_01.png"),
Bitmap.new("Graphics\\Characters\\Letters_02.png")]
# Chest Data
@data = Wordlock_Chest::Chest[chest]
@solution = Wordlock_Chest::Solution[chest]
@position = Array.new(@data.size,0)
@index = 0
@counter = 0
# Total width of the numbers
width = 32 * @data.size
@left_border = 320-(width/2)
# The letters
@contents = Sprite.new(Viewport.new(@left_border, 224, width, 32))
@contents.bitmap = Bitmap.new(width,96)
# The cursor (Crystal)
@cursor = Sprite.new(Viewport.new(@left_border, 160, @data.size*32, 64))
@cursor.bitmap = Bitmap.new(128,64)
@cursor.bitmap.blt(0, 0, Bitmap.new('Graphics\\Characters\\' +
'198-Support06.png'), Rect.new(0, 128, 128, 64))
# The arrows shown.
@arrows = Sprite.new(Viewport.new(540, 192, 96, 96))
@arrows.bitmap = Bitmap.new(96,96)
# Up Arrow
@arrows.bitmap.blt(32, 0, Bitmap.new('Graphics\\Characters\\' +
'arrow.png'), Rect.new(64, 0, 32, 32))
# Right Arrow
@arrows.bitmap.blt(64, 32, Bitmap.new('Graphics\\Characters\\' +
'arrow.png'), Rect.new(64, 32, 32, 32))
# Left Arrow
@arrows.bitmap.blt(0, 32, Bitmap.new('Graphics\\Characters\\' +
'arrow.png'), Rect.new(64, 64, 32, 32))
# Down Arrow
@arrows.bitmap.blt(32, 64, Bitmap.new('Graphics\\Characters\\' +
'arrow.png'), Rect.new(64, 96, 32, 32))
# Light
bitmap = Bitmap.new('Graphics\\Characters\\185-Light02.png')
bitmap.hue_change(180)
@arrows.bitmap.blt(32, 0, bitmap, Rect.new(0, 0, 32, 64))
# Refreshes and updates
refresh
update
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@contents.bitmap.clear
#@contents.bitmap = Bitmap.new(32 * @data.size,96)
for i in [email=0...@data.size]0...@data.size[/email]
@contents.bitmap.blt(i*32, 0, get_letter(@data[i].upcase[@position[i]]),
Rect.new(0,0,32,32))
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Updates the cursor position
@cursor.src_rect.set((@counter/15)*32, 0, 32, 64)
@cursor.x = @index * 32
# Counter for animation
@counter = (@counter + 1) % 60
# Updates the sprites
@cursor.update
@contents.update
@arrows.update
end
#--------------------------------------------------------------------------
# * Get letter as bitmap
# char : letter
#--------------------------------------------------------------------------
def get_letter(char)
#--------------------------------------------------------------------------
# In ASCII the upcase alphabet has values ranging from A = 65 to Z = 90
# 65 is subtracted so you have the alphabet in the range [0..24]
#--------------------------------------------------------------------------
val = char - 65
# Gets which of the two bitmaps to use
no = val / 16 + 1
# Gets the position of the letter
val = val % 16
# Transfers the letter to the bitmap
bitmap = Bitmap.new(32,32)
bitmap.blt(0, 0, @letter_bitmap[no-1],
Rect.new((val % 4)*32, (val/4)*32, 32, 32))
return bitmap
end
#--------------------------------------------------------------------------
# * Move in the direction given
# dir : The direction.
#--------------------------------------------------------------------------
def move(dir)
case dir
when 2: # Down
@position[@index] = (@position[@index] - 1) % @data[@index].size
refresh
when 4: # Left
@index = (@index - 1) % @data.size
when 6: # Right
@index = (@index + 1) % @data.size
when 8: # Up
@position[@index] = (@position[@index] + 1) % @data[@index].size
refresh
end
end
#--------------------------------------------------------------------------
# * Checks if the solution is solved
#--------------------------------------------------------------------------
def solved?
#--------------------------------------------------------------------------
# In @position the first letter is considered as 0 where as in @solution
# the first letter is considered as 1. Checks if all the elements in
# @position is just 1 less than the designated element in @solution
#--------------------------------------------------------------------------
for i in [email=0...@solution.size]0...@solution.size[/email]
if @solution[i] != @position[i] + 1
return false
end
end
return true
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@cursor.bitmap.dispose
@cursor.dispose
@contents.bitmap.dispose
@contents.dispose
end
end
#==============================================================================
# ** Scene_Wordlock
#==============================================================================
class Scene_Wordlock
#--------------------------------------------------------------------------
# * Object Initialization
# chest : The chest number
# switch_number : Number on the switch which will be turned on
# if the player solves the chest
#--------------------------------------------------------------------------
def initialize(chest, switch_number)
# First element in an Array have index = 0
@chest = chest-1
@switch_number = switch_number
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Wordlock Window
@wordlock_window = Window_Wordlock.new(@chest)
# Creates Selection Window
@selection_window = Window_Wordlock_Selection.new(@chest)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Selection Window
@selection_window.update
## Frame update
update
# Abort loop if screen is changed
break if $scene != self
end
# Prepare for transition
Graphics.freeze
# Dispose Scene Objects
@selection_window.dispose
@wordlock_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Up Is Pressed
if Input.repeat?(Input::UP)
# Refresh Selection
@selection_window.move(8)
end
# If Down Is Pressed
if Input.repeat?(Input::DOWN)
# Refresh Selection
@selection_window.move(2)
end
# If Left Is Pressed
if Input.repeat?(Input::LEFT)
# Refresh Selection
@selection_window.move(4)
end
# If Right Is Pressed
if Input.repeat?(Input::RIGHT)
# Refresh Selection
@selection_window.move(6)
end
# If B Button Is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C Button Is Pressed
if Input.trigger?(Input::C)
# Level active Check
unless @selection_window.solved?
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turn switch ON
$game_switches[@switch_number] = true
# Refresh player
$game_player.refresh
# Refreshes Map
$game_map.refresh
# Switch to map screen
$scene = Scene_Map.new
end
end
end
use: $scene = Scene_Wordlock.new (1,260)
1=chest position in the script 260=the switch if word is correct.
this was a great idea I would like to fancy up... I would like the graphic files
that were custom made for this...
anyone...? Zeriab??