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

DQ Church System

Recommended Posts

Dragon Quest Church System [XP/VX]

Description:

 

This script is meant to emulate a system used in a variety of Dragon Quest games, such as DQ III, IV, V, VI, VII, VIII, which is a priest that gives some services: Confession (Save Game), Revive (want me to point out the obvious, uh? XD), Blessing (removes cursed state) and Nothing (... seriously). One command is missing (Divination, which reveals how much experience points are left for the next level) and due to my laziness I haven't done it...

 

There's a version for both XP and VX.

 

Screenshots:

 

DQCSXP.png

XP Version

 

DQCSVX.png

VX Version

 

Instrucciones:

 

Pretty much a plug-and-play script. At anytime that you wish to call this scene, just enter the following in a 'Call script...':

 

$scene = DQCS_Command.new

 

And that's it.

 

Script:

 

XP Version:

#==============================================================================
 # ** Dragon Quest Church System
 #------------------------------------------------------------------------------
 #  By: xXDarkDragonXx / Capt. Malboro / Anemoi
 #  Last Update: 9/10/07 (M/D/Y)
 #
 #  Special thanks to SephirothTDS for helping me out with some of the coding...
 #  and his inmense patience.
 #==============================================================================

 class DQCS_Command

 #==============================================================================
 # ** Editable Part
 #==============================================================================

  # How much money does the resurrection cost?
  REVIVE_COST = 200

  # ... blessing cost? (decurse)
  BLESSING_COST = 50

  # Altered Status ID in order for the blessing command to work
  BLESSING_STATE = 17

 #==============================================================================
 # ** End of Editable Part
 #============================================================================== 

  def initialize(menu_index = 0)
	@menu_index = menu_index
  end

  def main

	@spriteset = Spriteset_Map.new
	@gold_window = Window_Gold.new
	@gold_window.back_opacity = 180
	@gold_window.update
	@gold_window.x = 480
	@gold_window.y = 0	

	@heroes = []
	for i in 0...$game_party.actors.size
	  @heroes << $game_party.actors[i].name
	end

	@heroes_command = Window_Command.new(140, @heroes)
	@heroes_command.back_opacity = 180
	@heroes_command.x = 180
	@heroes_command.y = 33  
	@heroes_command.visible = false
	@heroes_command.active = false	
	@heroes_command.index = 0

	@heroes_bendicion = Blessing_Command.new
	@heroes_bendicion.back_opacity = 180
	@heroes_bendicion.x = 180
	@heroes_bendicion.y = 64  
	@heroes_bendicion.visible = false
	@heroes_bendicion.active = false	
	@heroes_bendicion.index = 0

	@dead_heroes = @heroes

	#============================================================
	# Confession = Save Game
	# Revive = Revive a fallen ally
	# Blessing = Decurses an ally
	#============================================================
	s1 = "Confession"
	s2 = "Revive"
	s3 = "Blessing"
	s4 = "Nothing"
	@command_window = Window_Command.new(160, [s1, s2, s3, s4])
	@command_window.back_opacity = 180
	@command_window.y = 0
	@command_window.x = 320
	@command_window.index = @menu_index

	 if $game_party.gold < REVIVE_COST
	   @command_window.disable_item(1)
	   @revive_disable = true
	  else
	   @revive_disable = false
	 end

	 if $game_party.gold < BLESSING_COST
	   @command_window.disable_item(2)
	   @bendicion_disable = true
	  else
	   @bendicion_disable = false
	 end	

	 if $game_system.save_disabled
	   @command_window.disable_item(0)
	 end

	Graphics.transition
	loop do
	 Graphics.update
	 Input.update
	 update
	 if $scene != self
	  break
	 end
   end

   Graphics.freeze
   @gold_window.dispose		
   @command_window.dispose	 
   @heroes_command.dispose	 
   @heroes_bendicion.dispose   
   @spriteset.dispose
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update

   @heroes_command.update
   @heroes_bendicion.update
   @command_window.update
   @gold_window.update

  #--------------------------------------------------------------------------
  # ** Revive
  #--------------------------------------------------------------------------

   if $game_party.gold < REVIVE_COST
	 @command_window.disable_item(1)
	 @revive_disable = true
	else
	 @revive_disable = false
   end  

	 for i in 0...$game_party.actors.size
	  if $game_party.actors[i].hp != 0	
		  @dead_heroes[i] = nil
		end		
	  end

  $game_party.actors.each do |actor|
	if actor.hp == 0	
	   @heroes_command.disable_item(actor.index)
	end
  end	  

  #--------------------------------------------------------------------------
  # ** Blessing
  #--------------------------------------------------------------------------

   if $game_party.gold < BLESSING_COST
	 @command_window.disable_item(2)
	 @bendicion_disable = true
   else
	 @bendicion_disable = false
   end  

   if @heroes_command.active
	  update_revive
	  return
	end  

   if @heroes_bendicion.active
	  update_bendicion
	  return
	end  

   if @command_window.active
	  update_command
	  return
	end
  end

  #--------------------------------------------------------------------------
  # * Update revive window Command
  #--------------------------------------------------------------------------	
  def update_revive  

	if Input.trigger?(Input::B)
		@heroes_command.visible = false
		@heroes_command.active = false	
		@command_window.active = true		
	  return
	end

	if Input.trigger?(Input::C)
	  if $game_party.actors[@heroes_command.index].hp == 0
		 $game_party.lose_gold(REVIVE_COST)
		 $game_system.se_play($data_system.shop_se)
		 @gold_window.refresh
		 $game_party.actors[@heroes_command.index].recover_all
		 @heroes_command.draw_item(@heroes_command.index, Color.new(255, 255, 255, 255))
		return
	  else
		$game_system.se_play($data_system.buzzer_se)
	 end
	end
  end

  #--------------------------------------------------------------------------
  # * Update bendicion window Command
  #--------------------------------------------------------------------------	
  def update_bendicion  

	if Input.trigger?(Input::B)
		@heroes_bendicion.visible = false
		@heroes_bendicion.active = false	
		@command_window.active = true		
	  return
	end

	if Input.trigger?(Input::C)
		$game_system.se_play($data_system.buzzer_se) if $game_party.gold < BLESSING_COST
		$game_system.se_play($data_system.buzzer_se) if @heroes_bendicion.cursed_actors[@heroes_bendicion.index] == false
		return unless $game_party.gold >= BLESSING_COST
		 if @heroes_bendicion.cursed_actors[@heroes_bendicion.index] == true
		   $game_party.lose_gold(BLESSING_COST)
		   $game_system.se_play($data_system.shop_se)
		   @gold_window.refresh
		   $game_party.actors[@heroes_bendicion.index].states.delete(BLESSING_STATE)
		   @heroes_bendicion.verify_use
		   @heroes_bendicion.refresh
		  return
		 end	  
	   end	
	   return
	 end

  #--------------------------------------------------------------------------
  # * Update Window Command
  #--------------------------------------------------------------------------  
  def update_command	
	if Input.trigger?(Input::B)
	  $game_system.se_play($data_system.cancel_se)
	  $scene = Scene_Map.new
	  return
	end

	if Input.trigger?(Input::C)
	  if $game_party.actors.size == 0 and @command_window.index < 4
		$game_system.se_play($data_system.buzzer_se)
		return
	  end

	  case @command_window.index
	  when 0 # Confession
		if $game_system.save_disabled
		  $game_system.se_play($data_system.buzzer_se)
		  return
		end
		$game_system.se_play($data_system.decision_se)
		$scene = Scene_Save.new
		$game_system.se_play($data_system.cancel_se)
	  when 1 # Revive
	   if @revive_disable != true
		$game_system.se_play($data_system.decision_se)
		@heroes_command.visible = true
		@heroes_command.active = true	
		@command_window.active = false
	   return		
	  else
	  $game_system.se_play($data_system.buzzer_se)		
	  return
	 end
	  when 2 # Blessing
	   if @bendicion_disable != true
		$game_system.se_play($data_system.decision_se)
		@heroes_bendicion.visible = true
		@heroes_bendicion.active = true	
		@command_window.active = false
	   return		
	  else
	  $game_system.se_play($data_system.buzzer_se)		
	  return
	 end
	  when 3
		$game_system.se_play($data_system.decision_se)
		$scene = Scene_Map.new
	  end
	  return
	end
  end

 #==============================================================================
 # ** Blessing Command Window
 #==============================================================================  
 class Blessing_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :cursed_actors			 # Variable flag for cursed actors	  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------  
  def initialize

	super(180, 64, 140, $game_party.actors.size * 32)
	@item_max = $game_party.actors.size
	@item_count = $game_party.actors.size + 1
	self.height = @item_count * 32
	@column_max = 1
	self.contents = Bitmap.new(width - 32, height - 32)
	self.back_opacity = 180
	self.index = 0
	# Cursed state
	@cursed_state = BLESSING_STATE
	# Cursed actors array
	@cursed_actors = []
	refresh
  end

  #--------------------------------------------------------------------------
  # * Verify if character can be used
  #--------------------------------------------------------------------------
  def verify_use
	$game_party.actors.each {|x| @cursed_actors << x.state?(@cursed_state)}	
	return  
  end  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh

	@cursed_actors.clear
	self.contents.clear
	verify_use

	for i in 0...$game_party.actors.size	  
	 @actor = $game_party.actors[i]  
	  x = 8
	  y = i * 32		
	  self.contents.font.color = (@cursed_actors[i] == true ? disabled_color : normal_color)
	  self.contents.draw_text(x, y, 120, 32, @actor.name)	
	end		
   end
  end
 end

 

