RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Advance Debug System 1.1

Started by Season In The Abyss, April 09, 2006, 05:33:25 PM

0 Members and 1 Guest are viewing this topic.

Season In The Abyss

Advance Debug System 1.1

Last Update
April 9, 2006
- Added allow or disallow encounters feature.
- Fixed the actors' level part.
- Faster scene.


Overview
This script allow you change more game settings when you're testing it.
The added options are:
- Edit the amount of gold
- Edit the actors' levels
- Add weapons, armors or items to the party
- Allow or disallow the encounters (new!)


How use it?
It need be inserted below Scene_Debug and above Main.
To open it, you need be testing the game and press F9.


Script
#==============================================================================
# ** Advance Debug System
#------------------------------------------------------------------------------
# Slipknot
# 1.1
# 04.05.06
#==============================================================================

#------------------------------------------------------------------------------
# Begin Scene_Debug Rewrite
#------------------------------------------------------------------------------
class Scene_Debug
  #--------------------------------------------------------------------------
  def main
    spriteset = Spriteset_Map.new
    vp = Viewport.new(0, 0, 640, 480)
    vp.tone = Tone.new(-64, -64, -64)
    @left_window = Window_DebugLeft.new
    @right_window = Window_DebugRight.new
    @help_window = Window_Base.new(192, 352, 448, 128)
    @help_window.contents = Bitmap.new(406, 96)
    @help_window2 = Window_Base.new(320, 352, 320, 128)
    @help_window2.contents = Bitmap.new(288, 96)
    @left_window.top_row = $game_temp.debug_top_row
    @left_window.index = $game_temp.debug_index
    @right_window.mode = @left_window.mode
    @right_window.top_id = @left_window.top_id
    @command = Window_Command.new(256, ['Switches and Variables',
      'Gold', 'Items, Weapons & Armors', 'Levels', 'Allow/Disallow Encounters',
      'Exit'])
    @command.x = 192
    @command.y = 112
    @gold_window = Window_Debug_Gold.new
    @items_window = Window_Debug_Items.new
    @levels_window = Window_Debug_Levels.new
    @items_back = Window_Base.new(0, 0, 320, 480)
    @items_back.contents = Bitmap.new(288, 32)
    @encounter_window = Window_Command.new(128, ['Allow', 'Disallow', 'Cancel'])
    @encounter_window.x = 256
    @encounter_window.y = 176
    visact(@encounter_window, false)
    @phase2_objects = [@left_window, @right_window, @help_window]
    @phase2_objects.each { |x| x.visible = false }
    @phase4_objects = [@items_window, @help_window2, @items_back]
    @phase4_objects.each { |x| x.visible = false }
    @phase = 1
    Graphics.transition
    while $scene == self
      Graphics.update
      Input.update
      eval('update_phase_' + @phase.to_s)
    end
    $game_map.refresh
    Graphics.freeze
    @phase2_objects.each { |x| x.dispose }
    @phase4_objects.each { |x| x.dispose }
    [@gold_window, @command, @encounter_window,
       spriteset, vp].each do |x|
      x.dispose
    end
  end
  #--------------------------------------------------------------------------
  def visact(obj, val = true)
    obj.visible = obj.active = val
  end
  #--------------------------------------------------------------------------
  def self_close(sound)
    $game_system.se_play(sound)
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  def update_phase_1
    @command.update
    if Input.trigger?(12)
      self_close($data_system.cancel_se)
    end
    if Input.trigger?(13)
      $game_system.se_play($data_system.decision_se)
      case @command.index
      when 0
        visact(@command, false)
        @help_window.contents.clear
        @phase2_objects.each { |x|x.visible = true }
        @phase = 2
        return
      when 1
        visact(@command, false)
        @gold_window.visible = true
        text = ['Up : +1       Down : -1', 'Right : +10  Left   : -10',
          'R : +100      L : -100']
        @help_window.contents.clear
        for i in 0...text.size do
          @help_window.contents.draw_text(4, 32 * i, 406, 32, text[i])
        end
        @help_window.visible = true
        @phase = 3
        return
      when 2
        visact(@command, false)
        @items_window.visible = true
        text = ['Right : +1  Left   : -1', 'A: Change mode']
        @help_window2.contents.clear
        phase_4_mode_refresh
        for i in 0...text.size do
          @help_window2.contents.draw_text(4, 32 * i, 406, 32, text[i])
        end
        @phase4_objects.each { |x| x.visible = true }
        @phase = 4
        return
      when 3
        visact(@command, false)
        @levels_window.visible = true
        @phase = 5
        return
      when 4
        visact(@command, false)
        visact(@encounter_window)
        @phase = 6
        return
      when 5 then self_close($data_system.decision_se)
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_phase_2
    @phase2_objects.each { |x| x.visible = true }
    @right_window.mode = @left_window.mode
    @right_window.top_id = @left_window.top_id
    @left_window.update
    @right_window.update
    $game_temp.debug_top_row = @left_window.top_row
    $game_temp.debug_index = @left_window.index
    if @left_window.active
      update_left
      return
    end
    if @right_window.active
      update_right
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_phase_3
    @gold_window.update
    if Input.trigger? 12
      $game_system.se_play($data_system.cancel_se)
      @phase = 1
      visact(@command)
      @gold_window.visible = @help_window.visible = false
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_phase_4
    @items_window.update
    if Input.trigger?(12)
      $game_system.se_play($data_system.cancel_se)
      @phase = 1
      @help_window2.visible = @items_back.visible = false
      visact(@command)
      @items_window.visible = false
      return
    end
    if Input.trigger?(11)
      $game_system.se_play($data_system.decision_se)
      @items_window.mode = (@items_window.mode + 1) % 3
      phase_4_mode_refresh
      @items_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  def phase_4_mode_refresh
    mode = case @items_window.mode
      when 0 then 'Items'
      when 1 then 'Weapons'
      when 2 then 'Armors' end
    @items_back.contents.clear
    @items_back.contents.draw_text(0, 0, 320, 32, "Mode:  #{mode}")
  end
  #--------------------------------------------------------------------------
  def update_phase_5
    @levels_window.update
    if Input.trigger?(12)
      $game_system.se_play($data_system.cancel_se)
      @phase = 1
      visact(@command)
      @levels_window.visible = false
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_phase_6
    @encounter_window.update
    if Input.trigger?(12)
      $game_system.se_play($data_system.cancel_se)
      exit = true
    end
    if Input.trigger?(13)
      $game_system.se_play($data_system.decision_se)
      if @encounter_window.index != 2
        $game_system.encounter_disabled = (@encounter_window.index == 1)
      end
      exit = true
    end
    return if exit.nil?
    @phase = 1
    visact(@command)
    visact(@encounter_window, false)
  end
  #--------------------------------------------------------------------------
  def update_left
    if Input.trigger? 12
      $game_system.se_play($data_system.cancel_se)
      @phase = 1
      @phase2_objects.each { |x| x.visible = false }
      visact(@command)
      return
    end
    if Input.trigger? 13
      $game_system.se_play($data_system.decision_se)
      if @left_window.mode == 0
        text1 = 'C (Enter) : ON / OFF'
        @help_window.contents.draw_text(4, 0, 406, 32, text1)
      else
        text = ['Left : -1         Right : +1', 'L (Pageup) : -10', 'R (Pagedown) : +10']
        for i in 0...text.size do
          @help_window.contents.draw_text(4, 32 * i, 406, 32, text[i])
        end
      end
      @left_window.active = false
      @right_window.active = true
      @right_window.index = 0
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_right
    if Input.trigger?(12)
      $game_system.se_play($data_system.cancel_se)
      @left_window.active = true
      @right_window.active = false
      @right_window.index = -1
      @help_window.contents.clear
      return
    end
    current_id = @right_window.top_id + @right_window.index
    if @right_window.mode == 0
      if Input.trigger?(13)
        $game_system.se_play($data_system.decision_se)
        $game_switches[current_id] = (not $game_switches[current_id])
        @right_window.refresh
        return
      end
    end
    max = 99_999_999
    if @right_window.mode == 1
      if Input.repeat?(6)
        $game_system.se_play($data_system.cursor_se)
        $game_variables[current_id] += 1
        if $game_variables[current_id] > max
          $game_variables[current_id] = max
        end
        @right_window.refresh
        return
      end
      if Input.repeat?(4)
        $game_system.se_play($data_system.cursor_se)
        $game_variables[current_id] -= 1
        if $game_variables[current_id] < -max
          $game_variables[current_id] = -max
        end
        @right_window.refresh
        return
      end
      if Input.repeat?(18)
        $game_system.se_play($data_system.cursor_se)
        $game_variables[current_id] += 10
        if $game_variables[current_id] > max
          $game_variables[current_id] = max
        end
        @right_window.refresh
        return
      end
      if Input.repeat?(17)
        $game_system.se_play($data_system.cursor_se)
        $game_variables[current_id] -= 10
        if $game_variables[current_id] < -max
          $game_variables[current_id] = -max
        end
        @right_window.refresh
        return
      end
    end
  end
