Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Different Portraits? VX, searching for portrait script
krimwand
post Apr 8 2012, 12:05 AM
Post #1



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




In my project player can choose any of many portraits, how to substitute in dialog player's portrait?

I think to be a script with command like standart name command \n[1] Hello
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Apr 8 2012, 04:34 AM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




Since \n is used to show variables I've taken \f[1].

CODE
#==============================================================================
# ** VX: Night_Runner's Actor Portraits
#------------------------------------------------------------------------------
# History:
#  Date Created: 8/April/2012
#  Created for: krimwant
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=56123
#
# Description:
#  Inside the 'Show Text' command have the escape code:
#    \f[4]
#   to set the face for that message to be the same face that Actor #4
#   (Ylva) has.
#
# How to Install:
#  Copy this entire script. In your game editor select Tools >> Script Editor.
#  Along the left hand side scroll to the bottom, right click on 'Main' and
#  select 'Insert'. Paste on the right.
#==============================================================================



#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  Edited to allow setting the face to that of an actor.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_ActorPortraits_command_101  command_101  unless $@
  #--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101(*args)
    # Unless there is already a text showing
    unless $game_message.busy
      # Run the original command_101
      nr_ActorPortraits_command_101(*args)
      # Setup the regular expression
      actor_f_regexp = /\\[Ff]\[((\d)+)\]/
      # Loop through each line of text
      for line in $game_message.texts
        # Scan through the line looking for the regular expression
        line.gsub!(actor_f_regexp) { |match|
          # Get the number
          index = match.scan(actor_f_regexp)[0][0].to_i
          # Set the face to that actor's data
          $game_message.face_name = $game_actors[index].face_name
          $game_message.face_index = $game_actors[index].face_index
          # Set the \f[number] to blank
          ''
        }
      end
    end
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


On line 43 there is a bit Ff, change those to the uppercase and lowercase combination you prefer to set the face ^_^


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
krimwand
post Apr 11 2012, 02:40 AM
Post #3



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




Thank you so much!
this is exactly what I needed
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 02:53 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker