Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Exclude Player in Party V1.0
- # by SowS - 06/12/10
- #------------------------------------------------------------------------------
- # Instructions:
- # Put the script under Materials section of your script editor.
- # Set up the player charsheet, index and name.
- # #--------------------------------------------------------------------------
- # Using \N[ID] doesn't show the player name.
- # To show player's name in messages, use "\P" instead(without the quotes).
- # #--------------------------------------------------------------------------
- # To change the player's charsheet, index, etc., do a script call:
- # # for the name
- # $game_player.name = "New Name"
- # # for the charsheet
- # $game_player.character_name = "New Charsheet"
- # # for the charsheet index
- # $game_player.character_index = New_Charsheet_Index
- # # for the face name
- # $game_player.face_name = "New Faceset"
- # # for the faceset index
- # $game_player.face_index = New_Face_Index
- # #--------------------------------------------------------------------------
- # If you want to use do name input for the player's name, do a script call:
- # $game_temp.name_max_char = 10 # change 10 to the max char you like.
- # $scene = Scene_PlayerName.new
- #==============================================================================
- module SOWS
- #----------------------------------------------------------------------------
- # start of config
- #----------------------------------------------------------------------------
- # switch to hide player character
- PLAYER_SWITCH = 3 # turn it on to hide
- # filename of the player character
- PLAYER_CHAR_SPRITE = "$rsz_ethan_purple"
- # change this if you're not using a single charsheet
- PLAYER_CHAR_INDEX = 0
- # filename of player face
- PLAYER_FACE = "Actor2"
- # change this if you're not using a single faceset
- PLAYER_FACE_INDEX = 0
- # player name
- PLAYER_NAME = "SowS"
- #----------------------------------------------------------------------------
- # end of config
- #----------------------------------------------------------------------------
- end
- #==============================================================================
- # ** Game_Player
- #------------------------------------------------------------------------------
- # This class handles maps. It includes event starting determinants and map
- # scrolling functions. The instance of this class is referenced by $game_map.
- #==============================================================================
- class Game_Player < Game_Character
- include SOWS
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :name
- attr_accessor :character_name
- attr_accessor :character_index
- attr_accessor :face_name
- attr_accessor :face_index
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if $game_switches[PLAYER_SWITCH]
- @character_name = ""
- @character_index = 0
- else
- @character_name = PLAYER_CHAR_SPRITE
- @character_index = PLAYER_CHAR_INDEX
- @name = PLAYER_NAME
- @face_name = PLAYER_FACE
- @face_index = PLAYER_FACE_INDEX
- end
- end
- #--------------------------------------------------------------------------
- # * Increase Steps
- #--------------------------------------------------------------------------
- def increase_steps
- super
- return if @move_route_forcing
- return if in_vehicle?
- $game_party.increase_steps
- $game_party.on_player_walk if $game_party.members.size > 0
- end
- end
- #==============================================================================
- # ** Window_Message
- #------------------------------------------------------------------------------
- # This message window is used to display text.
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # * Method Aliasing
- #--------------------------------------------------------------------------
- alias sows_convert_special_characters convert_special_characters unless $@
- #--------------------------------------------------------------------------
- # * Convert Special Characters
- #--------------------------------------------------------------------------
- def convert_special_characters
- sows_convert_special_characters
- @text.gsub!(/(\\P)/i) { $game_player.name }
- end
- end
- #==============================================================================
- # ** Window_PlayerNameEdit
- #------------------------------------------------------------------------------
- # This window is used to edit an actor's name on the name input screen.
- #==============================================================================
- class Window_PlayerNameEdit < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :name # name
- attr_reader :index # cursor position
- attr_reader :max_char # maximum number of characters
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor : actor
- # max_char : maximum number of characters
- #--------------------------------------------------------------------------
- def initialize(max_char)
- super(88, 20, 368, 128)
- @name = $game_player.name
- @max_char = max_char
- name_array = @name.split(//)[0...@max_char] # Fit within max length
- @name = ""
- for i in 0...name_array.size
- @name += name_array[i]
- end
- @default_name = @name
- @index = name_array.size
- self.active = false
- refresh
- update_cursor
- end
- #--------------------------------------------------------------------------
- # * Return to Default Name
- #--------------------------------------------------------------------------
- def restore_default
- @name = @default_name
- @index = @name.split(//).size
- refresh
- update_cursor
- end
- #--------------------------------------------------------------------------
- # * Add Text Character
- # character : text character to be added
- #--------------------------------------------------------------------------
- def add(character)
- if @index < @max_char and character != ""
- @name += character
- @index += 1
- refresh
- update_cursor
- end
- end
- #--------------------------------------------------------------------------
- # * Delete Text Character
- #--------------------------------------------------------------------------
- def back
- if @index > 0
- name_array = @name.split(//) # Delete one character
- @name = ""
- for i in 0...name_array.size-1
- @name += name_array[i]
- end
- @index -= 1
- refresh
- update_cursor
- end
- end
- #--------------------------------------------------------------------------
- # * Get rectangle for displaying items
- # index : item number
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = 220 - (@max_char + 1) * 12 + index * 24
- rect.y = 36
- rect.width = 24
- rect.height = WLH
- return rect
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_face(@actor, 0, 0)
- name_array = @name.split(//)
- for i in 0...@max_char
- c = name_array[i]
- c = '_' if c == nil
- self.contents.draw_text(item_rect(i), c, 1)
- end
- end
- #--------------------------------------------------------------------------
- # * Update cursor
- #--------------------------------------------------------------------------
- def update_cursor
- self.cursor_rect = item_rect(@index)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- update_cursor
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Face Graphic
- # actor : actor
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # size : Display size
- #--------------------------------------------------------------------------
- def draw_actor_face(actor, x, y, size = 96)
- draw_face($game_player.face_name, $game_player.face_index, x, y, size)
- end
- end
- #==============================================================================
- # ** Scene_PlayerName
- #------------------------------------------------------------------------------
- # This class performs player name input screen processing.
- #==============================================================================
- class Scene_PlayerName < Scene_Base
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @edit_window = Window_PlayerNameEdit.new($game_temp.name_max_char)
- @input_window = Window_NameInput.new
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @edit_window.dispose
- @input_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Return to Original Screen
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @edit_window.update
- @input_window.update
- if Input.repeat?(Input::B)
- if @edit_window.index > 0 # Not at the left edge
- Sound.play_cancel
- @edit_window.back
- end
- elsif Input.trigger?(Input::C)
- if @input_window.is_decision # If cursor is positioned on [OK]
- if @edit_window.name == "" # If name is empty
- @edit_window.restore_default # Return to default name
- if @edit_window.name == ""
- Sound.play_buzzer
- else
- Sound.play_decision
- end
- else
- Sound.play_decision
- $game_player.name = @edit_window.name # Change player name
- return_scene
- end
- elsif @input_window.character != "" # If text characters are not empty
- if @edit_window.index == @edit_window.max_char # at the right edge
- Sound.play_buzzer
- else
- Sound.play_decision
- @edit_window.add(@input_window.character) # Add text character
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement