Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Zeriab

Letter Minigame

Recommended Posts

Letter Minigame

Version: 1.2

 

Version History

Version 1.2:

Fixed an issue which might cause immense amounts of memory to be used.

 

Version 1.1:

Adds $letter_minigame.score - works also after $letter_minigame.dispose.

Gives a solution to the F12 issue present in the earlier demo.

 

Introduction

 

The Letter Minigame has been made by Zeriab.

Thanks goes to RMXP for making this possible and Near Fantastica for the Anti Event Lag Script.

Credits should be given.

 

The purpose in the Letter Minigame is to get a good score by collecting as many letters in the maze as possible within the time limit.

Different letters give different amount of points.

 

You can see how much each letter gives by looking at the letters on this island.

The more points the rarer the letter.

 

A yellow letter = 10 points

A green letter = 15 points

A azure letter = 20 points

A red letter = 25 points

A purple letter = 30 points

A black letter = 100 points

 

Screenshots

 

startut0.th.jpg goingyk1.th.jpg finishvf3.th.jpg

 

Demo

 

You download my demo from one of the following links.

http://rapidshare.de/files/32564515/Letter_Minigame.rar.html

http://www.uploadtemple.com/view.php/1157849623.rar

http://www.bigupload.com/d=8C2A764D

http://www28.websamba.com/Vobbys/Letter_Minigame.rar

 

Script

 

-=Extensions=-

#===============================================================================
# Author: Zeriab							   Date:03-06-2006
# Last Modified: 04-06-2006
#
# Game_Event: (Extension)
# ----------------------
# Adds the ability to change the id
# Adds the ability to copy the event
#===============================================================================
class Game_Event < Game_Character
 #--------------------------------------------------------------------------
 # * Sets @id and @event.id to the given value
 #--------------------------------------------------------------------------
 def id=(value)
@id = value
@event.id = value
 end

 #--------------------------------------------------------------------------
 # * Copies the event
 #--------------------------------------------------------------------------
 def copy
temp = Game_Event.new(@map_id, @event.dup)
temp.id = @id
return temp
 end
end

#===============================================================================
# Author: Zeriab							   Date:09-06-2006
# Last Modified: 09-06-2006
#
# Game_Map: (Extension)
# ----------------------
# Adds the ability to change the height and width
#===============================================================================
class Game_Map
 #--------------------------------------------------------------------------
 # * Sets height of the map to a given value
 #--------------------------------------------------------------------------
 def height=(value)
@map.height = value
 end

 #--------------------------------------------------------------------------
 # * Sets width of the map to a given value
 #--------------------------------------------------------------------------
 def width=(value)
@map.width = value
 end
end

 

-=Maze_Generator=-

#===============================================================================
# Author: Zeriab							   Date:03-06-2006
# Last Modified: 07-06-2006
#
# Pointer:
# ----------------------
# Points to a specific position on the map
#===============================================================================

module Maze_Generator
 class Pointer
attr_reader   :x  # Stored x
attr_reader   :y  # Stored y
attr_accessor :tail #A possible tail behind the pointer
#--------------------------------------------------------------------------
# * Object Initialization
#	 x : x-coordinate for starting point
#	 y : y-coordinate for starting point
#--------------------------------------------------------------------------
def initialize(x, y)
  @x = x
  @y = y 
end

#--------------------------------------------------------------------------
# * Checks the pointers location
#	 true is returned if the pointer is inside $game_map
#	 false is returned if the pointer is outside $game_map
#--------------------------------------------------------------------------
def check
  if (x / $game_map.width) == 0 and (y / $game_map.height) == 0 
	return true
  else
	return false
  end
end

#--------------------------------------------------------------------------
# * Get the tile value
#--------------------------------------------------------------------------
def get(layer)
  return $game_map.data[x,y,layer]
end

