查看: 2714|回复: 3

[已经解决] 萌新问问关于地图名的问题

[复制链接]
梦石
1
星屑
1810
在线时间
138 小时
注册时间
2018-3-29
回帖
41
发表于 2018-6-26 16:44:32 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2018-11-13 08:58 编辑

使用了脚本MOG_地图名,也把素材图片替換成自己画的
不过最近发现了小问题
原本想法是把地图分成室外和室內2种。
室外使用这个脚本;室內使用內建左上角的地图名显示。
q1.png
▲室外

q2.png
▲室內

q3.png
▲但是在进入室內把脚本功能关闭一次之后再次开啟就开始2个地图名同时出现了

想问问大佬们这个情況有沒有方法解決的?

也把脚本附上來


  1. #==============================================================================
  2. # +++ MOG - 地图名 (v1.4) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # 显示一个Touhou风格的地图名.
  8. #==============================================================================
  9. # 将以下两张图片放在文件夹: Graphics/System/
  10. #
  11. # Map_Name_Particle.png
  12. # Map_Name_Layout.png
  13. #
  14. #==============================================================================
  15. # 开启或关闭本样式地图名的脚本.
  16. #
  17. # $game_temp.mapname = true
  18. #
  19. #==============================================================================
  20. #==============================================================================
  21. # ● Histórico (Version History)
  22. #==============================================================================
  23. # v 1.4 - Melhoria na codificação.
  24. #==============================================================================

  25. module MOG_TOUHOU_MAP_NAME
  26.   # 地图名位置.
  27.   MAP_NAME_POSITION = [272,192]
  28.   # 文本位置.
  29.   MAP_NAME_WORD_POSITION = [-30,18]
  30.   # 粒子的位置.
  31.   MAP_NAME_PARTICLE_POSITION = [-100,-50]
  32.   # 地图名Z坐标.
  33.   MAP_NAME_Z = 50
  34.   # 是否在默认情况下显示地图名.
  35.   MAP_NAME_AUTOMATIC = false

  36. end

  37. #==============================================================================
  38. # ■ Game Temp
  39. #==============================================================================
  40. class Game_Temp

  41. attr_accessor :mapname_conf
  42. attr_accessor :mapname_layout_conf
  43. attr_accessor :mapname_duration
  44. attr_accessor :mapname

  45. #--------------------------------------------------------------------------
  46. # ● Initialize
  47. #--------------------------------------------------------------------------                  
  48.   alias mog_map_name_initialize initialize
  49.   def initialize
  50.       @mapname_conf = []
  51.       @mapname_layout_conf = []
  52.       @mapname_duration = [false,-1,2]
  53.       @mapname = false
  54.       mog_map_name_initialize
  55.   end  
  56. end

  57. #==============================================================================
  58. # ■ Game Player
  59. #==============================================================================
  60. class Game_Player < Game_Character  

  61. #--------------------------------------------------------------------------
  62. # ● Perform Transfer
  63. #--------------------------------------------------------------------------                     
  64.   alias mog_touhou_map_name_perform_transfer perform_transfer
  65.   def perform_transfer
  66.       m_id = $game_map.map_id
  67.       mog_touhou_map_name_perform_transfer
  68.       if MOG_TOUHOU_MAP_NAME::MAP_NAME_AUTOMATIC
  69.          if m_id != $game_map.map_id and $game_map.display_name != ""
  70.             $game_temp.mapname = true
  71.          end
  72.       end   
  73.   end

  74. end  

  75. #==============================================================================
  76. # ■ Map Name
  77. #==============================================================================
  78. class Map_Name < Sprite
  79.   include MOG_TOUHOU_MAP_NAME
  80.   
  81.   attr_reader   :letter
  82.   attr_reader   :turn
  83.   attr_reader   :animation_duration
  84.   attr_reader   :text_duration
  85.   attr_reader   :duration

  86. #--------------------------------------------------------------------------
  87. # ● Initialize
  88. #--------------------------------------------------------------------------                 
  89.   def initialize(letter,x,y, zoom, opac,duration, animation_dutation, text_duration,turn, center_x, viewport = nil)      
  90.       super(viewport)
  91.       [url=home.php?mod=space&uid=446611]@letter[/url] = letter
  92.       @turn = turn
  93.       @duration = duration
  94.       @animation_duration = animation_dutation
  95.       @animation_duration2 = animation_dutation
  96.       @text_duration = text_duration
  97.       self.bitmap = Bitmap.new(32,32)
  98.       self.bitmap.font.size = 32
  99.       self.bitmap.font.bold = true
  100.       self.bitmap.font.italic = true
  101.       self.bitmap.draw_text(0,0, 32, 32, @letter.to_s,0)
  102.       self.z = 999
  103.       self.zoom_x = zoom
  104.       self.zoom_y = zoom
  105.       self.ox =  -100
  106.       self.oy =  -100
  107.       self.x = x
  108.       self.y = y
  109.       self.z = MAP_NAME_Z + 2
  110.       self.opacity = opac
  111.   end  
  112.   
  113. #--------------------------------------------------------------------------
  114. # ● Dispose
  115. #--------------------------------------------------------------------------               
  116.   def dispose_word
  117.       return if self.bitmap == nil
  118.       self.bitmap.dispose
  119.       self.bitmap = nil
  120.   end  
  121.   
  122. #--------------------------------------------------------------------------
  123. # ● Update
  124. #--------------------------------------------------------------------------               
  125.   def update
  126.       super
  127.       update_animation
  128.   end
  129.       
  130. #--------------------------------------------------------------------------
  131. # ● Update Animation
  132. #--------------------------------------------------------------------------                 
  133.   def update_animation
  134.       @animation_duration -= 1 if @animation_duration > 0
  135.       return if @animation_duration > 0
  136.       if self.zoom_x > 1
  137.          self.zoom_x -= 0.06
  138.          self.x += 5
  139.          self.y += 6        
  140.          self.opacity += 35
  141.          self.zoom_y = self.zoom_x
  142.          if self.zoom_x <= 1
  143.             self.zoom_x = 1
  144.             self.zoom_y = self.zoom_x
  145.             self.opacity = 255
  146.             @text_duration = @duration - @animation_duration2
  147.          end      
  148.        else
  149.           @text_duration -= 1
  150.        end
  151.   end
  152.       
  153. end

  154. #==============================================================================
  155. # ■ Particle_Name_Map
  156. #==============================================================================
  157. class Particle_Name_Map < Sprite
  158.   
  159.   include MOG_TOUHOU_MAP_NAME
  160.   
  161. #--------------------------------------------------------------------------
  162. # ● Initialize
  163. #--------------------------------------------------------------------------            
  164.   def initialize(viewport = nil,x,y,ax,ay)
  165.       super(viewport)
  166.       self.bitmap = Cache.system("Map_Name_Particle")
  167.       @pos = [x + self.bitmap.width,y - self.bitmap.height]
  168.       @area = [ax - (self.bitmap.width * 4),ay - self.bitmap.height]
  169.       reset_setting
  170.   end  
  171.   
  172. #--------------------------------------------------------------------------
  173. # ● Reset Setting
  174. #--------------------------------------------------------------------------               
  175.   def reset_setting
  176.       zoom = (50 + rand(100)) / 100.1
  177.       self.zoom_x = zoom
  178.       self.zoom_y = zoom
  179.       self.x = @pos[0] + rand(@area[0])
  180.       self.y = @pos[1] + rand(@area[1])
  181.       self.z = MAP_NAME_Z + 1
  182.       self.opacity = 0
  183.       self.angle = rand(360)
  184.       self.blend_type = 0
  185.       @speed_x = 0
  186.       @speed_y = [[rand(4), 4].min, 1].max
  187.       @speed_a = rand(3)
  188.       @fade_y = @pos[1] + 32
  189.   end
  190.   
  191. #--------------------------------------------------------------------------
  192. # ● Dispose
  193. #--------------------------------------------------------------------------               
  194.   def dispose
  195.       super
  196.       self.bitmap.dispose
  197.   end  
  198.   
  199. #--------------------------------------------------------------------------
  200. # ● Update
  201. #--------------------------------------------------------------------------               
  202.   def update
  203.       super
  204.       self.y -= @speed_y
  205.       self.opacity -= self.y > @fade_y ? -8 : 5
  206.       reset_setting if self.y < 0
  207.   end  
  208.   
  209. #--------------------------------------------------------------------------
  210. # ● Update Fade
  211. #--------------------------------------------------------------------------               
  212.   def update_fade
  213.       self.y -= @speed_y
  214.       self.opacity -= 5
  215.   end   
  216.   
  217. end

  218. #==============================================================================
  219. # ■ Spriteset Map
  220. #==============================================================================
  221. class Spriteset_Map

  222. #--------------------------------------------------------------------------
  223. # ● Initialize
  224. #--------------------------------------------------------------------------                 
  225.   alias mog_mapname_initialize initialize
  226.   def initialize
  227.       mog_mapname_initialize
  228.       create_touhou_map_name
  229.   end  
  230.   
  231. #--------------------------------------------------------------------------
  232. # ● Create Touhou Map Name
  233. #--------------------------------------------------------------------------                  
  234. def create_touhou_map_name
  235.      return if @th_map != nil
  236.      @th_map = Touhou_Map_Sprites.new
  237. end
  238.   
  239. #--------------------------------------------------------------------------
  240. # ● Dispose
  241. #--------------------------------------------------------------------------                 
  242.   alias mog_th_mapname_dispose dispose
  243.   def dispose
  244.       mog_th_mapname_dispose
  245.       dispose_touhou_map_name
  246.   end   
  247.   
  248. #--------------------------------------------------------------------------
  249. # ● Dispose Touhou Map Name
  250. #--------------------------------------------------------------------------                  
  251.   def dispose_touhou_map_name
  252.       return if @th_map == nil
  253.       @th_map.dispose
  254.       @th_map = nil
  255.   end
  256.   
  257. #--------------------------------------------------------------------------
  258. # ● Update
  259. #--------------------------------------------------------------------------                 
  260.   alias mog_th_mapname_update update
  261.   def update
  262.       mog_th_mapname_update
  263.       update_touhou_map_name
  264.   end   
  265.   
  266. #--------------------------------------------------------------------------
  267. # ● Update Touhou Map Name
  268. #--------------------------------------------------------------------------                  
  269.   def update_touhou_map_name
  270.       return if @th_map == nil
  271.       @th_map.update
  272.   end
  273.   
  274. end

  275. #==============================================================================
  276. # ■ Touhou Map Sprites
  277. #==============================================================================
  278. class Touhou_Map_Sprites
  279. include MOG_TOUHOU_MAP_NAME

  280. #--------------------------------------------------------------------------
  281. # ● Initialize
  282. #--------------------------------------------------------------------------                 
  283.   def initialize
  284.       @vis_time = 0
  285.       @vis = map_name_visible?
  286.       dispose
  287.       create_map_name
  288.       create_map_namelayout
  289.       create_light      
  290.   end
  291.   
  292. #--------------------------------------------------------------------------
  293. # ● Create Map Name
  294. #--------------------------------------------------------------------------                 
  295.   def create_map_name
  296.       return if $game_temp.mapname_duration[2] > 0
  297.       @map_name.each {|sprite| sprite.dispose_word} if @map_name != nil
  298.       @map_name = []
  299.       mapname = $game_map.display_name
  300.       m_name = mapname.to_s.split(//)
  301.       index = 0
  302.       turn = 0
  303.       duration = 20 * mapname.size      
  304.       center_x = 10 * mapname.size
  305.       $game_temp.mapname_duration[1] = (duration) + 64 if $game_temp.mapname_duration[1] <= 0
  306.       x2 = (-170 + MAP_NAME_POSITION[0] + MAP_NAME_WORD_POSITION[0]) - center_x
  307.       y2 = -170 + MAP_NAME_POSITION[1] + MAP_NAME_WORD_POSITION[1]
  308.       if $game_temp.mapname_conf == []
  309.          for i in m_name
  310.              @map_name.push(Map_Name.new(i[0],(index * 20) + x2,y2,1.8,0,duration, 20 * index,0,turn,center_x))
  311.              index += 1
  312.              turn = turn == 0 ? 1 : 0
  313.          end
  314.       else
  315.          c = $game_temp.mapname_conf   
  316.          for i in 0...c.size
  317.              @map_name.push(Map_Name.new(c[index][0],c[index][1],c[index][2],c[index][3],c[index][4],c[index][5],c[index][6],c[index][7],turn,0))
  318.              index += 1
  319.              turn = turn == 0 ? 1 : 0
  320.          end        
  321.       end
  322.   end
  323.   
  324. #--------------------------------------------------------------------------
  325. # ● Create Map Name Layout
  326. #--------------------------------------------------------------------------                  
  327. def create_map_namelayout
  328.      return if $game_temp.mapname_duration[2] > 1
  329.      if @map_name_layout != nil
  330.         @map_name_layout.bitmap.dispose
  331.         @map_name_layout.dispose
  332.         @map_name_layout = nil
  333.      end  
  334.      @map_name_layout = Sprite.new
  335.      @map_name_layout.bitmap = Cache.system("Map_Name_Layout.png")
  336.      @map_name_layout.z = MAP_NAME_Z
  337.      @map_name_org_position = [MAP_NAME_POSITION[0] - (@map_name_layout.bitmap.width / 2),MAP_NAME_POSITION[1] - (@map_name_layout.bitmap.height / 2)]
  338.      if $game_temp.mapname_layout_conf == []
  339.         @map_name_layout.x = @map_name_org_position[0] + 100
  340.         @map_name_layout.y = @map_name_org_position[1]
  341.         @map_name_layout.opacity = 0
  342.      else
  343.         @map_name_layout.x = $game_temp.mapname_layout_conf[0]
  344.         @map_name_layout.y = $game_temp.mapname_layout_conf[1]
  345.         @map_name_layout.opacity = $game_temp.mapname_layout_conf[2]
  346.      end
  347. end  

  348.   #--------------------------------------------------------------------------
  349.   # ● Create Light
  350.   #--------------------------------------------------------------------------  
  351.   def create_light
  352.       return if $game_temp.mapname_duration[2] > 1   
  353.       x = MAP_NAME_POSITION[0] + MAP_NAME_PARTICLE_POSITION[0]
  354.       y = MAP_NAME_POSITION[1] + MAP_NAME_PARTICLE_POSITION[1]   
  355.       @particle_name =[]
  356.       ax = @map_name_layout.bitmap.width - 32
  357.       ay = @map_name_layout.bitmap.height - 32
  358.       for i in 0...15
  359.           @particle_name.push(Particle_Name_Map.new(nil,x,y,ax,ay))
  360.       end  
  361.   end

  362. #--------------------------------------------------------------------------
  363. # ● Map Name Clear
  364. #--------------------------------------------------------------------------                  
  365. def map_name_clear
  366.      @map_name.each {|sprite| sprite.dispose_word} if @map_name != nil
  367.      @map_name = nil
  368.      $game_temp.mapname_duration[0] = false
  369.      $game_temp.mapname_duration[1] = -1
  370.      $game_temp.mapname_conf.clear
  371.      $game_temp.mapname_layout_conf.clear     
  372. end   

  373. #--------------------------------------------------------------------------
  374. # ● Layout Clear
  375. #--------------------------------------------------------------------------                        
  376.   def layout_clear
  377.       return if @map_name_layout == nil
  378.       @map_name_layout.bitmap.dispose
  379.       @map_name_layout.dispose
  380.       @map_name_layout = nil
  381.       $game_temp.mapname_layout_conf.clear
  382.   end
  383.    
  384. #--------------------------------------------------------------------------
  385. # ● Dispose
  386. #--------------------------------------------------------------------------                 
  387.   def dispose
  388.       dispose_map_name_word
  389.       dispose_map_name_layout
  390.       dispose_map_name_particle
  391.   end  
  392.   
  393. #--------------------------------------------------------------------------
  394. # ● Dispose Map Mame Layout
  395. #--------------------------------------------------------------------------                     
  396. def dispose_map_name_layout
  397.      return if @map_name_layout == nil
  398.      $game_temp.mapname_layout_conf[0] = @map_name_layout.x
  399.      $game_temp.mapname_layout_conf[1] = @map_name_layout.y
  400.      $game_temp.mapname_layout_conf[2] = @map_name_layout.opacity
  401.      @map_name_layout.bitmap.dispose
  402.      @map_name_layout.dispose
  403. end      
  404.      
  405. #--------------------------------------------------------------------------
  406. # ● Particle_Name Clear
  407. #--------------------------------------------------------------------------                        
  408.   def dispose_map_name_particle
  409.       return if @particle_name == nil
  410.       @particle_name.each {|sprite| sprite.dispose}
  411.       @particle_name = nil         
  412.   end

  413. #--------------------------------------------------------------------------
  414. # ● Dispose Map Mame Word
  415. #--------------------------------------------------------------------------                     
  416. def dispose_map_name_word
  417.      return if @map_name == nil
  418.      index = 0
  419.      for i in @map_name
  420.          if $game_temp.mapname_conf[index] == nil
  421.             $game_temp.mapname_conf[index] = ["",0,0,0,0,0,0,0,0]
  422.          end  
  423.          $game_temp.mapname_conf[index][0] = i.letter
  424.          $game_temp.mapname_conf[index][1] = i.x
  425.          $game_temp.mapname_conf[index][2] = i.y
  426.          $game_temp.mapname_conf[index][3] = i.zoom_x
  427.          $game_temp.mapname_conf[index][4] = i.opacity           
  428.          $game_temp.mapname_conf[index][5] = i.duration  
  429.          $game_temp.mapname_conf[index][6] = i.animation_duration
  430.          $game_temp.mapname_conf[index][7] = i.text_duration
  431.          i.dispose_word
  432.          index += 1
  433.      end
  434.      @map_name.each {|sprite| sprite.dispose_word}
  435.      @map_name = nil
  436. end
  437.       
  438. #--------------------------------------------------------------------------
  439. # ● Update
  440. #--------------------------------------------------------------------------                 
  441.   def update
  442.       refresh_map_name
  443.       dispose_map_name_time
  444.       update_word
  445.       update_map_name_layout
  446.   end  
  447.   
  448. #--------------------------------------------------------------------------
  449. # ● Map Name Visible?
  450. #--------------------------------------------------------------------------                    
  451.   def map_name_visible?
  452.       return false if !SceneManager.scene_is?(Scene_Map)
  453.       return false if @vis_time > 0
  454.       return true
  455.   end
  456.   
  457. #--------------------------------------------------------------------------
  458. # ● Refresh Map Name
  459. #--------------------------------------------------------------------------                  
  460.   def refresh_map_name
  461.       return unless $game_temp.mapname
  462.       $game_temp.mapname = false
  463.       map_name_clear
  464.       layout_clear
  465.       dispose_map_name_particle
  466.       $game_temp.mapname_duration[2] = 0      
  467.       create_map_name
  468.       create_map_namelayout
  469.       create_light
  470.   end  
  471.   
  472. #--------------------------------------------------------------------------
  473. # ● Update Light
  474. #--------------------------------------------------------------------------              
  475. def update_light
  476.      return if @particle_name == nil
  477.      for sprite in @particle_name
  478.          sprite.update
  479.          sprite.visible = @vis
  480.      end  
  481. end
  482.       
  483. #--------------------------------------------------------------------------
  484. # ● Update Fade ight
  485. #--------------------------------------------------------------------------              
  486. def update_fade_light
  487.      return if @particle_name == nil
  488.      @particle_name.each {|sprite| sprite.update_fade}      
  489. end  

  490. #--------------------------------------------------------------------------
  491. # ● Update Map Name Layout
  492. #--------------------------------------------------------------------------                     
  493.   def update_map_name_layout
  494.       return if @map_name_layout == nil
  495.       @vis = map_name_visible?
  496.       if !@vis
  497.          @vis_time = 1
  498.       else
  499.          @vis_time -= 1 if @vis_time > 0
  500.       end  
  501.       @map_name_layout.visible = @vis
  502.       if @map_name != nil
  503.          @map_name_layout.opacity += 5
  504.          update_light
  505.          if @map_name_layout.x > @map_name_org_position[0]
  506.             @map_name_layout.x -= 1
  507.          end  
  508.       else
  509.          @map_name_layout.x -= 2
  510.          @map_name_layout.opacity -= 8
  511.          update_fade_light
  512.          if @map_name_layout.opacity <= 0
  513.             layout_clear
  514.             dispose_map_name_particle
  515.             $game_temp.mapname_duration[2] = 2
  516.          end   
  517.       end
  518.   end
  519.   
  520. #--------------------------------------------------------------------------
  521. # ● Update Word
  522. #--------------------------------------------------------------------------                     
  523.   def update_word
  524.       return if @map_name == nil      
  525.       for map_sprite in @map_name
  526.           map_sprite.update
  527.           map_sprite.visible = @vis
  528.       end  
  529.   end  
  530.   
  531. #--------------------------------------------------------------------------
  532. # ● Dispose Map Name Time
  533. #--------------------------------------------------------------------------                       
  534.   def dispose_map_name_time
  535.       if $game_temp.mapname_duration[1] > 0
  536.          $game_temp.mapname_duration[1] -= 1
  537.          return
  538.       end   
  539.       return if $game_temp.mapname_duration[1] < 0
  540.       map_name_clear
  541.       $game_temp.mapname_duration[2] = 1
  542.   end  
  543.    
  544. end

  545. $mog_rgss3_touhou_map_name = true
复制代码
Where the tides are headed?
梦石
2
星屑
6777
在线时间
501 小时
注册时间
2018-3-23
回帖
487

R考场第七期银奖

发表于 2018-7-1 12:23:29 | 显示全部楼层
在场所移动之前打开这个功能试一试
祝好。
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2018-7-1 13:44:11 | 显示全部楼层
可以建两个公共事件:
公共事件1:《室内地图名转室外地图名》
脚本:$game_temp.mapname = true
更改显示地图名称:关闭

公共事件2:《室外地图名转室内地图名》
脚本:$game_temp.mapname = false
更改显示地图名称:开启

然后在进入室内地图的时候场景移动之前,先调用公共事件2,
从室内离开时场景移动前,先调用公共事件1……
回复

使用道具 举报

梦石
1
星屑
1810
在线时间
138 小时
注册时间
2018-3-29
回帖
41
 楼主| 发表于 2018-7-1 17:39:15 | 显示全部楼层
谢谢2位大佬的热心  这里给出一点测试回报
首先是离开时场景移动前先用脚本开关的问题回报:那是会失败.....
因为先用脚本的结果是进入下一地图时,脚本会显示上一张地图的名字,还有左上的地图名问题沒有解決到
不过3楼Dalao给出提示 原来有个功能是可以更改显示地图名称的开关
这个只要在地图更換前变更,然后再控制一个決定新地图用不用地图名脚本的开关,就成功了~~(开心的跳
Where the tides are headed?
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部