Jump to content
LadyNinja

Simple Quest script conversion from RMXP to RMVXA

Recommended Posts

Spoiler

#==========================================================================
# Window_Journal
#------------------------------------------------------------------------------
#   This window displays a journal.
#==========================================================================
    
class Window_Journal < Window_Selectable
     # ------------------------
     def initialize
          super(0, 32, 460, 330)
          
     #----------------------------------------------------------
     # populate your journal with entries.
          @data = []
          @data[1] = "Sniff the Glove"
          @data[2] = "Jump off a bridge after your friends"
          
     # this is the offset for your switches. If you start with switch 100, set @offset = 99
     # con neu muon start with switch 1 thi set offset = 0
    
     @offset = 99
          
     ### to change the windowskin for the journal
     #    self.windowskin = RPG::Cache.windowskin("RMXP4life_Wood.png")
    
    
     #----------------------------------------------------------
    
          @column_max = 1
          refresh
          self.index = 0
       end
    
    
     #--------------------------------------------------------------------------
     # * Draw the contents of the item window
     #--------------------------------------------------------------------------
       def refresh
          if self.contents != nil
             self.contents.dispose
             self.contents = nil
          end
          
          # variables
          @journal_height = (@data.size - 1)*32    # y coord of entire journal (# of entries - 1) * 32
          @n = 0                           # y coord for each entry
          @item_max = 0                 # max items to display
          
          # draw the bitmap. the text will appear on this bitmap
          self.contents = Bitmap.new(width - 32, @journal_height)
             
          for i in 1...@data.size
             if $game_switches[i + @offset] == true
                draw_item(i)
                @item_max += 1
             end
          end         
       
       end
          
     #--------------------------------------------------------------------------
     # * Draw an individual item in the window
     #      index : Index of the item to be drawn
     #--------------------------------------------------------------------------
    
       def draw_item(index)
              item = @data[index]
              rect = Rect.new(10, @n, 640, 32)
              self.contents.fill_rect(rect, Color.new(0,0,0,0))       
              self.contents.draw_text(10, @n, 640, 32, "-", 0)
              self.contents.draw_text(25, @n, 640, 32, item, 0)
              @n += 32
             
       end
     end

 

Spoiler

#==============================================================================
     #  –  Scene_Status
     #------------------------------------------------------------------------------
     #  This class contains the windows for the character status menu that can be
     #    accessed from the main menu.
     #==========================================================================
    
     class Scene_Journal
        #--------------------------------------------------------------------------
        #  — Initialize the Status menu
        #--------------------------------------------------------------------------
        def initialize(callback = 0)   #callback from menu
           @callback = callback
        end
       
        def main
    
           @journal_window = Window_Journal.new
           @journal_window.x = 90
           @journal_window.y = 70
          
           Graphics.transition
    
           loop do
              Graphics.update
              Input.update
              update
              if $scene != self
                 break
              end   
           end
    
           Graphics.freeze
           @journal_window.dispose
    
        end
        #--------------------------------------------------------------------------
        #  — Draw the Status menu
        #--------------------------------------------------------------------------
        def update
           @journal_window.update
           if @journal_window.active
              update_item
              return
           end
        end
    
        #--------------------------------------------------------------------------
        #  — Update menu after player makes a selection
        #--------------------------------------------------------------------------
        def update_item
          
           # Cancel key pressed (go to menu)
           if Input.trigger?(Input::B) or Input.trigger?(Input::L)
              $game_system.se_play($data_system.cancel_se)
              if @callback == 0
                 $scene = Scene_Menu.new(6)
              else
                 $scene = Scene_Map.new
              end
              return
           end
          
        end
       
     end

 

There are 2 parts of it. Plz help me. 😻

Share this post


Link to post
Share on other sites
19 hours ago, PhoenixSoul said:

Will this not run as is?

No. XP uses $scene for scene control. This has to be converted.

I have already attempted this and I'm still not good enough to get it on the first try.

It partially works. But I have to put the script into an xp demo to see how it is supposed to work.

Right now my conversion will open the journal and present the titles, but not scroll or do anything else.

(preserving the script function by switch control)

 

*Update - so far I can either make the selectable lines the number of quests lines or 1

The script doesn't seem to do anything except display the active journal (quest) entries.

If it is just a display then you could just have it as a static display.

Otherwise. I just about done with this. I have too much other work to do.

 

Here is a static display script version

Spoiler

#==========================================================================
# Window_Journal
#------------------------------------------------------------------------------
#   This window displays a journal.
#==========================================================================

class Window_Journal < Window_Selectable
# ------------------------
  def initialize(x, y, width, height)
    set_quests
    @offset = 10
    # this is the offset for your switches. If you start with switch 100, 
    # set @offset = 99
    # start with switch 1 -> offset = 0
    ### to change the windowskin for the journal
    #    self.windowskin = RPG::Cache.windowskin("RMXP4life_Wood.png")
    #----------------------------------------------------------
    @column_max = 1
    super
    refresh
    self.index = -1 # hide cursor
    return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  end
  
  def set_quests
    # populate your journal with entries.
    @quest = []
    @quest[1] = "Sniff the Glove"
    @quest[2] = "Jump off a bridge after your friends"
    @quest[3] = "Scroll down here"
  end

  def line_height
    return 32
  end

#--------------------------------------------------------------------------
# * Draw the contents of the item window
#--------------------------------------------------------------------------
  def refresh
    # variables
    @journal_height = (@quest.size - 1) * 32
    # y coord of entire journal (# of entries - 1) * 32
    @n = 0                           # y coord for each entry
    @item_max = 0                 # max items to display
    # draw the bitmap. the text will appear on this bitmap
    for i in 1...@quest.size
      if $game_switches[i + @offset] == true
        draw_item(i)
      end
    end
  end

#--------------------------------------------------------------------------
# * Draw an individual item in the window
#      index : Index of the item to be drawn
#--------------------------------------------------------------------------

  def draw_item(index)
    item = @quest[index]
    rect = Rect.new(10, @n, 640, 32)
    self.contents.fill_rect(rect, Color.new(0,0,0,0))       
    self.contents.draw_text(10, @n, 640, 32, "-", 0)
    self.contents.draw_text(25, @n, 640, 32, item, 0)
    @n += 32
  end
  
end

#==============================================================================
#  –  Scene_Status
#------------------------------------------------------------------------------
#  This class contains the windows for the character status menu that can be
#    accessed from the main menu.
#==========================================================================

class Scene_Journal < Scene_Base
#--------------------------------------------------------------------------
#  — Initialize the Status menu
#--------------------------------------------------------------------------
  def start
    super
    create_journal_window
  end
  
  def create_journal_window
    @journal_window = Window_Journal.new(50, 50, Graphics.width - 100, Graphics.height - 100)
    @journal_window.set_handler(:cancel,   method(:return_scene))
    @journal_window.activate
  end
end

 

 

Edited by roninator2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×