#--------------------------------------------------------------------------
# * Set the tile value
#--------------------------------------------------------------------------
def set(value, layer)
  $game_map.data[x,y,layer] = value
  if @tail != nil
	@tail.set(value,layer)
  end
end

#--------------------------------------------------------------------------
# * The to_s-method.
#	 Information about the pointer returned as a string
#--------------------------------------------------------------------------
def to_s
  return 'Pointer - x=' + @x.to_s + ', y=' + @y.to_s +
		  ' - hasTail=' + (!(@tail==nil)).to_s
end

 end
end

#===============================================================================
# Author: Zeriab							   Date:04-06-2006
# Last Modified: 04-06-2006
#
# Event_Spawner:
# ----------------------
# Creates a list during initialization which later is used for choosing events
# The events given when initialized is removed from the map.
# If the max_chance is bigger than the total sum of the events chance value
# the possibility to not retrieving an event is present.
# In that case 'nil' is returned.
#===============================================================================

module Maze_Generator
 class Event_Spawner
#--------------------------------------------------------------------------
# * Object Initialization
#	 max_chance	  : The total chance used for choosing among the events
#	 array_of_events : Numbers on events paired with their chance value
#--------------------------------------------------------------------------
def initialize(max_chance, array_of_events)
  @max_chance = max_chance
  @array_of_events = array_of_events
  counter = 0
  for tuple in @array_of_events
	tuple[0] = $game_map.events.delete(tuple[0])
	counter += tuple[1]
  end
  if counter > @max_chance
	@max_chance = counter
  end
end

#--------------------------------------------------------------------------
# * Gets an event randomly from the list
#	 returns 'nil' if no event is chosen
#--------------------------------------------------------------------------
def get_event
  result = nil
  chance = rand(@max_chance) + 1
  for tuple in @array_of_events
	chance = chance - tuple[1]
	if chance <= 0 and tuple[0] != nil
	  result = tuple[0].copy
	  break
	end
  end
  return result
end
 end
end

#===============================================================================
# Author: Zeriab							   Date:03-06-2006
# Last Modified: 07-06-2006
#
# Maze_Generator:
# ----------------------
# Creates a maze on the current map.
#===============================================================================

module Maze_Generator
 class Maze
#--------------------------------------------------------------------------
# * Object Initialization
#	 x			   : x-coordinate for starting point
#	 y			   : y-coordinate for starting point
#	 max_chance	  : The total chance used for choosing among the events
#	 array_of_events : Numbers on events paired with their chance value
#	 value		   : value of the tileset assigned to the maze
#	 layer		   : the layer that will be crawled
#--------------------------------------------------------------------------
def initialize(x, y, max_chance, array_of_events, value=0, layer=1)
  x = x % $game_map.width
  y = y % $game_map.height
  @value = value
  @layer = layer % 3
  @events = Event_Spawner.new(max_chance, array_of_events)
  @counter = 1000
  pon = Pointer.new(23,54)
  pointer = Pointer.new(x,y)
  pointer.tail=pon
  pointer.set(@value,@layer)
  crawl(pointer)
  $scene = Scene_Map.new
end

#--------------------------------------------------------------------------
# * Crawls the map
#	 pointer : The start pointer.
#--------------------------------------------------------------------------
def crawl(pointer)
  k = 0
  list = [pointer]
  while list.length > 0
	k += 1
	k += 1
	r = rand(list.length)
	pointer = list.delete_at(r)
	array = getDirection
	array2 = relax(pointer, array)
	for i in 0...array2.length
	  list.push(array2[i])
	end
  end
end

#--------------------------------------------------------------------------
# * Get the directions. (Randomized)
#	 Returnes an array of length 2..4 containing the numbers 1..4
#--------------------------------------------------------------------------
def getDirection
  array = [1,2,3,4]
  r = rand(3)+2
  while (array.length-r) > 0
	r2 = rand(array.length)
	array.delete_at(r2)
  end
  return array
end 

