Scripts, Tutorials & Tools This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old June 25th, 2014 (2:29 AM). Edited July 24th, 2014 by mej71.
mej71's Avatar
mej71 mej71 is offline
     
    Join Date: Mar 2014
    Location: Omnipresence
    Gender: Male
    Posts: 1,219
    I always wanted to use Mobius' Quest Journal for my game, but there are some important differences in Essentials that prevent it from working as is. I did just a bit of tweaking, and it seems to work fine.

    See the link above for more info about using the script and writing the .txt document (it goes in your /Data folder), as well as a sample project file and a simple program for writing/editing the text document.

    Basically, just copy this in above the main.
    Spoiler:
    Code:
    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This class is for all in-game windows.
    #==============================================================================
    
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # * Object Initialization
      #     x      : window x-coordinate
      #     y      : window y-coordinate
      #     width  : window width
      #     height : window height
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super()
        $game_system.windowskin_name=("001-Blue01")
        @windowskin_name = $game_system.windowskin_name
        self.windowskin = RPG::Cache.windowskin(@windowskin_name)
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.z = 100
      end
      #--------------------------------------------------------------------------
      # * Dispose
      #--------------------------------------------------------------------------
      def dispose
        # Dispose if window contents bit map is set
        if self.contents != nil
          self.contents.dispose
        end
        super
      end
      #--------------------------------------------------------------------------
      # * Get Text Color
      #     n : text color number (0-7)
      #--------------------------------------------------------------------------
      def text_color(n)
        case n
        when 0
          return Color.new(255, 255, 255, 255)
        when 1
          return Color.new(128, 128, 255, 255)
        when 2
          return Color.new(255, 128, 128, 255)
        when 3
          return Color.new(128, 255, 128, 255)
        when 4
          return Color.new(128, 255, 255, 255)
        when 5
          return Color.new(255, 128, 255, 255)
        when 6
          return Color.new(255, 255, 128, 255)
        when 7
          return Color.new(192, 192, 192, 255)
        else
          normal_color
        end
      end
      #--------------------------------------------------------------------------
      # * Get Normal Text Color
      #--------------------------------------------------------------------------
      def normal_color
        return Color.new(255, 255, 255, 255)
      end
      #--------------------------------------------------------------------------
      # * Get Disabled Text Color
      #--------------------------------------------------------------------------
      def disabled_color
        return Color.new(255, 255, 255, 128)
      end
      #--------------------------------------------------------------------------
      # * Get System Text Color
      #--------------------------------------------------------------------------
      def system_color
        return Color.new(192, 224, 255, 255)
      end
      #--------------------------------------------------------------------------
      # * Get Crisis Text Color
      #--------------------------------------------------------------------------
      def crisis_color
        return Color.new(255, 255, 64, 255)
      end
      #--------------------------------------------------------------------------
      # * Get Knockout Text Color
      #--------------------------------------------------------------------------
      def knockout_color
        return Color.new(255, 64, 0)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        # Reset if windowskin was changed
        if $game_system.windowskin_name != @windowskin_name
          @windowskin_name = $game_system.windowskin_name
          self.windowskin = RPG::Cache.windowskin(@windowskin_name)
        end
      end
      
    end
    #==============================================================================
    # ** Window_Selectable
    #------------------------------------------------------------------------------
    #  This window class contains cursor movement and scroll functions.
    #==============================================================================
    
    class Window_Selectable < Window_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :index                    # cursor position
      attr_reader   :help_window              # help window
      #--------------------------------------------------------------------------
      # * Object Initialization
      #     x      : window x-coordinate
      #     y      : window y-coordinate
      #     width  : window width
      #     height : window height
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super(x, y, width, height)
        @item_max = 1
        @column_max = 1
        @index = -1
      end
      #--------------------------------------------------------------------------
      # * Set Cursor Position
      #     index : new cursor position
      #--------------------------------------------------------------------------
      def index=(index)
        @index = index
        # Update Help Text (update_help is defined by the subclasses)
        if self.active and @help_window != nil
          update_help
        end
        # Update cursor rectangle
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # * Get Row Count
      #--------------------------------------------------------------------------
      def row_max
        # Compute rows from number of items and columns
        return (@item_max + @column_max - 1) / @column_max
      end
      #--------------------------------------------------------------------------
      # * Get Top Row
      #--------------------------------------------------------------------------
      def top_row
        # Divide y-coordinate of window contents transfer origin by 1 row
        # height of 32
        return self.oy / 32
      end
      #--------------------------------------------------------------------------
      # * Set Top Row
      #     row : row shown on top
      #--------------------------------------------------------------------------
      def top_row=(row)
        # If row is less than 0, change it to 0
        if row < 0
          row = 0
        end
        # If row exceeds row_max - 1, change it to row_max - 1
        if row > row_max - 1
          row = row_max - 1
        end
        # Multiply 1 row height by 32 for y-coordinate of window contents
        # transfer origin
        self.oy = row * 32
      end
      #--------------------------------------------------------------------------
      # * Get Number of Rows Displayable on 1 Page
      #--------------------------------------------------------------------------
      def page_row_max
        # Subtract a frame height of 32 from the window height, and divide it by
        # 1 row height of 32
        return (self.height - 32) / 32
      end
      #--------------------------------------------------------------------------
      # * Get Number of Items Displayable on 1 Page
      #--------------------------------------------------------------------------
      def page_item_max
        # Multiply row count (page_row_max) times column count (@column_max)
        return page_row_max * @column_max
      end
      #--------------------------------------------------------------------------
      # * Set Help Window
      #     help_window : new help window
      #--------------------------------------------------------------------------
      def help_window=(help_window)
        @help_window = help_window
        # Update help text (update_help is defined by the subclasses)
        if self.active and @help_window != nil
          update_help
        end
      end
      #--------------------------------------------------------------------------
      # * Update Cursor Rectangle
      #--------------------------------------------------------------------------
      def update_cursor_rect
        # If cursor position is less than 0
        if @index < 0
          self.cursor_rect.empty
          return
        end
        # Get current row
        row = @index / @column_max
        # If current row is before top row
        if row < self.top_row
          # Scroll so that current row becomes top row
          self.top_row = row
        end
        # If current row is more to back than back row
        if row > self.top_row + (self.page_row_max - 1)
          # Scroll so that current row becomes back row
          self.top_row = row - (self.page_row_max - 1)
        end
        # Calculate cursor width
        cursor_width = self.width / @column_max - 32
        # Calculate cursor coordinates
        x = @index % @column_max * (cursor_width + 32)
        y = @index / @column_max * 32 - self.oy
        # Update cursor rectangle
        self.cursor_rect.set(x, y, cursor_width, 32)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        # If cursor is movable
        if self.active and @item_max > 0 and @index >= 0
          # If pressing down on the directional buttons
          if Input.repeat?(Input::DOWN)
            # If column count is 1 and directional button was pressed down with no
            # repeat, or if cursor position is more to the front than
            # (item count - column count)
            if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
               @index < @item_max - @column_max
              # Move cursor down
              $game_system.se_play($data_system.cursor_se)
              @index = (@index + @column_max) % @item_max
            end
          end
          # If the up directional button was pressed
          if Input.repeat?(Input::UP)
            # If column count is 1 and directional button was pressed up with no
            # repeat, or if cursor position is more to the back than column count
            if (@column_max == 1 and Input.trigger?(Input::UP)) or
               @index >= @column_max
              # Move cursor up
              $game_system.se_play($data_system.cursor_se)
              @index = (@index - @column_max + @item_max) % @item_max
            end
          end
          # If the right directional button was pressed
          if Input.repeat?(Input::RIGHT)
            # If column count is 2 or more, and cursor position is closer to front
            # than (item count -1)
            if @column_max >= 2 and @index < @item_max - 1
              # Move cursor right
              $game_system.se_play($data_system.cursor_se)
              @index += 1
            end
          end
          # If the left directional button was pressed
          if Input.repeat?(Input::LEFT)
            # If column count is 2 or more, and cursor position is more back than 0
            if @column_max >= 2 and @index > 0
              # Move cursor left
              $game_system.se_play($data_system.cursor_se)
              @index -= 1
            end
          end
          # If R button was pressed
          if Input.repeat?(Input::R)
            # If bottom row being displayed is more to front than bottom data row
            if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
              # Move cursor 1 page back
              $game_system.se_play($data_system.cursor_se)
              @index = [@index + self.page_item_max, @item_max - 1].min
              self.top_row += self.page_row_max
            end
          end
          # If L button was pressed
          if Input.repeat?(Input::L)
            # If top row being displayed is more to back than 0
            if self.top_row > 0
              # Move cursor 1 page forward
              $game_system.se_play($data_system.cursor_se)
              @index = [@index - self.page_item_max, 0].max
              self.top_row -= self.page_row_max
            end
          end
        end
        # Update help text (update_help is defined by the subclasses)
        if self.active and @help_window != nil
          update_help
        end
        # Update cursor rectangle
        update_cursor_rect
      end
    end
    #==============================================================================
    # ** Game Quest -- Mobius
    #------------------------------------------------------------------------------
    #  The class that holds quests. Each instance of Game Quest is used to hold
    #  one quest.
    #==============================================================================
    
    class Game_Quest
      #--------------------------------------------------------------------------
      # * Class Variables
      #--------------------------------------------------------------------------
        @@total_quests = 0           # Used to track number of quest objects
    
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
        attr_reader   :id            # ID
        attr_reader   :name          # Name
        attr_accessor :phase         # Phase
        attr_reader   :known         # Known status (true / false)
        attr_reader   :completed     # Completed status (true / false)
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(name, info_array)
        @id = @@total_quests
        @@total_quests += 1
        @name = name
        @phase = 0
        @known = false
        @completed = false
        # The info array contains text that corresponds to the current phase
        # of the quest. So, you simply need to get the info in the i-th position
        # of the array for the i-th phase
        @info_array = info_array
      end
      #--------------------------------------------------------------------------
      # * Get Current Info
      # Returns text info for the current phase
      #--------------------------------------------------------------------------
      def get_current_info
        @info_array[@phase]
      end
      #--------------------------------------------------------------------------
      # * Discover
      # Changes quest state known to true 
      #--------------------------------------------------------------------------
      def discover
        @known = true
      end
      #--------------------------------------------------------------------------
      # * Complete
      # Changes quest state completed to true 
      #--------------------------------------------------------------------------
      def complete
        @completed = true
      end
      #--------------------------------------------------------------------------
      # * to_s
      # Returns quest object data as string
      # Mostly used for debugging purposes
      #--------------------------------------------------------------------------
      def to_s
        "Quest ID: #{@id}\n" +
        "Quest Name: #{@name}\n" +
        "Quest Info:\n" +
        @info_array.join("\n")
      end
      
    end
    #==============================================================================
    # ** Game_Quests
    #------------------------------------------------------------------------------
    #  This class handles the Game Quest arrays. Refer to "$game_quests" for the
    #  instance of this class.
    #==============================================================================
    
    class Game_Quests
      #--------------------------------------------------------------------------
      # * Class constants
      #--------------------------------------------------------------------------
        CREATE_ENCRYPTED = false              # Determines encrypted file creation
        USE_ENCRYPTED = false                 # Sets use of encrypted file
        QUEST_FILENAME = "Data/QuestData.txt" # Sets unencrypted filename
      
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
        attr_accessor :all_quests           # Array of all quest objects
        attr_accessor :current_quests       # Array of all current quest objects
        attr_accessor :completed_quests     # Array of all completed quest objects
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        @all_quests = []
        @current_quests = []
        @completed_quests = []
        setup
      end
      #--------------------------------------------------------------------------
      # * Add Quest - adds a quest object to the all_quests array
      #--------------------------------------------------------------------------
      def add_quest(quest)
        @all_quests.push(quest)
      end
      #--------------------------------------------------------------------------
      # * Sort Quests
      # Refreshes the current_quests and completed_quests arrays
      # Also sorts them as well as the all quests array by ID's
      #--------------------------------------------------------------------------
      def sort_quests
        # Sort the all_quests array by ID
        @all_quests.sort {|a,b| a.id <=> b.id }
        # Reset the current and completed quest arrays
        @current_quests = []
        @completed_quests = []
        # Push known and completed quests to their appropiate arrays
        for quest in @all_quests
          if quest.known and quest.completed
            @completed_quests.push(quest)
          elsif quest.known
            @current_quests.push(quest)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Discover Quest - uses quest name or id to change state of quest to known
      #--------------------------------------------------------------------------
      def discover_quest(name_or_id)
        # Check if passed value is ID
        if name_or_id.is_a?(Integer)
          # Set quest to known
          @all_quests[name_or_id].discover
        else
          # Look up quest using name
          quest_to_change = @all_quests.find {|quest| quest.name == name_or_id}
          # Set quest to known
          quest_to_change.discover
        end
        sort_quests
      end
      # Create shorthand name for eventing scripts
      alias dq discover_quest
      #--------------------------------------------------------------------------
      # * Set Phase - uses quest name or id to change phase
      #--------------------------------------------------------------------------
      def set_phase(name_or_id, phase)
        # Check if passed value is ID
        if name_or_id.is_a?(Integer)
          # Set quest to known
          @all_quests[name_or_id].phase = phase
        else
          # Look up quest using name
          quest_to_change = @all_quests.find {|quest| quest.name == name_or_id}
          # Set quest to known
          quest_to_change.phase = phase
        end
        sort_quests
      end
      # Create shorthand name for eventing scripts
      alias sp set_phase
      #--------------------------------------------------------------------------
      # * Complete Quest
      # Uses quest name or id to change state of quest to complete
      #--------------------------------------------------------------------------
      def complete_quest(name_or_id)
        # Check if passed value is ID
        if name_or_id.is_a?(Integer)
          # Set quest to known
          @all_quests[name_or_id].complete
        else
          # Look up quest using name
          quest_to_change = @all_quests.find {|quest| quest.name == name_or_id}
          # Set quest to known
          quest_to_change.complete
        end
        sort_quests
      end
      # Create shorthand name for eventing scripts
      alias cq complete_quest
      #--------------------------------------------------------------------------
      # * Setup - Performs first time setup of quest data
      #--------------------------------------------------------------------------
      def setup
        # if true
        if CREATE_ENCRYPTED
          # Load unencrypted data
          Game_Quests.normal_setup
          # Create encrypted .rxdata
          Game_Quests.create_encrypted
        # elsif true
        elsif USE_ENCRYPTED
          # Load encrypted data
          Game_Quests.encrypted_setup
        else
          # Load unencrypted data
          Game_Quests.normal_setup
        end
        # initialize Game_Quest object data from $data_quests array
        for quest in $data_quests
          self.add_quest(quest)
        end
        # Set Main Quest to known
        discover_quest(0)
      end
      #--------------------------------------------------------------------------
      # * GQs - Normal Setup
      # Class method that intializes normal quest data 
      #--------------------------------------------------------------------------
      def Game_Quests.normal_setup
        # Create array of quest data from file
        quest_array = File.open(QUEST_FILENAME) {|f| 
                    f.readlines("mobius_quest_break\n\n")}
        # Initialize $data_quests array
        $data_quests = Array.new
        # Create Game_Quest objects from data
        for quest_data in quest_array
          # Split quest data by paragraph
          quest_data_array = quest_data.split("\n\n")
          # Remove file delimiter "mobius_quest_break\n\n"
          quest_data_array.pop
          # Set and remove name
          name = quest_data_array.shift
          # Initialize info array
          info_array = []
          # Organize phase info into useable line lengths
          for quest_data_line in quest_data_array
            new_arr = []
            # Split phase info into words
            temp_arr = quest_data_line.split
            temp_str = ""
            for word in temp_arr
              # Rejoin words together
              temp_str.concat(word + " ")
              # When line length is useable, push to new_arr
              if temp_str.size >= 35
                new_arr.push(temp_str.strip)
                temp_str = ""
              end
            end
            # Push leftover string
            new_arr.push(temp_str.strip) unless temp_str == ""
            # Push phase info to info_array
            info_array.push(new_arr)
          end
          # Push new Game_Quest object to $data_quests array
          $data_quests.push(Game_Quest.new(name, info_array))
        end
      end
      #--------------------------------------------------------------------------
      # * GQs - Encrypted Setup
      # Class method that intializes encrypted quest data 
      #--------------------------------------------------------------------------
      def Game_Quests.encrypted_setup
        # load encrypted data
        $data_quests = load_data("Data/Quests.rxdata")
      end
      #--------------------------------------------------------------------------
      # * GQs - Create Setup
      # Class method that creates encrypted quest data 
      #--------------------------------------------------------------------------
      def Game_Quests.create_encrypted
        # save encrypted data
        save_data($data_quests, "Data/Quests.rxdata")
      end
    end
    #==============================================================================
    # ** Window Quest Info
    #------------------------------------------------------------------------------
    #  This window lists the info for the quests
    #==============================================================================
    
    class Window_QuestInfo < Window_Selectable
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize()
        super(200, 0, 300, 384)
        self.active = false
        self.contents = Bitmap.new(width - 32, height - 32)
        self.index = -1
        refresh([""])
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh(text_array)
        self.contents.clear
        self.contents.font.color = text_color(2)
        self.contents.font.name=MessageConfig.pbDefaultSystemFontName #line to fix Mac problem
        for i in 0...text_array.size
          line = text_array[i]
          self.contents.draw_text(0, i * 22, 300, 22, line)
        end
      end
    end
    #==============================================================================
    # ** Window Quest List
    #------------------------------------------------------------------------------
    #  This window lists all currently active/completed quests
    #==============================================================================
    
    class Window_QuestList < Window_Selectable 
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize()
        super(0, 0, 200, 384)
        @current_quests = []        # Array of current quests
        @completed_quests = []      # Array of completed quests
        @top_half_size = 0          # Number of rows of current quests
        @bottom_half_size = 0       # Number of rows of completed quests
        self.active = true
        self.index = 0
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        # Determine total number of rows
        @item_max = [@top_half_size + @bottom_half_size, 1].max
        if self.contents != nil
          self.contents.dispose
        end
        # Draw bitmap
        self.contents = Bitmap.new(200 - 32, row_max * 32)
        self.contents.font.color = text_color(2)
        self.contents.font.name=MessageConfig.pbDefaultSystemFontName  #line to fix Mac problem
        # Draw current quests
        for i in 0...@top_half_size
          quest_name = @current_quests[i].name
          self.contents.draw_text(8, i * 32, 200, 32, quest_name)
        end
        self.contents.font.color = disabled_color
        self.contents.font.name=MessageConfig.pbDefaultSystemFontName #line to fix Mac problem
        # Draw completed quests
        for i in 0...@bottom_half_size
          quest_name = @completed_quests[i].name
          self.contents.draw_text(8, i * 32 + @top_half_size * 
          32, 200, 32, quest_name)
        end
      end
      #--------------------------------------------------------------------------
      # * Set Quests
      #--------------------------------------------------------------------------
      def set_quests(new_current_quests, new_completed_quests)
        if @current_quests != new_current_quests or
           @completed_quests != new_completed_quests
           #set new quests
           @current_quests = new_current_quests
           @completed_quests = new_completed_quests
           @top_half_size = @current_quests.size
           @bottom_half_size = @completed_quests.size
           #call update
           refresh
        end
      end
      #--------------------------------------------------------------------------
      # * Get Index Info
      #   Returns the text info from which ever quest is currently highlighted
      #--------------------------------------------------------------------------
      def get_index_info
        # Unless there are no quests
        unless @current_quests.empty? and @completed_quests.empty?
          # Determine cursor location
         if self.index < @top_half_size
            # Get selected quest info
            @current_quests[self.index].get_current_info 
          else
            # Get selected quest info
            @completed_quests[self.index - @top_half_size].get_current_info
          end
        end
      end
    end
    #==============================================================================
    # ** Scene_Quest
    #------------------------------------------------------------------------------
    #  This class performs quest screen processing.
    #==============================================================================
    
    class Scene_Quest
      #--------------------------------------------------------------------------
      # * Main Processing
      #--------------------------------------------------------------------------
      def main
        # Make QuestList Window
        @quest_list_window = Window_QuestList.new
        # Make QuestInfo Window
        @quest_info_window = Window_QuestInfo.new
        # Update Game Quests
        $game_quests.sort_quests
        # Refresh QuestList
        @quest_list_window.set_quests($game_quests.current_quests, 
                                      $game_quests.completed_quests)
        # Execute transition
        Graphics.transition
        # Main loop
        loop do
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
          # Abort loop if screen is changed
          if $scene != self
            break
          end
        end
        # Prepare for transition
        Graphics.freeze
        # Dispose of windows
        @quest_list_window.dispose
        @quest_info_window.dispose
      
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # Update windows
        @quest_list_window.update
        new_text = @quest_list_window.get_index_info
        @quest_info_window.refresh(new_text)
        # When cancel
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new    
          end
      end
    end


    and then we need to add a couple things so that your updates to your journal are saved and loaded.

    this
    Code:
    $game_quests        = Marshal.load(f)
    needs to be added in PokemonLoad a bit under
    Code:
    if cmdContinue>=0 && command==cmdContinue
    Same section but under
    Code:
    elsif cmdNewGame>=0 && command==cmdNewGame
    add
    Code:
    $game_quests         = Game_Quests.new
    In PokemonSave under
    Code:
     Marshal.dump($PokemonStorage,f)
    add
    Code:
     Marshal.dump($game_quests,f)

    Should work fine, let me know if any bugs found.
    Only thing I can't figure out how to do is change the windowskin used, it keeps sticking with the default, so let me know if you know how to fix that :)

    Important thing to note, once you install these scripts you must start a new game for it to work properly.


    No credit to me required, but please give credit to MobiusXVI.
    Reply With Quote
      #2    
    Old June 25th, 2014 (11:56 AM). Edited June 25th, 2014 by Joltik.
    Joltik's Avatar
    Joltik Joltik is offline
       
      Join Date: Jan 2010
      Gender: Male
      Nature: Modest
      Posts: 126
      That's pretty nice!. I have no problem starting a new game, as long as I don't try to load a saved game. (It's not an old save, I just started a new game).
      EDIT: I made a little mistake when I edited PokemonLoad. Sorry for that.
      Code:
      Exception: NameError
      Message: undefined local variable or method `f' for #<PokemonLoad:0x9db52b8>
      PokemonLoad:322:in `pbStartLoadScreen'
      PokemonLoad:319:in `loop'
      PokemonLoad:454:in `pbStartLoadScreen'
      DebugIntro:6:in `main'
      Main:37:in `mainFunctionDebug'
      Main:15:in `mainFunction'
      Main:15:in `pbCriticalCode'
      Main:15:in `mainFunction'
      Main:47
      Main:46:in `loop'
      Other than that, I think it would be nice to provide an exemple of QuestData.txt to unexperienced users who may just be lost by not knowing where to put it/find it.
      __________________

      Check out my DeviantArt account! My game project is called Pokemon Subrosia.
      My DeviantArt | Old DeviantArt
      Reply With Quote
        #3    
      Old June 25th, 2014 (12:05 PM).
      mej71's Avatar
      mej71 mej71 is offline
         
        Join Date: Mar 2014
        Location: Omnipresence
        Gender: Male
        Posts: 1,219
        Quote:
        Originally Posted by Giu View Post
        It sounds awesome!. It is working so far, as long as I don't try to load a saved game. (It's not an old save, I just started a new game).
        Code:
        Exception: NameError
        Message: undefined local variable or method `f' for #<PokemonLoad:0x9db52b8>
        PokemonLoad:322:in `pbStartLoadScreen'
        PokemonLoad:319:in `loop'
        PokemonLoad:454:in `pbStartLoadScreen'
        DebugIntro:6:in `main'
        Main:37:in `mainFunctionDebug'
        Main:15:in `mainFunction'
        Main:15:in `pbCriticalCode'
        Main:15:in `mainFunction'
        Main:47
        Main:46:in `loop'
        Other than that, I think it would be nice to provide an exemple of QuestData.txt to unexperienced users who may just be lost by not knowing where to put it/find it.

        I'm not getting that error, are you sure you put it in the right place? should look something like this
        Code:
          if cmdContinue>=0 && command==cmdContinue
                unless safeExists?(savefile)
                  pbPlayBuzzerSE()
                  next
                end
                @scene.pbEndScene
                metadata=nil
                File.open(savefile){|f|
                   pbTryLoadFile(savefile)           
                   
                   $Trainer             = Marshal.load(f)
                   Graphics.frame_count = Marshal.load(f)
                   $game_system         = Marshal.load(f)
                   Marshal.load(f) # PokemonSystem already loaded
                   Marshal.load(f) # Current map id no longer needed
                   $game_switches       = Marshal.load(f)
                   $game_variables      = Marshal.load(f)
                   $game_self_switches  = Marshal.load(f)
                   $game_screen         = Marshal.load(f)
                   $MapFactory          = Marshal.load(f)
                   $game_map            = $MapFactory.map
                   $game_player         = Marshal.load(f)
                   $PokemonGlobal       = Marshal.load(f)
                   metadata             = Marshal.load(f)
                   $ItemData            = readItemList("Data/items.dat")
                   $PokemonBag          = Marshal.load(f)
                   $PokemonStorage      = Marshal.load(f)
                   $game_quests        = Marshal.load(f)
                   magicNumberMatches=false
        There's an example and more information on the page I linked to in the initial post, as well as a small program for writing and editing the text documents.

        Edit: Also note that I designed the additions to the save/load sections for v13, it may be slightly different for older versions or modified version.
        Reply With Quote
          #4    
        Old June 25th, 2014 (12:07 PM).
        Maruno's Avatar
        Maruno Maruno is offline
        Lead Dev of Pokémon Essentials
           
          Join Date: Jan 2008
          Location: England
          Posts: 5,178
          You're missing additional changes that are required to make this work.

          Why not just use $PokemonGlobal.quests instead of $game_quests? There'd be no need to faff around with the loading/saving scripts at all.
          __________________
          Go to the Essentials Docs Wiki

          Essentials Docs Wiki

          Follow me on Twitter: @maruno42


          Reply With Quote
            #5    
          Old June 25th, 2014 (12:13 PM).
          Joltik's Avatar
          Joltik Joltik is offline
             
            Join Date: Jan 2010
            Gender: Male
            Nature: Modest
            Posts: 126
            Oh there was a slight mistake on my part. Sorry for that.
            It's loading fine now. Thank you very much!
            I'll make a few more tests now. In case I find anything I'll tell you.
            __________________

            Check out my DeviantArt account! My game project is called Pokemon Subrosia.
            My DeviantArt | Old DeviantArt
            Reply With Quote
              #6    
            Old June 25th, 2014 (12:14 PM).
            mej71's Avatar
            mej71 mej71 is offline
               
              Join Date: Mar 2014
              Location: Omnipresence
              Gender: Male
              Posts: 1,219
              Quote:
              Originally Posted by Maruno View Post
              Why not just use $PokemonGlobal.quests instead of $game_quests? There'd be no need to faff around with the loading/saving scripts at all.
              Because all it took were three lines to add in, I didn't think anything beyond that was really needed.

              What additional changes is this missing?
              Reply With Quote
                #7    
              Old June 25th, 2014 (12:40 PM).
              Joltik's Avatar
              Joltik Joltik is offline
                 
                Join Date: Jan 2010
                Gender: Male
                Nature: Modest
                Posts: 126
                I'm probably missing something tirival, but I simply cannot make it work.
                Is it working fine on yours?
                How are you calling the the journal scene, exactly? Nothing happens when I do.
                Thank you!
                __________________

                Check out my DeviantArt account! My game project is called Pokemon Subrosia.
                My DeviantArt | Old DeviantArt
                Reply With Quote
                  #8    
                Old June 25th, 2014 (12:52 PM).
                mej71's Avatar
                mej71 mej71 is offline
                   
                  Join Date: Mar 2014
                  Location: Omnipresence
                  Gender: Male
                  Posts: 1,219
                  Quote:
                  Originally Posted by Giu View Post
                  I'm probably missing something tirival, but I simply cannot make it work.
                  Is it working fine on yours?
                  How are you calling the the journal scene, exactly? Nothing happens when I do.
                  Thank you!
                  Code:
                  $scene = Scene_Quest.new
                  to call the journal scene
                  Reply With Quote
                    #9    
                  Old June 25th, 2014 (12:57 PM). Edited June 25th, 2014 by Joltik.
                  Joltik's Avatar
                  Joltik Joltik is offline
                     
                    Join Date: Jan 2010
                    Gender: Male
                    Nature: Modest
                    Posts: 126
                    Yep. That's precisely what I'm doing, but still nothing happens.
                    Actually, nothing happens when I start a new quest, open the journal scene or advance the quest to a next stage.
                    I'm pretty sure I added the script correctly.
                    Don't know what's going on.

                    Well, nevermind. Weirdly enough I managed to make it work by removing everything that followed the Journal scene in the event. Still weird though.
                    __________________

                    Check out my DeviantArt account! My game project is called Pokemon Subrosia.
                    My DeviantArt | Old DeviantArt
                    Reply With Quote
                      #10    
                    Old June 25th, 2014 (1:07 PM).
                    mej71's Avatar
                    mej71 mej71 is offline
                       
                      Join Date: Mar 2014
                      Location: Omnipresence
                      Gender: Male
                      Posts: 1,219
                      I just added it in a fresh copy of v13 and it works fine. Make sure your
                      Code:
                      $game_quests         = Game_Quests.new
                      is in the right place. If it wasn't, then it might not have activated when you started a new game.
                      Reply With Quote
                        #11    
                      Old June 26th, 2014 (4:37 PM). Edited June 26th, 2014 by Boonzeet.
                      Boonzeet's Avatar
                      Boonzeet Boonzeet is offline
                      Pokémon Kairos Developer
                         
                        Join Date: Apr 2009
                        Location: Manchester, UK
                        Gender: Male
                        Nature: Serious
                        Posts: 99
                        The quests don't show up in the quest log even when enabled, and when saving, after the quest log has been enabled and called for the first time, it simply states "Save failed".

                        I'm not sure why, and I've followed the steps exactly - the rest of the game works perfectly.

                        EDIT: it does also appear that the quests show up but the text doesn't draw, a problem I have with the original quest maker (RPGMaker on Mac) Is it using a different method to draw text then the rest of essentials? I understand needing this to work on Mac is a bit niche so I'm willing to donate something towards fixing this as I've always wanted a quest system for my game!
                        __________________
                        Lead artist and developer on Pokémon Kairos. Project post coming soon!

                        My DeviantART
                        Follow me on Twitter
                        Reply With Quote
                          #12    
                        Old June 26th, 2014 (9:12 PM).
                        mej71's Avatar
                        mej71 mej71 is offline
                           
                          Join Date: Mar 2014
                          Location: Omnipresence
                          Gender: Male
                          Posts: 1,219
                          Quote:
                          Originally Posted by Boonzeet View Post
                          The quests don't show up in the quest log even when enabled, and when saving, after the quest log has been enabled and called for the first time, it simply states "Save failed".

                          I'm not sure why, and I've followed the steps exactly - the rest of the game works perfectly.

                          EDIT: it does also appear that the quests show up but the text doesn't draw, a problem I have with the original quest maker (RPGMaker on Mac) Is it using a different method to draw text then the rest of essentials? I understand needing this to work on Mac is a bit niche so I'm willing to donate something towards fixing this as I've always wanted a quest system for my game!
                          I tried and could not get the same error, so unless I messed something up in the steps (which I don't think I did but it's possible), it might be a Mac exclusive problem. Did you format your QuestData.txt properly? Beyond that, I have no idea what caused it. The text is drawn using a method used many other places in Essentials, though the window it's drawn in is different from essentials. The classes for the edits to the windows are included in the script, but I see no reason they would not work on a Mac.
                          Reply With Quote
                            #13    
                          Old June 26th, 2014 (9:32 PM).
                          Boonzeet's Avatar
                          Boonzeet Boonzeet is offline
                          Pokémon Kairos Developer
                             
                            Join Date: Apr 2009
                            Location: Manchester, UK
                            Gender: Male
                            Nature: Serious
                            Posts: 99
                            Quote:
                            Originally Posted by mej71 View Post
                            I tried and could not get the same error, so unless I messed something up in the steps (which I don't think I did but it's possible), it might be a Mac exclusive problem. Did you format your QuestData.txt properly? Beyond that, I have no idea what caused it. The text is drawn using a method used many other places in Essentials, though the window it's drawn in is different from essentials. The classes for the edits to the windows are included in the script, but I see no reason they would not work on a Mac.
                            The saving bug I couldn't reproduce in a clean copy of Essentials, so I will look into that. Does the quest panel use the fonts used in Essentials or a windows-specific font?

                            Here is a screenshot, demonstrating the multiple quests but no text:


                            And my text file for config can be viewed here, but I'm 100% sure it's formatted correctly. Thank you for the help!
                            __________________
                            Lead artist and developer on Pokémon Kairos. Project post coming soon!

                            My DeviantART
                            Follow me on Twitter
                            Reply With Quote
                              #14    
                            Old June 26th, 2014 (9:57 PM).
                            mej71's Avatar
                            mej71 mej71 is offline
                               
                              Join Date: Mar 2014
                              Location: Omnipresence
                              Gender: Male
                              Posts: 1,219
                              Quote:
                              Originally Posted by Boonzeet View Post
                              The saving bug I couldn't reproduce in a clean copy of Essentials, so I will look into that. Does the quest panel use the fonts used in Essentials or a windows-specific font?

                              Here is a screenshot, demonstrating the multiple quests but no text:


                              And my text file for config can be viewed here, but I'm 100% sure it's formatted correctly. Thank you for the help!
                              Hmm. The boxes are drawn correctly at least, and your text format is correct. For the selectable cursor, can you go down any further or is that it? If it is, that means that it at least knows that the quests are active, and it also means that it probably read/formatted the text properly.

                              To double check that it has, go to this def in class Window_QuestInfo

                              Code:
                              def refresh(text_array)
                                  self.contents.clear
                                  self.contents.font.color = text_color(2)
                                  for i in 0...text_array.size
                                    line = text_array[i]
                                    self.contents.draw_text(0, i * 22, 408, 22, line)
                                  end
                                end
                              and change it to this
                              Code:
                              def refresh(text_array)
                                  self.contents.clear
                                  self.contents.font.color = text_color(2)
                                  for i in 0...text_array.size
                                    line = text_array[i]
                                    Kernel.pbMessage(_INTL("{1}",line))
                                    self.contents.draw_text(0, i * 22, 408, 22, line)
                                  end
                                end
                              and it should read each line of the quest info available to you. You can do similar in class Window_QuestList.

                              If all of that checks out, then it is indeed just not drawing the text for some reason. If that is the case, maybe try changing what text color is used and see if it does anything, or change the wallpaper by changing this def in class Window_Base

                              Code:
                                def initialize(x, y, width, height)
                                  super()
                                  @windowskin_name = $game_system.windowskin_name
                                  self.windowskin = RPG::Cache.windowskin(@windowskin_name)
                                  self.x = x
                                  self.y = y
                                  self.width = width
                                  self.height = height
                                  self.z = 100
                                end
                              to
                              Code:
                                def initialize(x, y, width, height)
                                  super()
                                  $game_system.windowskin_name=("001-Blue01") #you can use any filename, but the skins included in essentials look weird for this class 
                                  @windowskin_name = $game_system.windowskin_name
                                  self.windowskin = RPG::Cache.windowskin(@windowskin_name)
                                  self.x = x
                                  self.y = y
                                  self.width = width
                                  self.height = height
                                  self.z = 100
                                end
                              Reply With Quote
                                #15    
                              Old June 27th, 2014 (7:05 AM).
                              Boonzeet's Avatar
                              Boonzeet Boonzeet is offline
                              Pokémon Kairos Developer
                                 
                                Join Date: Apr 2009
                                Location: Manchester, UK
                                Gender: Male
                                Nature: Serious
                                Posts: 99
                                Quote:
                                Originally Posted by mej71 View Post
                                Hmm. The boxes are drawn correctly at least, and your text format is correct. For the selectable cursor, can you go down any further or is that it? If it is, that means that it at least knows that the quests are active, and it also means that it probably read/formatted the text properly.

                                To double check that it has, go to this def in class Window_QuestInfo and it should read each line of the quest info available to you. You can do similar in class Window_QuestList.

                                If all of that checks out, then it is indeed just not drawing the text for some reason. If that is the case, maybe try changing what text color is used and see if it does anything, or change the wallpaper by changing this def in class Window_Base
                                Thank you for the help so far, it is reading out the text correctly. Is it supposed to read the title of the Quest or its first item? As it reads the first item from the 'Storyline' quest.

                                I had already tried to change all the font colours to no avail and the Windowskin change similarly doesn't display the text.



                                Thanks so much in advance!
                                __________________
                                Lead artist and developer on Pokémon Kairos. Project post coming soon!

                                My DeviantART
                                Follow me on Twitter
                                Reply With Quote
                                  #16    
                                Old June 27th, 2014 (9:23 AM).
                                mej71's Avatar
                                mej71 mej71 is offline
                                   
                                  Join Date: Mar 2014
                                  Location: Omnipresence
                                  Gender: Male
                                  Posts: 1,219
                                  Quote:
                                  Originally Posted by Boonzeet View Post
                                  Thank you for the help so far, it is reading out the text correctly. Is it supposed to read the title of the Quest or its first item? As it reads the first item from the 'Storyline' quest.

                                  I had already tried to change all the font colours to no avail and the Windowskin change similarly doesn't display the text.



                                  Thanks so much in advance!
                                  The one I told you to change is supposed to read the quest info, not the name. So it is working correctly in that aspect. So, I have no idea what is wrong lol.
                                  Reply With Quote
                                    #17    
                                  Old June 27th, 2014 (10:19 AM).
                                  Joltik's Avatar
                                  Joltik Joltik is offline
                                     
                                    Join Date: Jan 2010
                                    Gender: Male
                                    Nature: Modest
                                    Posts: 126
                                    Apparently, text is not fitting the screen propperly, at least in current standard resolution.
                                    __________________

                                    Check out my DeviantArt account! My game project is called Pokemon Subrosia.
                                    My DeviantArt | Old DeviantArt
                                    Reply With Quote
                                      #18    
                                    Old June 27th, 2014 (4:46 PM).
                                    mej71's Avatar
                                    mej71 mej71 is offline
                                       
                                      Join Date: Mar 2014
                                      Location: Omnipresence
                                      Gender: Male
                                      Posts: 1,219
                                      Quote:
                                      Originally Posted by Giu View Post
                                      Apparently, text is not fitting the screen propperly, at least in current standard resolution.
                                      As in the thing Bonzeet is talking about? Or the text-wrapping thing? If it's the latter, I've noticed that it does that for some entrys, I'll look into it.
                                      Reply With Quote
                                        #19    
                                      Old June 27th, 2014 (5:04 PM).
                                      Joltik's Avatar
                                      Joltik Joltik is offline
                                         
                                        Join Date: Jan 2010
                                        Gender: Male
                                        Nature: Modest
                                        Posts: 126
                                        Quote:
                                        Originally Posted by mej71 View Post
                                        As in the thing Bonzeet is talking about? Or the text-wrapping thing? If it's the latter, I've noticed that it does that for some entrys, I'll look into it.
                                        Well I mean the text wrapping box, as you say. Sometimes, the text go beyond the boarders and part of it don't appear on the screen.
                                        __________________

                                        Check out my DeviantArt account! My game project is called Pokemon Subrosia.
                                        My DeviantArt | Old DeviantArt
                                        Reply With Quote
                                          #20    
                                        Old July 11th, 2014 (7:26 PM). Edited July 11th, 2014 by AlexTCGPro.
                                        AlexTCGPro's Avatar
                                        AlexTCGPro AlexTCGPro is offline
                                           
                                          Join Date: Oct 2013
                                          Gender: Male
                                          Nature: Timid
                                          Posts: 54
                                          I'm getting this error when trying to start a new game



                                          Any idea of how can I fix it? I even try using a vanilla version of essentials and still the same error appears...

                                          Edit:

                                          Have to create at least one quest to make the script work, its working fine now
                                          Reply With Quote
                                            #21    
                                          Old July 24th, 2014 (10:37 AM). Edited July 24th, 2014 by mej71.
                                          mej71's Avatar
                                          mej71 mej71 is offline
                                             
                                            Join Date: Mar 2014
                                            Location: Omnipresence
                                            Gender: Male
                                            Posts: 1,219
                                            Quote:
                                            Originally Posted by Boonzeet View Post
                                            Thank you for the help so far, it is reading out the text correctly. Is it supposed to read the title of the Quest or its first item? As it reads the first item from the 'Storyline' quest.

                                            I had already tried to change all the font colours to no avail and the Windowskin change similarly doesn't display the text.

                                            Thanks so much in advance!
                                            I know it's a bit late, but I think I may have fixed the problem. I updated the post to a new version, and you'll see "#line to fix Mac problem" next to the line I added. I think it might be trying to write in a font you don't have or something, let me know if this fixes it.

                                            Edit: Also I fixed the text wrapping by making the box smaller. I don't know that this will always work.
                                            Reply With Quote
                                              #22    
                                            Old October 21st, 2015 (5:25 PM).
                                            Darkattributes197's Avatar
                                            Darkattributes197 Darkattributes197 is offline
                                               
                                              Join Date: Oct 2015
                                              Location: NO, never!
                                              Gender: Male
                                              Nature: Relaxed
                                              Posts: 21
                                              Does this work for v15? I want this script for my Digimon fan game! So if you can please respond back thank you!
                                              __________________
                                              Welp...This is a thing...I'm making 5 projects! Main dev of Digimon Lunar Dusk, and Solar Dawn!
                                              Stick around, you may see some of my other games!
                                              Reply With Quote
                                                #23    
                                              Old November 3rd, 2015 (10:42 AM).
                                              Timmetje's Avatar
                                              Timmetje Timmetje is offline
                                                 
                                                Join Date: Jun 2010
                                                Gender: Male
                                                Posts: 52
                                                I tried it in v15 and it game me a Syntax Error in Line 380 of the Quests Script, the line with QUEST_FILENAME etc. What changes would have to be made to make it applicable to v15?
                                                Reply With Quote
                                                  #24    
                                                Old November 3rd, 2015 (2:16 PM).
                                                mej71's Avatar
                                                mej71 mej71 is offline
                                                   
                                                  Join Date: Mar 2014
                                                  Location: Omnipresence
                                                  Gender: Male
                                                  Posts: 1,219
                                                  Quote:
                                                  Originally Posted by Timmetje View Post
                                                  I tried it in v15 and it game me a Syntax Error in Line 380 of the Quests Script, the line with QUEST_FILENAME etc. What changes would have to be made to make it applicable to v15?
                                                  Thread Tools > Show Printable Version
                                                  Reply With Quote
                                                    #25    
                                                  Old November 5th, 2015 (10:41 AM).
                                                  Timmetje's Avatar
                                                  Timmetje Timmetje is offline
                                                     
                                                    Join Date: Jun 2010
                                                    Gender: Male
                                                    Posts: 52
                                                    Thanks! That fixed the problem, except I now have a similar problem as the guy from a few years ago, I can't seem to open a savefile, I can create a new one but can't save it later. I tried putting the PokemonLoad/PokemonSave lines in again and try to fix them but it doesn't seem to work.

                                                    This was the error:

                                                    Exception: TypeError
                                                    Message: cannot convert Game_System into Integer
                                                    PokemonLoad:339:in `frame_count='
                                                    PokemonLoad:339:in `pbStartLoadScreen'
                                                    PokemonLoad:335:in `open'
                                                    PokemonLoad:335:in `pbStartLoadScreen'
                                                    PokemonLoad:326:in `loop'
                                                    PokemonLoad:461:in `pbStartLoadScreen'
                                                    Main:6:in `main'
                                                    Main:49:in `mainFunctionDebug'
                                                    Main:27:in `mainFunction'
                                                    Main:27:in `pbCriticalCode'
                                                    Reply With Quote
                                                    Reply

                                                    Quick Reply

                                                    Join the conversation!

                                                    Create an account to post a reply in this thread, participate in other discussions, and more!

                                                    Create a PokéCommunity Account
                                                    Thread Tools

                                                    Posting Rules
                                                    You may not post new threads
                                                    You may not post replies
                                                    You may not post attachments
                                                    You may not edit your posts

                                                    BB code is On
                                                    Smilies are On
                                                    [IMG] code is On
                                                    HTML code is Off

                                                    Forum Jump


                                                    All times are GMT -8. The time now is 5:39 AM.