SHOW:
|
|
- or go back to the newest paste.
1 | #======================# | |
2 | # Z-Systems by: Zetu # | |
3 | #===========================#======================#===========================# | |
4 | # * * * Z12 Automatic Nameboxes v1.03 * * * # | |
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 | - | class Scene_Battle < Scene_Base |
19 | + | |
20 | when 3; return $game_actors[4].name | |
21 | - | def create_message_window |
21 | + | |
22 | - | @message_window = Window_Message.new |
22 | + | |
23 | - | @message_name = Window_MessageName.new |
23 | + | |
24 | - | $game_message.set_pop(@message_name) |
24 | + | |
25 | end | |
26 | ||
27 | end | |
28 | ||
29 | - | class Scene_Map < Scene_Base |
29 | + | |
30 | alias :z12caw :create_all_windows | |
31 | - | def create_message_window |
31 | + | def create_all_windows |
32 | - | @message_window = Window_Message.new |
32 | + | z12caw |
33 | - | @message_name = Window_MessageName.new |
33 | + | @messageName_window = Window_MessageName.new(self) |
34 | - | $game_message.set_pop(@message_name) |
34 | + | |
35 | alias :z12civ :clear_instance_variables | |
36 | def clear_instance_variables | |
37 | z12civ | |
38 | @messageName_window.text = "" | |
39 | end | |
40 | - | attr_reader :pop_window |
40 | + | alias :z12daw :dispose_all_windows |
41 | - | def face_name=(new_face) |
41 | + | def dispose_all_windows |
42 | - | @pop_window.face_name(new_face) if @face_name != new_face |
42 | + | z12daw |
43 | - | @face_name = new_face |
43 | + | @messageName_window.dispose |
44 | end | |
45 | alias :z12uaw :update_all_windows | |
46 | - | def face_index=(new_index) |
46 | + | def update_all_windows |
47 | - | @pop_window.face_index(new_index) if @face_index != new_index |
47 | + | z12uaw |
48 | - | @face_index = new_index |
48 | + | @messageName_window.update |
49 | end | |
50 | alias :z12np :new_page | |
51 | - | def set_pop(window) |
51 | + | def new_page(text, pos) |
52 | - | @pop_window = window |
52 | + | z12np(text, pos) |
53 | @messageName_window.new_face | |
54 | end | |
55 | end | |
56 | ||
57 | class Window_MessageName < Window_Base | |
58 | - | alias :z12c :close |
58 | + | attr_accessor :text |
59 | - | def close |
59 | + | def initialize(window) |
60 | - | z12c |
60 | + | super(0,0,128,48) |
61 | - | $game_message.pop_window.close |
61 | + | @parent_window = window |
62 | self.openness = 0 | |
63 | end | |
64 | - | alias :z12o :open |
64 | + | |
65 | - | def open |
65 | + | def new_face |
66 | - | z12o |
66 | + | if $game_message.forced_text.nil? |
67 | - | $game_message.pop_window.open |
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 | - | def initialize |
74 | + | |
75 | - | super(0, Graphics.height-168, 128, 48) |
75 | + | def update |
76 | - | @face = "" |
76 | + | self.openness = @parent_window.openness |
77 | - | @index = 0 |
77 | + | refresh if self.visible |
78 | - | @text = "" |
78 | + | self.y = (@parent_window.y > 0 ? @parent_window.y-48 : @parent_window.window_height) |
79 | - | @z = 250 |
79 | + | |
80 | - | hide |
80 | + | |
81 | def refresh | |
82 | contents.clear | |
83 | - | def face_name(name) |
83 | + | draw_text(0, 0, 104, 24, @text, 1) |
84 | - | @face = name |
84 | + | |
85 | ||
86 | end | |
87 | ||
88 | - | def face_index(index) |
88 | + | |
89 | - | @index = index |
89 | + | attr_accessor :forced_text |
90 | end |