#--------------------------------------------------------------------------
# * Relaxes the given pointer with the given array
#	 Creates paths for the valid directions
#	 Returns the valid pointers
#--------------------------------------------------------------------------
def relax(pointer, array)
  result = []
  while array.length > 0
	key = array.pop
	case key
	#---------------------------------------------------
	# * up
	#---------------------------------------------------
	when 1
	  p2 = Pointer.new(pointer.x, pointer.y - 2)
	  if p2.check && p2.get(@layer) != @value
		p3 = Pointer.new(pointer.x,pointer.y - 1)
		p2.tail = p3
		p2.set(@value,@layer)
		result.push(p2)
	  end
	#---------------------------------------------------
	# * rigth
	#---------------------------------------------------
	when 2
	  p2 = Pointer.new(pointer.x + 2, pointer.y)
	  if p2.check && p2.get(@layer) != @value
		p3 = Pointer.new(pointer.x + 1,pointer.y)
		p2.tail = p3
		p2.set(@value,@layer)
		result.push(p2)
	  end
	#---------------------------------------------------
	# * down
	#---------------------------------------------------
	when 3
	  p2 = Pointer.new(pointer.x, pointer.y + 2)
	  if p2.check && p2.get(@layer) != @value
		p3 = Pointer.new(pointer.x,pointer.y + 1)
		p2.tail = p3
		p2.set(@value,@layer)
		result.push(p2)
	  end
	#---------------------------------------------------
	# * left
	#---------------------------------------------------
	when 4
	  p2 = Pointer.new(pointer.x - 2, pointer.y)
	  if p2.check && p2.get(@layer) != @value
		p3 = Pointer.new(pointer.x - 1,pointer.y)
		p2.tail = p3
		p2.set(@value,@layer)
		result.push(p2)
	  end
	end
  end
  #----------------------------------------------------------------------
  # * If result = [] (Dead end) an event might be placed in the current
  #   position.
  #----------------------------------------------------------------------
  if result == []
	new_event = @events.get_event
	if new_event != nil
	  new_event.id = @counter
	  new_event.moveto(pointer.x,pointer.y)
	  $game_map.events[@counter] = new_event
	  @counter += 1
	end
  end
  #----------------------------------------------------------------------
  return result
end
 end
end

 

-=Letter Minigame=-

#===============================================================================
# Author: Zeriab							   Date:08-06-2006
# Last Modified: 27-07-2006
#
# Letter_Minigame
# ----------------------
# Counts the amount of letters collected and controls the score displaying in
# the top-right corner
#===============================================================================

class Letter_Minigame
 attr_reader :array_of_points
 attr_reader :array_of_bitmaps
 attr_reader :array_of_sprites
 attr_reader :array_count

 #--------------------------------------------------------------------------
 # * Object Initialization.
 #	 array_of_events : Numbers on the events used.
 #	 array_of_points : The amount of points for the corresponding event in
 #					   array_of_events. Linked by placement.
 #--------------------------------------------------------------------------
 def initialize(array_of_events, array_of_points)
@array_of_points = array_of_points
getSprites(array_of_events)
@array_count = Array.new(array_of_points.size,0)
 end

 #--------------------------------------------------------------------------
 # * Adds a letter to the to corresponding group.
 #	 letter  : indicating the position the letter have in
 #			   the array_of_points with 0 as first letter.
 #--------------------------------------------------------------------------
 def add(letter)
@array_count[letter] += 1
update_letter(letter)
 end

 #--------------------------------------------------------------------------
 # * Gets an array sprites and and array of their base bitmaps from an array
 #   of events.
 #	 array : An array of eventnumbers which sprites is wanted.
 #--------------------------------------------------------------------------
 def getSprites(array)