end
#------------------------------------------------------------------------------
# End Scene_Debug Rewrite
#------------------------------------------------------------------------------

class Window_Debug_Levels < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 280, 480)
    @item_max = $game_party.actors.size
    self.contents = Bitmap.new(248, @item_max * 32)
    self.index = 0
    self.visible = false
    refresh true
  end
  #--------------------------------------------------------------------------
  def visible=(val)
    super
    refresh(true) if val
  end
  #--------------------------------------------------------------------------
  def refresh(change = false)
    contents.clear if change
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if change
        contents.font.color = normal_color
        contents.draw_text(4, i * 32, 32, 32, "#{i+1}:")
        contents.draw_text(34, i * 32, 120, 32, actor.name)
        contents.draw_text(160, i * 32, 54, 32, 'Level:')
      end
      contents.font.color = system_color
      rect = Rect.new(212, i * 32, 32, 32)
      contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      contents.draw_text(rect, actor.level.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  def update
    if Input.repeat?(2)
      $game_system.se_play($data_system.cursor_se)
      self.index = (@index + 1) % @item_max
    end
    if Input.repeat?(8)
      $game_system.se_play($data_system.cursor_se)
      self.index = (@index - 1 + @item_max) % @item_max
    end
    if Input.repeat?(6)
      $game_system.se_play($data_system.cursor_se)
      actor.level += 1
      refresh
    end
    if Input.repeat?(4)
      $game_system.se_play($data_system.cursor_se)
      actor.level -= 1
      refresh
    end
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  def actor
    $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
end

class Window_Debug_Gold < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 224, 96)
    self.contents = Bitmap.new(192, 64)
    @index = 0
    self.visible = false
    contents.draw_text(0, 0, 192, 32, 'Current gold:')
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh
    rect = Rect.new(0, 32, 192, 32)
    contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    contents.draw_text(rect, $game_party.gold.to_s, 2)
  end
  #--------------------------------------------------------------------------
  def update
    if Input.repeat?(8)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(1)
      refresh
    end
    if Input.repeat?(2)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(-1)
      refresh
    end
    if Input.repeat?(6)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(10)
      refresh
    end
    if Input.repeat?(4)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(-10)
      refresh
    end
    if Input.repeat?(18)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(100)
      refresh
    end
    if Input.repeat?(17)
      $game_system.se_play($data_system.cursor_se)
      $game_party.gain_gold(-100)
      refresh
    end 
  end
