Project1

标题: 麻烦帮忙修改一个脚本,让它受某个开关的控制脚本是否... [打印本页]

作者: zl245479821    时间: 2013-6-20 15:59
标题: 麻烦帮忙修改一个脚本,让它受某个开关的控制脚本是否...
  1. #===============================================================================
  2. # MOG_Location_Name_VX V1.0            
  3. #===============================================================================
  4. # By Moghunter       汉化:火鸡三毛老大
  5. #===============================================================================
  6. module MOG
  7. #地图名字体.
  8. MPFONT = "Georgia"
  9. #------------------------------------------------
  10. #消失 ON/OFF(True - False).
  11. MPNMFD = true
  12. #------------------------------------------------
  13. #窗口消失时间.
  14. MPNMTM = 10
  15. #------------------------------------------------
  16. #窗口提示位置.
  17. # 0 = 左上角.
  18. # 1 = 左下角.
  19. # 2 = 右上角.
  20. # 3 = 右下角.
  21. MPNMPS = 0
  22. #------------------------------------------------
  23. # 关闭开启显示提示(ID).
  24. WM_SWITCH_VIS_DISABLE = 1
  25. end
  26. #------------------------------------------------
  27. ###############
  28. # Game_System #
  29. ###############
  30. class Game_System
  31. attr_accessor :fdtm
  32. attr_accessor :mpnm_x
  33. attr_accessor :mpnm_y
  34. alias mog_vx06_initialize initialize
  35. def initialize
  36. mog_vx06_initialize
  37. @fdtm = 255 + 40 * MOG::MPNMTM
  38. if MOG::MPNMPS == 0
  39. @mpnm_x = -300
  40. @mpnm_y = 0
  41. elsif MOG::MPNMPS == 1
  42. @mpnm_x = -300
  43. @mpnm_y = 320
  44. elsif MOG::MPNMPS == 2
  45. @mpnm_x = 640
  46. @mpnm_y = 0
  47. else
  48. @mpnm_x = 640
  49. @mpnm_y = 320
  50. end  
  51. end
  52. def mpnm_x
  53. return @mpnm_x
  54. end
  55. def mpnm_y
  56. return @mpnm_y
  57. end
  58. def fdtm
  59. if @fdtm <= 0
  60. @fdtm = 0
  61. end
  62. return @fdtm
  63. end
  64. end
  65. ############
  66. # Game_Map #
  67. ############
  68. class Game_Map
  69. attr_reader   :map_id  
  70. def mpname
  71. $mpname = load_data("Data/MapInfos.rvdata")
  72. $mpname[@map_id].name
  73. end
  74. end
  75. ###############
  76. # Window Base #
  77. ###############
  78. class Window_Base < Window
  79. def nd_mapic
  80. mapic = Cache.system("")     
  81. end  
  82. def draw_mpname(x,y)
  83. mapic = Cache.system("Mpname") rescue nd_mapic   
  84. cw = mapic.width  
  85. ch = mapic.height
  86. src_rect = Rect.new(0, 0, cw, ch)
  87. self.contents.blt(x , y - ch + 65, mapic, src_rect)
  88. self.contents.font.name = MOG::MPFONT
  89. self.contents.font.size = 22
  90. self.contents.font.bold = true
  91. self.contents.font.shadow = true
  92. self.contents.font.color = Color.new(0,0,0,255)
  93. self.contents.draw_text(x + 76, y + 27, 110, 32, $game_map.mpname.to_s,1)
  94. self.contents.font.color = Color.new(255,255,255,255)
  95. self.contents.draw_text(x + 75, y + 26, 110, 32, $game_map.mpname.to_s,1)
  96. end
  97. end
  98. ##########
  99. # Mpname #
  100. ##########
  101. class Mpname < Window_Base
  102. def initialize(x , y)
  103. super($game_system.mpnm_x, $game_system.mpnm_y, 250, WLH + 70)
  104. self.opacity = 0
  105. refresh
  106. end
  107. def refresh
  108. self.contents.clear
  109. draw_mpname(10,0)   
  110. end
  111. end
  112. #############
  113. # Scene_Map #
  114. #############
  115. class Scene_Map
  116. alias mog_vx06_start start
  117. def start
  118. @mpnm = Mpname.new($game_system.mpnm_x, $game_system.mpnm_y)
  119. @mpnm.contents_opacity = $game_system.fdtm
  120. if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == false
  121. @mpnm.visible = true
  122. else
  123. @mpnm.visible = false  
  124. end  
  125. mog_vx06_start  
  126. end  
  127. alias mog_vx06_terminate terminate
  128. def terminate
  129. mog_vx06_terminate
  130. @mpnm.dispose
  131. end
  132. alias mog_vx06_update update
  133. def update
  134. mog_vx06_update  
  135. location_name_update
  136. end
  137. def location_name_update
  138. $game_system.mpnm_x = @mpnm.x
  139. $game_system.mpnm_y = @mpnm.y
  140. if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == true or $game_system.fdtm <= 0
  141. @mpnm.visible = false  
  142. else
  143. @mpnm.visible = true
  144. end
  145. if MOG::MPNMPS == 0 or MOG::MPNMPS == 1
  146. if @mpnm.x < 0
  147. @mpnm.x += 5
  148. elsif @mpnm.x >= 0
  149. @mpnm.x = 0
  150. end   
  151. else
  152. if @mpnm.x > 300
  153. @mpnm.x -= 5
  154. elsif @mpnm.x <= 300
  155. @mpnm.x = 300
  156. end     
  157. end
  158. @mpnm.contents_opacity = $game_system.fdtm
  159. if MOG::MPNMFD == true
  160. $game_system.fdtm -= 3
  161. end
  162. end
  163. alias mog_vx06_update_transfer_player update_transfer_player
  164. def update_transfer_player
  165. return unless $game_player.transfer?
  166. @mpnm.contents_opacity = 0
  167. mog_vx06_update_transfer_player
  168. if MOG::MPNMPS == 0
  169. $game_system.mpnm_x = -340
  170. $game_system.mpnm_y = 0
  171. elsif MOG::MPNMPS == 1
  172. $game_system.mpnm_x = -340
  173. $game_system.mpnm_y = 320
  174. elsif MOG::MPNMPS == 2
  175. $game_system.mpnm_x = 640
  176. $game_system.mpnm_y = 0
  177. else
  178. $game_system.mpnm_x = 640
  179. $game_system.mpnm_y = 320
  180. end  
  181. @mpnm.y = $game_system.mpnm_y
  182. @mpnm.x = $game_system.mpnm_x
  183. $game_system.fdtm = 255 + 60 * MOG::MPNMTM
  184. @mpnm.refresh
  185. end
  186. end
  187. $mogscript = {} if $mogscript == nil
  188. $mogscript["location_name_vx"] = true
复制代码

作者: zl245479821    时间: 2013-6-20 16:01
就是让他受20号开关控制,20开,脚本才能起作用。20关,脚本就无效。
作者: gaofei677    时间: 2013-6-20 18:17
楼主只要把第24行改为WM_SWITCH_VIS_DISABLE = 20,那么就是第20号开关打开,这个脚本停止工作
PS,上次我帮楼主解决了两个问题,楼主不要自行把帖子类型改为"已经解决",这样版主容易忘记加分,如果楼主有时间,麻烦把那两个帖子改回"有事请教"
作者: gaofei677    时间: 2013-6-20 21:07
zl245479821 发表于 2013-6-20 16:01
就是让他受20号开关控制,20开,脚本才能起作用。20关,脚本就无效。


打开20号开关,脚本停止
关闭20好开关,脚本工作




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1