@array_of_bitmaps = []
@array_of_sprites = []
counter = 0
for i in array
  event = $game_map.events[i]
  bitmap = RPG::Cache.character(event.character_name, event.character_hue)
  #---------------------------------------------------
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  sx = event.pattern * cw
  sy = (event.direction - 2) / 2 * ch
  #---------------------------------------------------
  sprite = Sprite.new(Viewport.new(640-64,10+(32*counter),cw,ch))
  sprite.visible = false
  sprite.bitmap = bitmap
  sprite.src_rect.set(sx, sy, cw, ch)
  #---------------------------------------------------
  new_bitmap = Bitmap.new(cw*3,ch)
  new_bitmap.blt(0,0,sprite.bitmap,sprite.src_rect)
  sprite.bitmap = new_bitmap.dup
  #---------------------------------------------------
  @array_of_bitmaps.push(new_bitmap.dup)
  @array_of_sprites.push(sprite)
  new_bitmap.dispose
  counter += 1
end
 end

 #--------------------------------------------------------------------------
 # * Single Letter Update
 #	 letter  : Number on the letter which will be updated
 #--------------------------------------------------------------------------
 def update_letter(letter)
  sprite = @array_of_sprites[letter]
  value = @array_count[letter]
  var = (value.to_s.length - 1) * 11
  sprite.bitmap.dispose
  sprite.bitmap = @array_of_bitmaps[letter].dup
  sprite.bitmap.draw_text(28,12,64,64,'x ' + value.to_s)
  sprite.src_rect.width = 64 + var
  sprite.viewport.rect.width = 64 + var
  sprite.viewport.rect.x = 640 - sprite.viewport.rect.width
  sprite.update
 end

 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update(x = 640, y = 10, step = 32)
counter = 0
for element in @array_of_sprites
  sprite = Sprite.new(Viewport.new(x-64,y+(step*counter),
					  64, element.viewport.rect.height))
  sprite.bitmap = element.bitmap
  element.dispose
  value = @array_count[counter]
  var = (value.to_s.length - 1) * 11
  sprite.bitmap.dispose
  sprite.bitmap = @array_of_bitmaps[counter].dup
  sprite.bitmap.draw_text(28,12,64,64,'x ' + value.to_s)
  sprite.src_rect.width = 64 + var
  sprite.viewport.rect.width = 64 + var
  sprite.viewport.rect.x = 640 - sprite.viewport.rect.width 
  @array_of_sprites[counter] = sprite
  sprite.update
  counter += 1
end
 end

 #--------------------------------------------------------------------------
 # * Hide
 #--------------------------------------------------------------------------
 def hide
for sprite in @array_of_sprites
  sprite.visible = false
end
 end

 #--------------------------------------------------------------------------
 # * Show
 #--------------------------------------------------------------------------
 def show
for sprite in @array_of_sprites
  sprite.visible = true
end
 end

 #--------------------------------------------------------------------------
 # * Score
 #--------------------------------------------------------------------------
 def score
temp = 0
for i in 0...@array_of_points.size
  temp += @array_of_points[i] * @array_count[i]
end
return temp
 end

 #--------------------------------------------------------------------------
 # * Disposal
 #--------------------------------------------------------------------------  
 def dispose
for element in @array_of_sprites
  element.dispose
end
for element in @array_of_bitmaps
  element.dispose
end
@array_of_bitmaps.clear
@array_of_sprites.clear
#@array_of_points.clear
#@array_count.clear
 end
end

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Letter_Result_Menu
 #--------------------------------------------------------------------------
 # * Object Initialization
 #	 menu_index : command cursor's initial position
 #--------------------------------------------------------------------------
 def initialize
@menu_index = 0
 end
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
# Make command window
s1 = "Okay"
@command_window = Window_Command.new(160, [s1])
@command_window.index = @menu_index
# Make letter window
@letters_window = Window_Letters.new
@letters_window.x = 0
@letters_window.y = 64
# Make letter amount window
@amount_window = Window_Letter_Amount.new
@amount_window.x = 0
@amount_window.y = 416
# Make results window
@results_window = Window_Letter_Results.new
@results_window.x = 160
@results_window.y = 64
# Make level window
@level_window = Window_Letter_Level.new
@level_window.x = 160
@level_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
  # Update game screen
  Graphics.update
  # Update input information
  Input.update
  # Frame update
  update
  if $letter_minigame != nil
	$letter_minigame.update
  end	
  # Abort loop if screen is changed
  if $scene != self
	break
  end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@letters_window.dispose
