Advertisement
Double_X

Graphic Face

Jun 16th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.55 KB | None | 0 0
  1. #==============================================================================|
  2. #  ** You only need to edit this part as it's about what this snippet does     |
  3. #------------------------------------------------------------------------------|
  4.  
  5. module Graphic_Face
  6.  
  7.   # Character graphic of actor with id actor_id_x will be set as that of actor
  8.   # with id being equal to the value of variable with id variable_id_x
  9.   # Setting variable_id_x as 0 will permanently disable this feature for actor
  10.   # with id actor_id_x
  11.   # Setting the value of the variable with id variable_id_x as 0 will
  12.   # temporarily disable this feature for actor with id actor_id_x
  13.   GRAPHIC_ID = {
  14.     actor_id_1 => variable_id_1
  15.     actor_id_2 => variable_id_2
  16.     actor_id_3 => variable_id_3
  17.     actor_id_n => variable_id_n
  18.   }
  19.  
  20.   # Face graphic of actor with id actor_id_x will be set as that of actor
  21.   # with id being equal to the value of variable with id variable_id_x
  22.   # Setting variable_id_x as 0 will permanently disable this feature for actor
  23.   # with id actor_id_x
  24.   # Setting the value of the variable with id variable_id_x as 0 will
  25.   # temporarily disable this feature for actor with id actor_id_x
  26.   FACE_ID = {
  27.     actor_id_1 => variable_id_1
  28.     actor_id_2 => variable_id_2
  29.     actor_id_3 => variable_id_3
  30.     actor_id_n => variable_id_n
  31.   }
  32.  
  33. end # Graphic_Face
  34.  
  35. #==============================================================================|
  36.  
  37. #==============================================================================|
  38. #  ** You need not edit this part as it's about how this snippet works         |
  39. #------------------------------------------------------------------------------|
  40.  
  41. class Window_Base < Window
  42.  
  43.   alias draw_actor_graphic_actor_graphic draw_actor_graphic
  44.   alias draw_actor_face_actor_graphic draw_actor_face
  45.  
  46.   #----------------------------------------------------------------------------|
  47.   #  Alias method: draw_actor_graphic                                          |
  48.   #----------------------------------------------------------------------------|
  49.   def draw_actor_graphic(actor, x, y)
  50.     # This part is rewritten by this snippet to draw the character graphic of the actor id found in id_hash if any
  51.     draw_actor_face_graphic(actor, x, y, "graphic")
  52.     #
  53.   end # draw_actor_graphic
  54.  
  55.   #----------------------------------------------------------------------------|
  56.   #  Alias method: draw_actor_face                                             |
  57.   #----------------------------------------------------------------------------|
  58.   def draw_actor_face(actor, x, y, enabled = true)
  59.     # This part is rewritten by this snippet to draw the face graphic of the actor id found in id_hash if any
  60.     draw_actor_face_graphic(actor, x, y, enabled, "face")
  61.     #
  62.   end # draw_actor_face
  63.  
  64.   #----------------------------------------------------------------------------|
  65.   #  New method: draw_actor_face_graphic                                       |
  66.   #----------------------------------------------------------------------------|
  67.   def draw_actor_face_graphic(actor, x, y, enabled = true, method)
  68.     id_hash = eval("Graphic_Face::" + method.upcase + "_ID")
  69.     actor = $data_actors[$game_variables[id_hash[actor.id]]] if id_hash[actor.id] && id_hash[actor.id] > 0 && $game_variables[id_hash[actor.id]] > 0
  70.     eval("draw_actor_" + method + "_actor_graphic(actor, x, y" + (method == "face" ? ", enabled)" : ")"))
  71.   end # draw_actor_face_graphic
  72.  
  73. end # Window_Base
  74.  
  75. #==============================================================================|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement