Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Player : No Map Transfer Fix

Player : No Map Transfer Fix
Version: 2.0
By: Kain Nobel

Introduction

This is a little 'security script' that you can put in your project. Basically, what it does is if you call a Transfer Player command with an event, but the map can't be found, it'll show/print a message telling the player.

"Cannot access Map [id] because it is missing...
please try a different map or notify the author of
the project that one of his maps is missing."

Features

  • Shows message notifying of missing map
  • Doesn't crash your game because of your silly mistake :P

Screenshots

Take a screenshot of a Show Message event... there's your screenshot!

Script

Code:
#===============================================================================

# ** Player : No Map Transfer Fix

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

SDK.log('Player.NoMapTransferFix', 'Kain Nobel ©', 3.5, '2009.06.17')

#-------------------------------------------------------------------------------

# * SDK Enabled Test : BEGIN

#-------------------------------------------------------------------------------

if SDK.enabled?('Player.NoMapTransferFix')

 

#===============================================================================

# ** Game_Map

#===============================================================================

 

class Game_Map

  #-----------------------------------------------------------------------------

  # * Name      : Exists?

  #   Info      : Tests to see if Map exists

  #   Author    : Kain Nobel

  #   Call Info : Map ID is the Map in question

  #-----------------------------------------------------------------------------

  def exists?(map_id)

    FileTest.exist?(sprintf("Data/Map%03d.rxdata", map_id))

  end

end

 

#===============================================================================

# ** Interpreter

#===============================================================================

 

class Interpreter

  #-----------------------------------------------------------------------------

  # * No Transfer Message ([?] is 'Map' id)

  #-----------------------------------------------------------------------------

  No_Transfer_Fix  = "Cannot access [?] because it is missing...\n  please try "

  No_Transfer_Fix += "a different map or notify the author of\n  the project th"

  No_Transfer_Fix += "at one of his maps is missing."

  #-----------------------------------------------------------------------------

  # * Alias Listing

  #-----------------------------------------------------------------------------

  alias_method :nomaptransferfix_interpreter_command201, :command_201

  #-----------------------------------------------------------------------------

  # * Command 201 : Transfer Player

  #-----------------------------------------------------------------------------

  def command_201

    if $game_map.exists?(@parameters[1])

      nomaptransferfix_interpreter_command201

    else

      message = No_Transfer_Fix.is_a?(String) ? No_Transfer_Fix : ''

      message.gsub!("[?]", "Map"+sprintf("%03d", @parameters[1]))

      unless message.nil? || message == ""

        if Object.const_defined?(:MInterpreter) ; MInterpreter.show_text(message)

        else                                    ; print(message)

        end

      end

      $game_player.turn_180

      $game_player.move_forward

    end

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : END

#-------------------------------------------------------------------------------

end

Instructions

Place above 'main' and below 'SDK' and 'MACL' (if using). This script does NOT require SDK, so in order to remove it just delete the SDK.log, SDK.enabled? test and the last end in the script.

Compatibility

Interpreter.command_201

Haven't tested the script in VX yet, feel free to tell me your results.

Author's Notes

If you happen to have the MInterpreter (featured in MACL 2.3), this script will display the message using the "Show Text" event command, else it'll just print the message like normal.

Credits and Thanks

SephirothSpawn for the MInterpreter

Terms and Conditions

Free to use in 'commercial' and 'non-commercial' projects, please credit me if you used this script amongst the development of your project!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top