查看: 2367|回复: 2

[已经解决] 更改窗口

[复制链接]
梦石
0
星屑
50
在线时间
94 小时
注册时间
2016-10-21
回帖
32
发表于 2017-4-30 21:59:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 RyanBern 于 2017-5-1 16:39 编辑

怎么把这个图上的窗口改为4x5样式的
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
这种样式排布的

这是脚本

  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. # 自定义内容解释:
  5. # TOWNS[编号]=["地名,可以随便写",开关编号,[传送去的地图id,传送去的地图x,
  6. #              传送去的地图y],角色朝向]
  7. #
  8. # 编号请按照0、1、2、3……顺序往下排布
  9. # 当编号的开关打开的时候,才可以选择这个传送地点
  10. # 角色朝向,2为下,4为左,6为右,8为上,具体可以参考自己数字小键盘的方向和数字关系
  11. # 如果是其他方向请自己改。
  12. #
  13. # 需要制作脚本,请点击66rpg.com最底部的QQ交谈
  14. #
  15. # 使用方法:在需要传送的传送门、传送石、传送羽毛、传送旅店一类的地方使用公共事件:
  16. #           呼叫脚本:$scene = Scene_Teleport.new
  17. #
  18. # 制作者:柳柳
  19. #==============================================================================
  20. TOWNS=[]
  21. TOWNS[0]=["古德城堡东门",1,[1,2,3],2]
  22. TOWNS[1]=["古德城堡西门",2,[1,2,5],4]
  23. TOWNS[2]=["修道院门口",3,[3,3,6],4]
  24. TOWNS[3]=["女神遗迹南口",4,[4,2,6],4]
  25. TOWNS[4]=["圣天城骑士团练兵场",5,[5,2,6],4]
  26. TOWNS[5]=["许愿之塔",6,[6,9,6],4]
  27. #==============================================================================
  28. # ■ Window_Teleport
  29. #------------------------------------------------------------------------------
  30. #  处理传送的窗口
  31. #==============================================================================
  32. class Window_Teleport < Window_Selectable
  33.   #--------------------------------------------------------------------------
  34.   # ● 初始化对像
  35.   #--------------------------------------------------------------------------
  36.   def initialize
  37.     super(640,640,64,64)
  38.     self.contents = Bitmap.new(width, height)
  39.     self.opacity = 180
  40.     get_towns
  41.     draw_towns
  42.     @column_max = 1
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 获取可到达的城镇和窗口大小
  46.   #--------------------------------------------------------------------------
  47.   def get_towns
  48.     @carol3_towns = []
  49.     @width_temp = 0
  50.     @cont_use = false
  51.     for town in TOWNS
  52.       if $game_switches[town[1]]==true
  53.         @carol3_towns.push(town)
  54.         if contents.text_size(town[0]).width >= @width_temp
  55.           @width_temp = contents.text_size(town[0]).width
  56.         end
  57.       end
  58.     end
  59.     @item_max = @carol3_towns.size
  60.     if @item_max == 0
  61.       @carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
  62.       @width_temp = contents.text_size(@carol3_towns[0][0]).width
  63.       @item_max = 1
  64.       @cont_use = true
  65.     end
  66.     self.width = [@width_temp+32,480].min
  67.     self.height = [(@item_max+1)*32,360].min
  68.     self.x = (640-self.width)/2
  69.     self.y = (480-self.height)/2
  70.     self.contents = Bitmap.new(width-32,row_max*32)
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 描绘城镇名称
  74.   #--------------------------------------------------------------------------
  75.   def draw_towns
  76.     for i in [email]0...@carol3_towns.size[/email]
  77.       self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
  78.     end
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 返回的内容
  82.   #========================================================================
  83.   # ● 地图编号
  84.   #--------------------------------------------------------------------------
  85.   def map_id
  86.     return @carol3_towns[self.index][2][0]
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 地图x坐标
  90.   #--------------------------------------------------------------------------
  91.   def map_x
  92.     return @carol3_towns[self.index][2][1]
  93.   end      
  94.   #--------------------------------------------------------------------------
  95.   # ● 地图y坐标
  96.   #--------------------------------------------------------------------------
  97.   def map_y
  98.     return @carol3_towns[self.index][2][2]
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 角色朝向
  102.   #--------------------------------------------------------------------------
  103.   def map_direction
  104.     return @carol3_towns[self.index][2][3]
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 判断是否一个城市都没有
  108.   #--------------------------------------------------------------------------
  109.   def cant_use?
  110.     return @cont_use
  111.   end
  112. end
  113. #==============================================================================
  114. # ■ Scene_Teleport
  115. #------------------------------------------------------------------------------
  116. #  处理传送执行的类
  117. #==============================================================================
  118. class Scene_Teleport
  119.   #--------------------------------------------------------------------------
  120.   # ● 主处理
  121.   #--------------------------------------------------------------------------
  122.   def main
  123.     $game_system.se_play($data_system.decision_se)
  124.     @carol3_trans_white = false
  125.     @carol3_map_sprite = Spriteset_Map.new
  126.     @carol3_teleport_window = Window_Teleport.new
  127.     if @carol3_teleport_window.cant_use?
  128.       @carol3_teleport_window.index = -1
  129.     else
  130.       @carol3_teleport_window.index = 0
  131.     end
  132.     @carol3_teleport_window.active = true
  133.     Graphics.transition
  134.     loop do
  135.       Graphics.update
  136.       Input.update
  137.       carol3_update
  138.       if $scene != self
  139.         break
  140.       end
  141.     end   
  142.     if @carol3_trans_white==true
  143.       @carol3_white_sprite = Sprite.new
  144.       @carol3_white_sprite.bitmap = Bitmap.new(640,480)
  145.       @carol3_white_sprite.opacity = 0
  146.       @carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
  147.       for i in 0..20
  148.         @carol3_white_sprite.opacity += 15
  149.         @carol3_teleport_window.opacity -= 12
  150.         @carol3_teleport_window.contents_opacity -= 12
  151.         Graphics.update
  152.       end
  153.       Graphics.freeze
  154.       Graphics.transition(0)
  155.       Graphics.update
  156.       @carol3_map_sprite.dispose
  157.       $game_map.setup($game_temp.player_new_map_id)
  158.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  159.       $game_player.turn_down
  160.       $game_player.straighten
  161.       $game_map.autoplay      
  162.       Graphics.frame_reset
  163.       for i in 0..20
  164.         @carol3_white_sprite.opacity -= 15
  165.         Graphics.update
  166.       end
  167.       @carol3_white_sprite.dispose
  168.       @carol3_teleport_window.dispose
  169.       Graphics.freeze
  170.     else
  171.       Graphics.freeze
  172.       @carol3_teleport_window.dispose
  173.       @carol3_map_sprite.dispose
  174.     end   
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 刷新画面
  178.   #--------------------------------------------------------------------------
  179.   def carol3_update
  180.     @carol3_teleport_window.update
  181.     if Input.trigger?(Input::B)
  182.       $game_system.se_play($data_system.cancel_se)
  183.       $scene = Scene_Map.new
  184.       return
  185.     end
  186.     if Input.trigger?(Input::C)
  187.       if @carol3_teleport_window.index == -1
  188.         $game_system.se_play($data_system.cancel_se)
  189.         $scene = Scene_Map.new
  190.         return
  191.       else        
  192.         $game_temp.player_new_map_id = @carol3_teleport_window.map_id
  193.         $game_temp.player_new_x = @carol3_teleport_window.map_x
  194.         $game_temp.player_new_y = @carol3_teleport_window.map_y
  195.         $game_temp.player_new_direction = @carol3_teleport_window.map_direction
  196.         $game_temp.player_transferring = true
  197.         $game_temp.transition_processing = true
  198.         $game_temp.transition_name = ""
  199.         $scene = Scene_Map.new
  200.         @carol3_trans_white = true
  201.         Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
  202.         return
  203.       end
  204.     end   
  205.   end
  206. end

  207. #==============================================================================
  208. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  209. #==============================================================================