end

class Window_Debug_Items < Window_Selectable
  #--------------------------------------------------------------------------
  attr_accessor(:mode)
  attr_writer(:index)
  #--------------------------------------------------------------------------
  def initialize
    super(0, 32, 320, 448)
    self.index = self.opacity = @mode = 0
    @data = $data_items
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh(change = true)
    if change
      @data = case @mode
        when 0 then $data_items
        when 1 then $data_weapons
        when 2 then $data_armors
        end
      @item_max = @data.size - 1
      self.contents = Bitmap.new(288, @item_max * 32)
    end
    for i in 1..@item_max
      y = (i - 1) * 32
      if change
        item = @data[i]
        contents.draw_text(4, y, 32, 32, "#{i.to_s}:")
        draw_item_name(item, 32, y)
        contents.draw_text(256, y, 32, 32, ':')
      end
      number = case @mode
        when 0 then $game_party.item_number(i)
        when 1 then $game_party.weapon_number(i)
        when 2 then $game_party.armor_number(i)
        end
      rect = Rect.new(250, y, 32, 32)
      contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      contents.draw_text(rect, "#{number}", 2)
    end
  end
  #--------------------------------------------------------------------------
  def update
    if Input.repeat?(2)
      $game_system.se_play($data_system.cursor_se)
      @index = (@index + 1) % @item_max
    end
    if Input.repeat?(8)
      $game_system.se_play($data_system.cursor_se)
      @index = (@index - 1 + @item_max) % @item_max
    end
    gain(1)  if Input.repeat?(6)
    gain(-1) if Input.repeat?(4)
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  def gain(n)
    $game_system.se_play($data_system.cursor_se)
    case @mode
    when 0 then $game_party.gain_item(@index + 1, n)
    when 1 then $game_party.gain_weapon(@index + 1, n)
    when 2 then $game_party.gain_armor(@index + 1, n)
    end
    refresh(false)
  end
end

Master_of_Time

Cool beans, dude. I like it!  :-D
DEATH: Master of Time, your life is at it's end! Mwahahahaha!
MOT: Whatever, dude *throws crumpled piece of paper at Death and runs away*
DEATH:....?

TrubuTe

cool.but you should add "change party".  :-D
... yeah right

.:Pyroken Serafoculus:.

This is handy! I suggest adding "Change Skills", for those of us who like to invent new ones. And possibly a battle test, using the current party.
...

Lavoakah

nice! thats gonna come in handy! the amount of times I've wanted to test shops but had no gold!
Thanks!