View difference between Paste ID: tLekbQ9n and 23C83TyW
SHOW: | | - or go back to the newest paste.
1
                            #======================#
2
                            #  Z-Systems by: Zetu  #
3
#===========================#======================#===========================#
4-
#               *  *  *  Z12 Automatic Nameboxes  v1.03  *  *  *               #
4+
#               *  *  *  Z12 Automatic Nameboxes  v1.04  *  *  *               #
5
#=#==========================================================================#=#
6
  #  Set the module to decide what faces will return what names.  You can    #
7
  #  by-pass this by using a script call.                                    #
8
  #  $game_message.forced_text = ""      // Removes the next Textbox         #
9
  #  $game_message.forced_text = "NAME"  // Sets next Textbox to NAME        #
10
  #==========================================================================#
11
module Z12
12
  
13
  def self.namebox(faceset, index)
14
    case faceset
15
    when "main"
16
      case index
17
      when 0; return $game_actors[1].name
18
      when 1; return $game_actors[2].name
19
      when 2; return $game_actors[3].name
20
      when 3; return $game_actors[4].name
21
      when 4; return "Fixed Name"
22
      end
23
    end
24
    return ""
25
  end
26
  
27
end
28
29
class Window_Message < Window_Base
30
  alias :z12caw :create_all_windows
31
  def create_all_windows
32
    z12caw
33
    @messageName_window = Window_MessageName.new(self)
34
  end
35
  alias :z12civ :clear_instance_variables
36
  def clear_instance_variables
37
    z12civ
38
    @messageName_window.text = ""
39
  end
40
  alias :z12daw :dispose_all_windows
41
  def dispose_all_windows
42
    z12daw
43
    @messageName_window.dispose
44
  end
45
  alias :z12uaw :update_all_windows
46
  def update_all_windows
47
    z12uaw
48
    @messageName_window.update
49
  end
50
  alias :z12np :new_page
51
  def new_page(text, pos)
52
    z12np(text, pos)
53
    @messageName_window.new_face
54
  end
55
end
56
57
class Window_MessageName < Window_Base
58
  attr_accessor :text
59
  def initialize(window)
60
    super(0,0,128,48)
61
    @parent_window = window
62
    self.openness = 0
63
  end
64
  
65
  def new_face
66
    if $game_message.forced_text.nil?
67
      @text = Z12.namebox($game_message.face_name, $game_message.face_index)
68
    else
69
      @text = $game_message.forced_text
70
      $game_message.forced_text = nil
71
    end
72
    refresh
73
  end
74
  
75
  def update
76-
    self.openness = @parent_window.openness
76+
    self.openness = @text=="" ? 0 : @parent_window.openness
77
    refresh if self.visible
78
    self.y = (@parent_window.y > 0 ? @parent_window.y-48 : @parent_window.window_height)
79
  end
80
  
81
  def refresh
82
    contents.clear
83
    draw_text(0, 0, 104, 24, @text, 1)
84
  end
85
  
86
end
87
88
class Game_Message
89
  attr_accessor :forced_text
90
end