复制代码

捕获.PNG
梦石
0
星屑
125
在线时间
171 小时
注册时间
2014-4-14
回帖
135
发表于 2017-5-1 08:55:16 | 显示全部楼层
本帖最后由 2357691704 于 2017-5-1 09:00 编辑


弄好了。因窗口大小限制,脚本里面地图的名字请限制4个字数(长度128)
如有需要增添选项数量 或修改窗口坐标等 请自行对照修改。

注意:97行的“[email]和[/ email]字样请删去,这是论坛发贴自己加上去的(将脚本误以为是邮箱链接)。

.

  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. # 自定义内容解释:
  5. # TOWNS[编号]=["地名,可以随便写",开关编号,[传送去的地图id,传送去的地图x,
  6. #              传送去的地图y],角色朝向]
  7. #
  8. # 编号请按照0、1、2、3……顺序往下排布
  9. # 当编号的开关打开的时候,才可以选择这个传送地点
  10. # 角色朝向,2为下,4为左,6为右,8为上,具体可以参考自己数字小键盘的方向和数字关系
  11. # 如果是其他方向请自己改。
  12. #
  13. # 需要制作脚本,请点击66rpg.com最底部的QQ交谈
  14. #
  15. # 使用方法:在需要传送的传送门、传送石、传送羽毛、传送旅店一类的地方使用公共事件:
  16. #           呼叫脚本:$scene = Scene_Teleport.new
  17. #
  18. # 制作者:柳柳
  19. #==============================================================================
  20. TOWNS=[]
  21. TOWNS[0]=["古德城堡",1,[1,2,3],2]
  22. TOWNS[1]=["古德城堡",1,[1,2,5],4]
  23. TOWNS[2]=["修道院一",1,[3,3,6],4]
  24. TOWNS[3]=["女神遗址",1,[4,2,6],4]
  25. TOWNS[4]=["圣天城堡",1,[5,2,6],4]
  26. TOWNS[5]=["许愿之塔",2,[6,9,6],4]
  27. TOWNS[6]=["古德城堡",2,[1,2,3],2]
  28. TOWNS[7]=["古德城堡",2,[1,2,5],4]
  29. TOWNS[8]=["修道院一",2,[3,3,6],4]
  30. TOWNS[9]=["女神遗址",2,[4,2,6],4]
  31. TOWNS[10]=["圣天城堡",3,[5,2,6],4]
  32. TOWNS[11]=["许愿之塔",3,[6,9,6],4]
  33. TOWNS[12]=["古德城堡",3,[1,2,3],2]
  34. TOWNS[13]=["古德城堡",3,[1,2,5],4]
  35. TOWNS[14]=["修道院一",3,[3,3,6],4]
  36. TOWNS[15]=["女神遗址",4,[4,2,6],4]
  37. TOWNS[16]=["圣天城堡",4,[5,2,6],4]
  38. TOWNS[17]=["许愿之塔",4,[6,9,6],4]
  39. TOWNS[18]=["古德城堡",4,[1,2,3],2]
  40. TOWNS[19]=["古德城堡",4,[1,2,5],4]
  41. #==============================================================================
  42. # ■ Window_Teleport
  43. #------------------------------------------------------------------------------
  44. #  处理传送的窗口
  45. #==============================================================================
  46. class Window_Teleport < Window_Selectable
  47.   #--------------------------------------------------------------------------
  48.   # ● 初始化对像
  49.   #--------------------------------------------------------------------------
  50.   def initialize
  51.     super(0,0,640,166)
  52.     self.contents = Bitmap.new(width, height)
  53.     self.opacity = 180
  54.     get_towns
  55.     draw_towns
  56.     @column_max = 5
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 获取可到达的城镇和窗口大小
  60.   #--------------------------------------------------------------------------
  61.   def get_towns
  62.     @carol3_towns = []
  63.     @width_temp = 0
  64.     @cont_use = false
  65.     for town in TOWNS
  66.       if $game_switches[town[1]]==true
  67.         @carol3_towns.push(town)
  68.         if contents.text_size(town[0]).width >= @width_temp
  69.           @width_temp = contents.text_size(town[0]).width
  70.         end
  71.       end
  72.     end
  73.     @item_max = @carol3_towns.size
  74.     if @item_max == 0
  75.       @carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
  76.       @width_temp = contents.text_size(@carol3_towns[0][0]).width
  77.       @item_max = 1
  78.       @cont_use = true
  79.     end
  80. =begin   
  81.     self.width = [@width_temp+32,480].min
  82.     self.height = [(@item_max+1)*32,360].min
  83.     self.x = (640-self.width)/2
  84.     self.y = (480-self.height)/2
  85.     self.contents = Bitmap.new(width-32,row_max*32)
  86.   end
  87. =end  
  88.     #self.x = (640-self.width)/2
  89.     #self.y = (480-self.height)/2
  90.     self.contents = Bitmap.new(width-32,height-32)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 描绘城镇名称
  94.   #--------------------------------------------------------------------------
  95.   def draw_towns
  96.     for i in [email]0...@carol3_towns.size[/email]
  97.       #self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
  98.      if i<= 4
  99.         self.contents.draw_text(i*128,0,@width_temp,32,@carol3_towns[i][0],1)
  100.       elsif i>4 and i<= 9
  101.         self.contents.draw_text((i-5) * 128,32,@width_temp,32,@carol3_towns[i][0],1)
  102.         elsif i>9 and i<= 14
  103.         self.contents.draw_text((i-10) * 128,64,@width_temp,32,@carol3_towns[i][0],1)
  104.         elsif i>14 and i<= 19
  105.         self.contents.draw_text((i-15) * 128,96,@width_temp,32,@carol3_towns[i][0],1)
  106.       end
  107.       end
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 返回的内容
  111.   #========================================================================
  112.   # ● 地图编号
  113.   #--------------------------------------------------------------------------
  114.   def map_id
  115.     return @carol3_towns[self.index][2][0]
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 地图x坐标
  119.   #--------------------------------------------------------------------------
  120.   def map_x
  121.     return @carol3_towns[self.index][2][1]
  122.   end      
  123.   #--------------------------------------------------------------------------
  124.   # ● 地图y坐标
  125.   #--------------------------------------------------------------------------
  126.   def map_y
  127.     return @carol3_towns[self.index][2][2]
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 角色朝向
  131.   #--------------------------------------------------------------------------
  132.   def map_direction
  133.     return @carol3_towns[self.index][2][3]
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 判断是否一个城市都没有
  137.   #--------------------------------------------------------------------------
  138.   def cant_use?
  139.     return @cont_use
  140.   end
  141. end
  142. #==============================================================================
  143. # ■ Scene_Teleport
  144. #------------------------------------------------------------------------------
  145. #  处理传送执行的类
  146. #==============================================================================
  147. class Scene_Teleport
  148.   #--------------------------------------------------------------------------
  149.   # ● 主处理
  150.   #--------------------------------------------------------------------------
  151.   def main
  152.     $game_system.se_play($data_system.decision_se)
  153.     @carol3_trans_white = false
  154.     @carol3_map_sprite = Spriteset_Map.new
  155.     @carol3_teleport_window = Window_Teleport.new
  156.     if @carol3_teleport_window.cant_use?
  157.       @carol3_teleport_window.index = -1
  158.     else
  159.       @carol3_teleport_window.index = 0
  160.     end
  161.     @carol3_teleport_window.active = true
  162.     Graphics.transition
  163.     loop do
  164.       Graphics.update
  165.       Input.update
  166.       carol3_update
  167.       if $scene != self
  168.         break
  169.       end
  170.     end   
  171.     if @carol3_trans_white==true
  172.       @carol3_white_sprite = Sprite.new
  173.       @carol3_white_sprite.bitmap = Bitmap.new(640,480)
  174.       @carol3_white_sprite.opacity = 0
  175.       @carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
  176.       for i in 0..20
  177.         @carol3_white_sprite.opacity += 15
  178.         @carol3_teleport_window.opacity -= 12
  179.         @carol3_teleport_window.contents_opacity -= 12
  180.         Graphics.update
  181.       end
  182.       Graphics.freeze
  183.       Graphics.transition(0)
  184.       Graphics.update
  185.       @carol3_map_sprite.dispose
  186.       $game_map.setup($game_temp.player_new_map_id)
  187.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  188.       $game_player.turn_down
  189.       $game_player.straighten
  190.       $game_map.autoplay      
  191.       Graphics.frame_reset
  192.       for i in 0..20
  193.         @carol3_white_sprite.opacity -= 15
  194.         Graphics.update
  195.       end
  196.       @carol3_white_sprite.dispose
  197.       @carol3_teleport_window.dispose
  198.       Graphics.freeze
  199.     else
  200.       Graphics.freeze
  201.       @carol3_teleport_window.dispose
  202.       @carol3_map_sprite.dispose
  203.     end   
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 刷新画面
  207.   #--------------------------------------------------------------------------
  208.   def carol3_update
  209.     @carol3_teleport_window.update
  210.     if Input.trigger?(Input::B)
  211.       $game_system.se_play($data_system.cancel_se)
  212.       $scene = Scene_Map.new
  213.       return
  214.     end
  215.     if Input.trigger?(Input::C)
  216.       if @carol3_teleport_window.index == -1
  217.         $game_system.se_play($data_system.cancel_se)
  218.         $scene = Scene_Map.new
  219.         return
  220.       else        
  221.         $game_temp.player_new_map_id = @carol3_teleport_window.map_id
  222.         $game_temp.player_new_x = @carol3_teleport_window.map_x
  223.         $game_temp.player_new_y = @carol3_teleport_window.map_y
  224.         $game_temp.player_new_direction = @carol3_teleport_window.map_direction
  225.         $game_temp.player_transferring = true
  226.         $game_temp.transition_processing = true
  227.         $game_temp.transition_name = ""
  228.         $scene = Scene_Map.new
  229.         @carol3_trans_white = true
  230.         Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
  231.         return
  232.       end
  233.     end   
  234.   end
  235. end

  236. #==============================================================================
  237. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  238. #==============================================================================
复制代码
截图20170501084833.png

评分

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

查看全部评分

Vanyogin
回复

使用道具 举报

梦石
0
星屑
50
在线时间
94 小时
注册时间
2016-10-21
回帖
32
 楼主| 发表于 2017-5-1 11:48:20 | 显示全部楼层
2357691704 发表于 2017-5-1 08:55
弄好了。因窗口大小限制,脚本里面地图的名字请限制4个字数(长度128)
如有需要增添选项数量 或修改窗口 ...

嗯,谢了
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部