@amount_window.dispose
@results_window.dispose
@level_window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
# Update windows
@command_window.update
@letters_window.update
@results_window.update
@results_window.update
@level_window.update
# If command window is active: call update_command
if @command_window.active
  update_command
  return
end
# If status window is active: call update_status
if @status_window.active
  update_status
  return
end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when command window is active)
 #--------------------------------------------------------------------------
 def update_command
# If B or C button was pressed
if Input.trigger?(Input::B)
  # Play cancel SE
  $game_system.se_play($data_system.cancel_se)
  # Dispose of $letter_minigame
  $letter_minigame.dispose
  # Switch to map screen
  $scene = Scene_Map.new
  return
end
# If C button was pressed
if Input.trigger?(Input::C)
  # Play decision SE
  $game_system.se_play($data_system.decision_se)
  # Dispose of $letter_minigame
  $letter_minigame.dispose
  # Switch to map screen
  $scene = Scene_Map.new
  return
end
 end
end

#==============================================================================
# ** Window_Letters
#------------------------------------------------------------------------------
#  This window displays amount of each Letter.
#==============================================================================

class Window_Letters < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 0, 160, 352)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear
if $letter_minigame != nil
  counter = 0
  for sprite in $letter_minigame.array_of_sprites
	self.contents.blt(0,-22+32*counter,sprite.bitmap,sprite.src_rect)
	counter += 1
  end
end
 end
end

#==============================================================================
# ** Window_Letter_Amount
#------------------------------------------------------------------------------
#  This window displays the total amount of letters.
#==============================================================================

class Window_Letter_Amount < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear
word = $data_system.words.gold
if $game_party.gold == 1 then
  word = word.chop
end
amount = 0
for element in $letter_minigame.array_count
  amount += element
end
cx = contents.text_size(word).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, amount.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, word, 2)
 end
end

#==============================================================================
# ** Window_Letter_Results
#------------------------------------------------------------------------------
#  This window displays the score of the level and how it is computed.
#==============================================================================

class Window_Letter_Results < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 0, 480, 416)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
self.contents.clear
if $letter_minigame != nil
  array_count = $letter_minigame.array_count
  array_of_points = $letter_minigame.array_of_points
  array_of_sprites = $letter_minigame.array_of_sprites
  counter = 0
  sum = 0
  for sprite in array_of_sprites
	firstpart = (array_count[counter].to_s.length + 1) * 11 + 36
	secondpart = (array_of_points[counter].to_s.length + 1) * 11
	value = array_of_points[counter]
	result = value * array_count[counter]
	sum += result
	y = 32*counter
	if y > 351 then
	  y = 550
	end
	self.contents.blt(0,-22+y,sprite.bitmap,sprite.src_rect)
	self.contents.draw_text(firstpart,-10+y,
							480,64,'x ' + value.to_s)
	self.contents.draw_text(firstpart + secondpart + 7,-10+y,
							480,64,'= ' + result.to_s)
	counter += 1
  end
  self.contents.draw_text(0,336,480,64, 'Total Score: ' + sum.to_s)
end
 end
end

#==============================================================================
# ** Window_Letter_Level
#------------------------------------------------------------------------------
#  This window displays some level information
#==============================================================================

class Window_Letter_Level < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 0, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
text = $game_map.width.to_s + 'x' + $game_map.height.to_s + ' at speed ' +
		  $game_variables[2].to_s
self.contents.font.color = system_color
self.contents.draw_text(0,-16,480,64,text)
 end
end

 

 

