设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2252|回复: 1
打印 上一主题 下一主题

[已经解决] 这个物品得失的脚本在哪里改字号

[复制链接]

Lv1.梦旅人

梦石
0
星屑
138
在线时间
304 小时
注册时间
2014-4-11
帖子
419
跳转到指定楼层
1
发表于 2014-9-11 18:14:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x

  1. $imported = {} if $imported.nil?
  2. $imported["YEA-EventWindow"] = true

  3. #==============================================================================
  4. # ▼ Updates
  5. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  6. # 2011.12.27 - Bug Fixed: Used the wrong script to hide event window.
  7. # 2011.12.26 - Started Script and Finished.
  8. #
  9. #==============================================================================
  10. # ▼ Introduction
  11. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  12. # The Event Window is a new feature added through this script that appears in
  13. # the lower left corner of the screen. Whenever the player gains or loses gold
  14. # and items, the Event Window is updated to show the changes. In addition to
  15. # showing item gains and losses, you may even add in your own text to update
  16. # through a Script Call.
  17. #
  18. #==============================================================================
  19. # ▼ Instructions
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # To install this script, open up your script editor and copy/paste this script
  22. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  23. #
  24. # -----------------------------------------------------------------------------
  25. # Script Calls - These commands are used with script calls.
  26. # -----------------------------------------------------------------------------
  27. # event_window_add_text(string)
  28. # This inserts "string" text into the Event Window. Use \n to designate
  29. # linebreaks in the string. If you wish to use text codes, write them in the
  30. # strings as \\n[2] or \\c[3] to make them work properly.
  31. #
  32. # event_window_clear_text
  33. # This causes the Event Window to clear all of the stored text. You can choose
  34. # whether or not to clear the stored Event Window text every time the player
  35. # enters a new map.
  36. #
  37. #==============================================================================
  38. # ▼ Compatibility
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  41. # it will run with RPG Maker VX without adjusting.
  42. #
  43. #==============================================================================

  44. module YEA
  45.   module EVENT_WINDOW
  46.    
  47.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48.     # - Event Window Switch -
  49.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  50.     # This is the switch used for hiding the event window. When this switch is
  51.     # ON, the event window will be hidden from view. If it is OFF, the event
  52.     # window will maintain normal visibility.
  53.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  54.     HIDE_SWITCH = 98       # If switch is ON, event window will not appear.
  55.    
  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     # - General Event Window Settings -
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     # This section adjusts the event window. These settings adjust the overall
  60.     # appearance of the event window from the width to the number of lines
  61.     # shown and the window fade rate.
  62.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63.     NEW_MAP_CLEAR = true    # Clear text when entering a new map?
  64.     WINDOW_WIDTH  = 280+30     # Event Window width.
  65.     VISIBLE_TIME  = 180     # Frames the window is visible before fading.
  66.     MAX_LINES     = 4       # Maximum number of lines shown.
  67.     WINDOW_FADE   = 8       # Fade rate for the Event Window.
  68.    
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # - Event Window Text Settings -
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     # This section adjusts the text that appears in the event window. The text
  73.     # that appears when an item is found and the text that appears when an item
  74.     # is lost will always appear before the item found. If there is more than
  75.     # one item found, the amount text will be added on after followed by the
  76.     # closing text. When gold is found, no icons will be used.
  77.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  78.     HEADER_TEXT = "\e}"                # Text that's always used at the head.
  79.     FOUND_TEXT  = "\ec[6]获得\ec[0] "   # Text used when an item is found.
  80.     LOST_TEXT   = "\ec[4]失去\ec[0] "    # Text used when an item is lost.
  81.     AMOUNT_TEXT = "×%s"                  # Text used to display an amount.
  82.     CLOSER_TEXT = ""                   # Text that's always used at the end.

  83.   end # EVENT_WINDOW
  84. end # YEA

  85. #==============================================================================
  86. # ▼ Editting anything past this point may potentially result in causing
  87. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  88. # halitosis so edit at your own risk.
  89. #==============================================================================

  90. #==============================================================================
  91. # ■ Switch
  92. #==============================================================================

  93. module Switch
  94.   
  95.   #--------------------------------------------------------------------------
  96.   # self.hide_event_window
  97.   #--------------------------------------------------------------------------
  98.   def self.hide_event_window
  99.     return false if YEA::EVENT_WINDOW::HIDE_SWITCH <= 0
  100.     return $game_switches[YEA::EVENT_WINDOW::HIDE_SWITCH]
  101.   end
  102.    
  103. end # Switch

  104. #==============================================================================
  105. # ■ Numeric
  106. #==============================================================================

  107. class Numeric
  108.   
  109.   #--------------------------------------------------------------------------
  110.   # new method: group_digits
  111.   #--------------------------------------------------------------------------
  112.   unless $imported["YEA-CoreEngine"]
  113.   def group; return self.to_s; end
  114.   end # $imported["YEA-CoreEngine"]
  115.    
  116. end # Numeric

  117. #==============================================================================
  118. # ■ Game_Temp
  119. #==============================================================================

  120. class Game_Temp
  121.   
  122.   #--------------------------------------------------------------------------
  123.   # public instance variables
  124.   #--------------------------------------------------------------------------
  125.   attr_accessor :event_window_data
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # new method: add_event_window_data
  129.   #--------------------------------------------------------------------------
  130.   def add_event_window_data(text)
  131.     @event_window_data = [] if @event_window_data.nil?
  132.     return if text == ""
  133.     @event_window_data.push(text)
  134.   end
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # new method: clear_event_window_data
  138.   #--------------------------------------------------------------------------
  139.   def clear_event_window_data
  140.     @event_window_data = []
  141.   end
  142.   
  143. end # Game_Temp

  144. #==============================================================================
  145. # ■ Game_Interpreter
  146. #==============================================================================

  147. class Game_Interpreter
  148.   
  149.   #--------------------------------------------------------------------------
  150.   # alias method: command_125
  151.   #--------------------------------------------------------------------------
  152.   alias game_interpreter_command_125_ew command_125
  153.   def command_125
  154.     game_interpreter_command_125_ew
  155.     value = operate_value(@params[0], @params[1], @params[2])
  156.     $game_temp.clear_event_window_data
  157.     event_window_make_gold_text(value)
  158.   end
  159.   
  160.   #--------------------------------------------------------------------------
  161.   # alias method: command_126
  162.   #--------------------------------------------------------------------------
  163.   alias game_interpreter_command_126_ew command_126
  164.   def command_126
  165.     game_interpreter_command_126_ew
  166.     value = operate_value(@params[1], @params[2], @params[3])
  167.     $game_temp.clear_event_window_data
  168.     event_window_make_item_text($data_items[@params[0]], value)
  169.   end
  170.   
  171.   #--------------------------------------------------------------------------
  172.   # alias method: command_127
  173.   #--------------------------------------------------------------------------
  174.   alias game_interpreter_command_127_ew command_127
  175.   def command_127
  176.     game_interpreter_command_127_ew
  177.     value = operate_value(@params[1], @params[2], @params[3])
  178.     $game_temp.clear_event_window_data
  179.     event_window_make_item_text($data_weapons[@params[0]], value)
  180.   end
  181.   
  182.   #--------------------------------------------------------------------------
  183.   # alias method: command_128
  184.   #--------------------------------------------------------------------------
  185.   alias game_interpreter_command_128_ew command_128
  186.   def command_128
  187.     game_interpreter_command_128_ew
  188.     value = operate_value(@params[1], @params[2], @params[3])
  189.     event_window_make_item_text($data_armors[@params[0]], value)
  190.   end
  191.   
  192.   #--------------------------------------------------------------------------
  193.   # new method: event_window_make_gold_text
  194.   #--------------------------------------------------------------------------
  195.   def event_window_make_gold_text(value)
  196.     return unless SceneManager.scene_is?(Scene_Map)
  197.     return if Switch.hide_event_window
  198.     if value > 0
  199.       text = YEA::EVENT_WINDOW::FOUND_TEXT
  200.     elsif value < 0
  201.       text = YEA::EVENT_WINDOW::LOST_TEXT
  202.     else; return
  203.     end
  204.     text += sprintf("%s%s", value.abs.group, Vocab::currency_unit)
  205.     event_window_add_text(text)
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # new method: event_window_make_item_text
  210.   #--------------------------------------------------------------------------
  211.   def event_window_make_item_text(item, value)
  212.     return unless SceneManager.scene_is?(Scene_Map)
  213.     return if Switch.hide_event_window
  214.     if value > 0
  215.       text = YEA::EVENT_WINDOW::FOUND_TEXT
  216.     elsif value < 0
  217.       text = YEA::EVENT_WINDOW::LOST_TEXT
  218.     else; return
  219.     end
  220.     text += sprintf("\ei[%d]%s", item.icon_index, item.name)
  221.     if value.abs > 1
  222.       fmt = YEA::EVENT_WINDOW::AMOUNT_TEXT
  223.       text += sprintf(fmt, value.abs.group)
  224.     end
  225.     event_window_add_text(text)
  226.   end
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # new method: event_window_add_text
  230.   #--------------------------------------------------------------------------
  231.   def event_window_add_text(text)
  232.     return unless SceneManager.scene_is?(Scene_Map)
  233.     return if Switch.hide_event_window
  234.     text = YEA::EVENT_WINDOW::HEADER_TEXT + text
  235.     text += YEA::EVENT_WINDOW::CLOSER_TEXT
  236.     SceneManager.scene.event_window_add_text(text)
  237.   end
  238.   
  239.   #--------------------------------------------------------------------------
  240.   # new method: event_window_clear_text
  241.   #--------------------------------------------------------------------------
  242.   def event_window_clear_text
  243.     $game_temp.clear_event_window_data
  244.   end
  245.   
  246. end # Game_Interpreter

  247. #==============================================================================
  248. # ■ Window_EventWindow
  249. #==============================================================================

  250. class Window_EventWindow < Window_Selectable
  251.   
  252.   #--------------------------------------------------------------------------
  253.   # initialize
  254.   #--------------------------------------------------------------------------
  255.   def initialize
  256.     dw = YEA::EVENT_WINDOW::WINDOW_WIDTH
  257.     super(0, 0, dw, fitting_height(YEA::EVENT_WINDOW::MAX_LINES))
  258.     self.x -= 12
  259.     self.opacity = 0
  260.     self.contents_opacity = 0
  261.     @visible_counter = 0
  262.     modify_skin
  263.     deactivate
  264.   end
  265.   
  266.   #--------------------------------------------------------------------------
  267.   # modify_skin
  268.   #--------------------------------------------------------------------------
  269.   def modify_skin
  270.     dup_skin = self.windowskin.dup
  271.     dup_skin.clear_rect(64,  0, 64, 64)
  272.     dup_skin.clear_rect(64, 64, 32, 32)
  273.     self.windowskin = dup_skin
  274.   end
  275.   
  276.   #--------------------------------------------------------------------------
  277.   # item_max
  278.   #--------------------------------------------------------------------------
  279.   def item_max
  280.     return $game_temp.event_window_data ? $game_temp.event_window_data.size : 1
  281.   end
  282.   
  283.   #--------------------------------------------------------------------------
  284.   # update
  285.   #--------------------------------------------------------------------------
  286.   def update
  287.     super
  288.     self.visible = show_window?
  289.     update_visible_counter
  290.     update_contents_opacity
  291.   end
  292.   
  293.   #--------------------------------------------------------------------------
  294.   # show_window?
  295.   #--------------------------------------------------------------------------
  296.   def show_window?
  297.     return false if $game_message.visible
  298.     return true
  299.   end
  300.   
  301.   #--------------------------------------------------------------------------
  302.   # update_visible_counter
  303.   #--------------------------------------------------------------------------
  304.   def update_visible_counter
  305.     return if @visible_counter <= 0
  306.     @visible_counter -= 1
  307.   end
  308.   
  309.   #--------------------------------------------------------------------------
  310.   # update_contents_opacity
  311.   #--------------------------------------------------------------------------
  312.   def update_contents_opacity
  313.     return if @visible_counter > 0
  314.     return if self.contents_opacity <= 0
  315.     self.contents_opacity -= YEA::EVENT_WINDOW::WINDOW_FADE
  316.   end
  317.   
  318.   #--------------------------------------------------------------------------
  319.   # instant_hide
  320.   #--------------------------------------------------------------------------
  321.   def instant_hide
  322.     @visible_counter = 0
  323.     self.contents_opacity = 0
  324.   end
  325.   
  326.   #--------------------------------------------------------------------------
  327.   # add_text
  328.   #--------------------------------------------------------------------------
  329.   def add_text(text)
  330.     $game_temp.add_event_window_data(text)
  331.     refresh
  332.     self.contents_opacity = 255
  333.     self.contents.font.size = 24#
  334.     @visible_counter = YEA::EVENT_WINDOW::VISIBLE_TIME
  335.     change_y_position
  336.     select(item_max - 1)
  337.   end
  338.   
  339.   #--------------------------------------------------------------------------
  340.   # change_y_position  这里的数字可以改变显示条的位置,数字越小越低。
  341.   #--------------------------------------------------------------------------
  342.   def change_y_position
  343.     maximum = [item_max, YEA::EVENT_WINDOW::MAX_LINES].min
  344.     self.y = Graphics.height - fitting_height(maximum) - 160+40
  345.   end
  346.   
  347.   #--------------------------------------------------------------------------
  348.   # refresh
  349.   #--------------------------------------------------------------------------
  350.   def refresh
  351.     create_contents
  352.     draw_all_items
  353.   end
  354.   
  355.   #--------------------------------------------------------------------------
  356.   # draw_item
  357.   #--------------------------------------------------------------------------
  358.   def draw_item(index)
  359.     $game_temp.clear_event_window_data if $game_temp.event_window_data.nil?
  360.     item = $game_temp.event_window_data[index]
  361.     return if item.nil?
  362.     rect = item_rect(index)
  363.     draw_background(rect)
  364.     rect.x += 4
  365.     rect.width -= 8
  366.     draw_text_ex(rect.x, rect.y, item)
  367.   end
  368.   
  369.   #--------------------------------------------------------------------------
  370.   # draw_background
  371.   #--------------------------------------------------------------------------
  372.   def draw_background(rect)
  373.     back_colour1 = Color.new(0, 0, 0, 96)
  374.     back_colour2 = Color.new(0, 0, 0, 0)
  375.     contents.gradient_fill_rect(rect, back_colour1, back_colour2)
  376.   end
  377.   
  378. end # Window_EventWindow

  379. #==============================================================================
  380. # ■ Scene_Map
  381. #==============================================================================

  382. class Scene_Map < Scene_Base
  383.   
  384.   #--------------------------------------------------------------------------
  385.   # alias method: create_all_windows
  386.   #--------------------------------------------------------------------------
  387.   alias scene_map_create_all_windows_event_window create_all_windows
  388.   def create_all_windows
  389.     scene_map_create_all_windows_event_window
  390.     create_event_window
  391.   end
  392.   
  393.   #--------------------------------------------------------------------------
  394.   # new method: create_event_window
  395.   #--------------------------------------------------------------------------
  396.   def create_event_window
  397.     @event_window = Window_EventWindow.new
  398.   end
  399.   
  400.   #--------------------------------------------------------------------------
  401.   # new method: event_window_add_text
  402.   #--------------------------------------------------------------------------
  403.   def event_window_add_text(text)
  404.     Sound.play_shop
  405.     @event_window.add_text(text)
  406.   end
  407.   
  408.   #--------------------------------------------------------------------------
  409.   # alias method: post_transfer
  410.   #--------------------------------------------------------------------------
  411.   alias scene_map_post_transfer_ew post_transfer
  412.   def post_transfer
  413.     $game_temp.clear_event_window_data if YEA::EVENT_WINDOW::NEW_MAP_CLEAR
  414.     @event_window.instant_hide
  415.     scene_map_post_transfer_ew
  416.   end
  417.   
  418. end # Scene_Map

  419. #==============================================================================
  420. #
  421. # ▼ End of File
  422. #
  423. #==============================================================================
复制代码

348行和276行都是无效

我写的是    self.contents.font.size = 24#
是我写错了还是怎么的
帮忙看下在哪里改
人生是一场漫长的自杀。

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10074
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

2
发表于 2014-9-11 18:25:47 | 只看该作者
稍微看了一下,发现这个脚本是用draw_text_ex来绘制提示信息的。于是你可以使用Window_Base中的控制符来控制文字大小。
  1.     HEADER_TEXT = "\e}"                # 这里的\e}等价于对话中使用的\}是缩小一号字体的意思,嫌现在文字太大在加一个\e}否则删去\e}即可
  2.     FOUND_TEXT  = "\ec[6]获得\ec[0] "   # 于是这里什么意思就不用解释了吧?
  3.     LOST_TEXT   = "\ec[4]失去\ec[0] "    # Text used when an item is lost.
  4.     AMOUNT_TEXT = "×%s"                  # Text used to display an amount.
  5.     CLOSER_TEXT = ""                   # Text that's always used at the end.
复制代码

点评

好顶赞可以结贴  发表于 2014-9-11 20:44

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-14 23:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表