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

Project1

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

[已经解决] 想问问这个脚本里有哪里可以改字体大小吗?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1956
在线时间
308 小时
注册时间
2020-3-17
帖子
50
跳转到指定楼层
1
发表于 2021-4-13 22:44:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
是获得物品提示脚本……
我游戏里设置的是仿宋,字体大小16
获得物品弹出的提示字体太小看不清楚啊……
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Event Window v1.01
  4. # -- Last Updated: 2011.12.27
  5. # -- Level: Easy, Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

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

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

  94. #==============================================================================
  95. # ▼ Editting anything past this point may potentially result in causing
  96. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  97. # halitosis so edit at your own risk.
  98. #==============================================================================

  99. #==============================================================================
  100. # ■ Switch
  101. #==============================================================================

  102. module Switch
  103.   
  104.   #--------------------------------------------------------------------------
  105.   # self.hide_event_window
  106.   #--------------------------------------------------------------------------
  107.   def self.hide_event_window
  108.     return false if YEA::EVENT_WINDOW::HIDE_SWITCH <= 0
  109.     return $game_switches[YEA::EVENT_WINDOW::HIDE_SWITCH]
  110.   end
  111.    
  112. end # Switch

  113. #==============================================================================
  114. # ■ Numeric
  115. #==============================================================================

  116. class Numeric
  117.   
  118.   #--------------------------------------------------------------------------
  119.   # new method: group_digits
  120.   #--------------------------------------------------------------------------
  121.   unless $imported["YEA-CoreEngine"]
  122.   def group; return self.to_s; end
  123.   end # $imported["YEA-CoreEngine"]
  124.    
  125. end # Numeric

  126. #==============================================================================
  127. # ■ Game_Temp
  128. #==============================================================================

  129. class Game_Temp
  130.   
  131.   #--------------------------------------------------------------------------
  132.   # public instance variables
  133.   #--------------------------------------------------------------------------
  134.   attr_accessor :event_window_data
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # new method: add_event_window_data
  138.   #--------------------------------------------------------------------------
  139.   def add_event_window_data(text)
  140.     @event_window_data = [] if @event_window_data.nil?
  141.     return if text == ""
  142.     @event_window_data.push(text)
  143.   end
  144.   
  145.   #--------------------------------------------------------------------------
  146.   # new method: clear_event_window_data
  147.   #--------------------------------------------------------------------------
  148.   def clear_event_window_data
  149.     @event_window_data = []
  150.   end
  151.   
  152. end # Game_Temp

  153. #==============================================================================
  154. # ■ Game_Interpreter
  155. #==============================================================================

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

  256. #==============================================================================
  257. # ■ Window_EventWindow
  258. #==============================================================================

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

  387. #==============================================================================
  388. # ■ Scene_Map
  389. #==============================================================================

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

  427. #==============================================================================
  428. #
  429. # ▼ End of File
  430. #
  431. #==============================================================================
复制代码
↖这就是个新手,什么都不懂,大佬见谅。

Lv5.捕梦者

梦石
0
星屑
26523
在线时间
5388 小时
注册时间
2016-3-8
帖子
1658
2
发表于 2021-4-13 23:49:10 | 只看该作者
本帖最后由 alexncf125 于 2021-4-13 23:51 编辑

先插入这一段
  1. class Window_Base < Window
  2.   alias window_base_process_escape_character_ams process_escape_character
  3.   def process_escape_character(code, text, pos)
  4.     case code.upcase
  5.     when 'FZ'
  6.       contents.font.size = obtain_escape_param(text)
  7.     else
  8.       window_base_process_escape_character_ams(code, text, pos)
  9.     end
  10.   end
  11. end
复制代码

再在388行draw_text_ex(rect.x, rect.y, item)前
加句item = "\efz[32]" + item应该就行了



奇怪了...388行前直接加contents.font.size = 32竟然不管用...
为什么

点评

那鲁吼多  发表于 2021-4-14 09:25
因为 draw text ex会调用一个reset font settings,里面把字号又重置了  发表于 2021-4-14 09:04
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1956
在线时间
308 小时
注册时间
2020-3-17
帖子
50
3
 楼主| 发表于 2021-4-14 01:00:35 | 只看该作者
alexncf125 发表于 2021-4-13 23:49
先插入这一段

再在388行draw_text_ex(rect.x, rect.y, item)前

好了!谢谢!
↖这就是个新手,什么都不懂,大佬见谅。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-24 11:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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