I have collected them all in 1 file which can be downloaded here: http://www28.websamba.com/Vobbys/Letter_Minigame_All.txt

I don't recommend it, but I acknowledge the fact that some people don't want to copy each class into a separate place in the script editor.

Note that I haven't tested using that file.

 

Instructions

 

Here I will try to explain how the scripts is used.

I have split this section in two.

One for the Maze Generator. This generates the maze and places the events.

This is not linked with the Letter Minigame.

One for the Letter Minigame. This controls the letters collected and the visual effects.

This is not linked with the Maze Generator. A normally made level could be used.

You can look at the scripts in the end of the scripts editor.

 

I have also edited some of the normal scripts in the demo. These has been marked by having a * in front of its name in the script chooser.

This is the Maze_Generator module.
To call it use this syntax:
Maze_Generator::Maze.new(x, y, max_chance, array_of_events, value=0, layer=1)
 x			   : x-coordinate for starting point
 y			   : y-coordinate for starting point
 max_chance	  : The total chance used for choosing among the events
 array_of_events : Numbers on events paired with their chance value
 value		   : value of the tileset assigned to the maze (default=0)
 layer		   : the layer that will be crawled (default=1)

An example could be:
 Maze_Generator::Maze.new(49,49,300,[[2,22],[3,19],[5,17],
								[6,14],[7,10],[9,2]],0,1)

Notice the how you should write the array_of_events.
The first number is the number on the event you want.
In this example the script will start in 49,49 and spread out from there.
It will change the tiles on layer 1 to 0 if it's not already 0.
You can encapsulate the maze by making a border of tiles with 0 as value.
Otherwise it will be restricted by the map borders.
In dead ends it might place an event.
The second value you see in each pair shows the change that the corresponding event is spawn. It is compared to the total probability.
There is a 22/300 chance of event number 2 being spawned in a dead-end.
There is a 19/300 chance of event number 3 being spawned in a dead-end and so on.
The originally placed events WILL be deleted.

Don't let the user save the game in a map where you have used the Maze_Generator as the changes will not be saved.

This is the letter minigame itself.
Managing how many of which letters are collect and showing the stats.
To call it use this syntax:
$letter_minigame = Letter_Minigame.new(array_of_events, array_of_points)
 array_of_events : Numbers on the events used.
 array_of_points : The amount of points for the corresponding event in
				   array_of_events. Linked by placement.

$letter_minigame is the reference used by the results screen.

An example could be:
$letter_minigame = Letter_Minigame.new([2,3,5,6,7,9],[10,15,20,25,30,100])
This will take and use the graphics from event number 2,3,5,6,7 and 9
The latter shows the amount of points each element is worth.
The first element will have the graphic from event number 2 and be worth 10.
The second element will have the graphic from event number 3 and be worth 15 and so on.

The events you should collect must contain this line as a script:
$letter_minigame.add(position)
 position : Position of the element in the array. First position = 0

For example the syntax
$letter_minigame.add(0)
Should be put in the events which has the graphic of event number 2 and are 10 points worth.
$letter_minigame.add(1)
Should be put in the events which has the graphic of event number 3 and are 15 points worth and so on.


Now when the minigame is finished used this syntax to call the results screen.
$scene = Letter_Result_Menu.new
This will gather information from $letter_minigame

You might have an interest in changed the results screen accordingly to your needs. Feel free to do so

 

The command $letter_minigame.score returns the score.

This works even after the $letter_minigame.dispose command is used.

That is because .dispose leaves the little information needed for calculation the score.

You can for example use this for giving prizes afterwards.

 

FAQ

 

How could I make a maze that has no timer on it with this script? Cause I wanna make a maze, and put a boss in it, but I want the maze to be randomized, and I don't want the timer either. The other thing is, how can I set this up so that I can have just the 1 boss event in it in a specific spot, and not have to worry about that spot being in a wall, or unreachable because the maze wasn't made right.

 