VX Version:

	 #==============================================================================
 # ** Window_Base
 #------------------------------------------------------------------------------
 # Adding a color to Window Base. I just missed the old XP '.disabled_color'
 #==============================================================================

 class Window_Base

   #--------------------------------------------------------------------------
   # ● Disabled Color
   #--------------------------------------------------------------------------
   def disabled_color
	 return text_color(8)
   end
 end

 #==============================================================================
 # ** Dragon Quest Church System
 #------------------------------------------------------------------------------
 #  By: xXDarkDragonXx / Capt. Malboro / Anemoi
 #  Last Update: 1/24/08 (M/D/Y)
 #
 #  Special thanks to SephirothTDS for helping me out with some of the coding...
 #  and his inmense patience.
 #==============================================================================

 class DQCS_Command

 #==============================================================================
 # ** Editable Part
 #==============================================================================

  # How much money does the resurrection cost?
  REVIVE_COST = 200

  # ... blessing cost? (decurse)
  BLESSING_COST = 50

  # Altered Status ID in order for the blessing command to work
  BLESSING_STATE = 17

 #==============================================================================
 # ** End of Editable Part
 #============================================================================== 

 def initialize(menu_index = 0)
   @menu_index = menu_index
 end

 def main

   @spriteset = Spriteset_Map.new

   @gold_window = Window_Gold.new(383, 0)
   @gold_window.back_opacity = 180
   @gold_window.update  

   @heroes = []
   for i in 0...$game_party.members.size
	 @heroes << $game_party.members[i].name
   end

   @heroes_command = Window_Command.new(140, @heroes)
   @heroes_command.back_opacity = 180
   @heroes_command.x = 83
   @heroes_command.y = 0  
   @heroes_command.visible = false
   @heroes_command.active = false	
   @heroes_command.index = 0

   @heroes_bendicion = Blessing_Command.new
   @heroes_bendicion.back_opacity = 180
   @heroes_bendicion.visible = false
   @heroes_bendicion.active = false	
   @heroes_bendicion.index = 0

   @dead_heroes = @heroes

   #============================================================
   # Confession = Save Game
   # Revive = Revive a fallen ally
   # Blessing = Decurses an ally
   #============================================================
   s1 = "Confession"
   s2 = "Revive"
   s3 = "Blessing"
   s4 = "Nothing"
   @command_window = Window_Command.new(160, [s1, s2, s3, s4])
   @command_window.back_opacity = 180
   @command_window.x = 223
   @command_window.y = 0
   @command_window.index = @menu_index

	if $game_party.gold < REVIVE_COST
	  @command_window.draw_item(1, false)
	  @revive_disable = true
	 else
	  @revive_disable = false
	end

	if $game_party.gold < BLESSING_COST
	  @command_window.draw_item(2, false)
	  @bendicion_disable = true
	 else
	  @bendicion_disable = false
	end	

	if $game_system.save_disabled
	  @command_window.draw_item(0, false)
	end

   Graphics.transition
   loop do
	Graphics.update
	Input.update
	update
	if $scene != self
	 break
	end
  end

  Graphics.freeze
  @gold_window.dispose		
  @command_window.dispose	 
  @heroes_command.dispose	 
  @heroes_bendicion.dispose   
  @spriteset.dispose
 end

 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update

  @heroes_command.update
  @heroes_bendicion.update
  @command_window.update
  @gold_window.update

 #------------------------------------------------------------
 # ** Resurrection
 #------------------------------------------------------------

  if $game_party.gold < REVIVE_COST
	@command_window.draw_item(1, false)
	@revive_disable = true
   else
	@revive_disable = false
  end  

	for i in 0...$game_party.members.size
	 if $game_party.members[i].hp != 0	
		 @dead_heroes[i] = nil
	   end		
	 end

 $game_party.members.each do |actor|
   if actor.hp == 0	
	  @heroes_command.draw_item(actor.index, false)
   end
 end	  

 #------------------------------------------------------------
 # ** Blessing
 #------------------------------------------------------------

  if $game_party.gold < BLESSING_COST
	@command_window.draw_item(2, false)
	@bendicion_disable = true
  else
	@bendicion_disable = false
  end  

  if @heroes_command.active
	 update_revive
	 return
   end  

  if @heroes_bendicion.active
	 update_bendicion
	 return
   end  

  if @command_window.active
	 update_command
	 return
   end
 end

 #--------------------------------------------------------------------------
 # * Update revive window Command
 #--------------------------------------------------------------------------	
 def update_revive  

   if Input.trigger?(Input::B)
	   @heroes_command.visible = false
	   @heroes_command.active = false	
	   @command_window.active = true		
	 return
   end

   if Input.trigger?(Input::C)
	 if $game_party.members[@heroes_command.index].hp == 0
		$game_party.lose_gold(REVIVE_COST)
		Sound.play_shop
		@gold_window.refresh
		$game_party.members[@heroes_command.index].recover_all
		@heroes_command.draw_item(@heroes_command.index, Color.new(255, 255, 255, 255))
	   return
	 else
	   Sound.play_buzzer
	end
   end
 end

 #--------------------------------------------------------------------------
 # * Update bendicion window Command
 #--------------------------------------------------------------------------	
 def update_bendicion  

   if Input.trigger?(Input::B)
	   @heroes_bendicion.visible = false
	   @heroes_bendicion.active = false	
	   @command_window.active = true		
	 return
   end

   if Input.trigger?(Input::C)
	   Sound.play_buzzer if $game_party.gold < BLESSING_COST
	   Sound.play_buzzer if @heroes_bendicion.cursed_actors[@heroes_bendicion.index] == false
	   return unless $game_party.gold >= BLESSING_COST
		if @heroes_bendicion.cursed_actors[@heroes_bendicion.index] == true
		  $game_party.lose_gold(BLESSING_COST)
		  Sound.play_shop
		  @gold_window.refresh
		  $game_party.members[@heroes_bendicion.index].remove_state(BLESSING_STATE)
		  @heroes_bendicion.verify_use
		  @heroes_bendicion.refresh
		 return
		end	  
	  end	
	  return
	end

 #--------------------------------------------------------------------------
 # * Update Window Command
 #--------------------------------------------------------------------------  
 def update_command	
   if Input.trigger?(Input::B)
	 Sound.play_cancel
	 $scene = Scene_Map.new
	 return
   end

   if Input.trigger?(Input::C)
	 if $game_party.members.size == 0 and @command_window.index < 4
	   Sound.play_buzzer
	   return
	 end

	 case @command_window.index
	 when 0  # Confession
	   if $game_system.save_disabled
		 Sound.play_buzzer
		 return
	   end
	   Sound.play_decision
	   $scene = Scene_File.new(true, false, false)
	 when 1  # Revive
	  if @revive_disable != true
	   Sound.play_decision
	   @heroes_command.visible = true
	   @heroes_command.active = true	
	   @command_window.active = false
	  return		
	 else
	 Sound.play_buzzer		
	 return
	end

	 when 2  # Blessing
	  if @bendicion_disable != true
	   Sound.play_decision
	   @heroes_bendicion.visible = true
	   @heroes_bendicion.active = true	
	   @command_window.active = false
	  return		
	 else
	 Sound.play_buzzer	  
	 return
	 end
	 when 3  # Nothing
	   Sound.play_decision
	   $scene = Scene_Map.new
	 end
	 return
   end
 end


 #==============================================================================
 # ** Blessing Command Window
 #============================================================================== 

 class Blessing_Command < Window_Selectable

 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------

 attr_accessor   :cursed_actors			 # Variable flag for cursed actors

 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------  
 def initialize

   super(83, 0, 140, $game_party.members.size * 32)
   @item_max = $game_party.members.size
   @item_count = $game_party.members.size
   self.height = @item_count * 32
   @column_max = 1
   self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
   self.back_opacity = 180
   self.index = 0
   # Cursed state
   @cursed_state = BLESSING_STATE
   # Cursed actors array
   @cursed_actors = []
   refresh
 end

 #--------------------------------------------------------------------------
 # * Verify if character can be used
 #--------------------------------------------------------------------------
 def verify_use
   $game_party.members.each {|x| @cursed_actors << x.state?(@cursed_state)}	
   return  
 end  
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh

   @cursed_actors.clear
   self.contents.clear
   verify_use

   for i in 0...$game_party.members.size	  
	@actor = $game_party.members[i]  
	 x = 8
	 y = i * 24
	 self.contents.font.color = (@cursed_actors[i] == true ? disabled_color : normal_color)
	 self.contents.draw_text(x, y, 140, 24, @actor.name)	
   end		
  end
 end
 end

 

Demo:

 

No demo. Just test it out.

Compatibility Issues:

 

None that I'm aware of.

 

Author's Comments:

 

These two scripts were my very first, so a lot of garbage code is guaranteed to be found and some careless mistakes as well. On a sidenote one may see a weird thing... The commands (when choosing which character) that appear as WHITE are disabled and the ones that are GRAY are enabled. I know. It should be viceversa but I just can't find a way to fix it. Maybe I'm not looking in the right place... Ironic, I made the script yet I do not know how to fix it. XD

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...