The timer part is easily solved because the event in the top-left corner is controlling the timer.

For what you want you don't need the Letter Minigame, just the Maze_Generator module.

 

You don't need the $letter_minigame = Letter_Minigame.new([2,3,5,6,7,9],[10,15,20,25,30,100])

 

You would only need something like this: Maze_Generator::Maze.new(49,49,0,[],0)

This will create a maze where no events are spawned.

 

Now can you find a plaze where there with certainty is no wall?

Yes. The starting point you give.

Considering the above example the square at 49, 49 will be empty.

There might be more certain squares, but I'm not sure.

I do however know that there is a pattern linked with the probability of a square being a wall.

 

If S is the starting point then the pattern will look like this:

X0X0X0X

0P0P0P0

X0X0X0X

0P0S0P0

X0X0X0X

0P0P0P0

X0X0X0X

 

It will continue to spread outwards like that.

Symbol Explination:

S: Starting point

P: Very high possibility of being a passable square (non-wall), above 90% I'd say. Probability decreases near edges.

O: Might be a wall, might not. No significant difference is probability.

X: Is most certainly a wall.

 

So you can put your boss on the starting point for certainty or on one of the P's for a very good chance of not being in a wall. (Don't put the boss near an edge in this case)

 

 

There might also be another solution you can use.

You see the X's are most certainly a wall.

What now if the wall was passable and the other wasn't?

That way the script would create the wall.

As the script create an acyclic graph (you don't have to understand this term) you be certain that there is a way from outside into any, yes? ANY of the X-squares.

If you do not have a rim around the maze you can however not be sure of a way from one X to another.

Something like this might do the trick:

Maze_Generator::Maze.new(49,49,0,[],48)

The 48 tells the script to use the tile graphic with id 48. Before 0 was used.

48 is generally water.

I don't know the system for this. I just found out with trial and error.

 

If you are creating a wall rather than a path you can also encase an area or the maze itself by putting the title with id-48 on the P's.

There will be a walkable path around the P.

 

You have to something like because I haven't scripting in the possibility to have just one and no more than one of a certain event places somewhere in the maze.

I or you could try to simply put the event on the last square touched by the crawler. (Script edit)

I hope you will find my answer satisfying.

 

How do I set up item prizes?

For example, if I had 250 points, I win a potion or something like that.

 

Using this command will return the score: $letter_minigame.score

For non-scripters you can use the Call Script command with $game_variables[10] = $letter_minigame.score, where the 10 is the variable number. Just set it to the number of the variable you want to use.

Now that you have the score in a variable I assume that you can do the rest.

 

Compatibility

 

Is not compatible with saving and loading. The map will reset if loaded.

Might be SDK compliant.

 

Credits and Thanks

 

I would like to thank RMXP ? Underground personal for creating a scripting contest which inspired me to create this work.

I would like to thank everyone using their time to try this and finally I would like to thank everyone reading this topic.

Thanks.

 

Author's Notes

 

I suggest using Near Fantastica's anti event lag script due to the often high amount events.

This script can create more than 1000 events. I suggest however that you refrain from designing level where this is an eminent possibility.

Using the event command Erase Event will not entirely delete the event.

The event still exists in the $game_map.events and lags about as much as a blank events.

 

And finally: ENJOY!

 

- Zeriab

Share this post


Link to post
Share on other sites

Thanks.

Go ahead and use it if you want to.

If you use it I would like to hear any problems or issues you might have with it.

Share this post


Link to post
Share on other sites

I'll let you know...first,t hough, I have to decide if I want to keep going with my current storyline, as someone just poited out to me the storyline has been done about a million times now...not to mention I'm stuck cause they have 4 of 7 keys, and it's still the first chapter of the game ><

Share this post


Link to post
Share on other sites

I don't care if your storyline in essence have been done millions of times as long as it is fun to play.

Anyway I would still like to know if you decide to use it. Though only use it if it fits your game.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...