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

Project1

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

[有事请教] xp角色选择脚本求移植成VX的

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
123 小时
注册时间
2012-2-12
帖子
73
跳转到指定楼层
1
发表于 2012-4-9 19:08:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 [email protected] 于 2012-4-9 21:10 编辑
  1. #============角色选择=========By凌冰==========================================
  2. #用法 $scene = Scene_SelectActor.new
  3. #=============================================================================
  4. #参与选择的角色ID

  5. ACT_SEL = [1,2,3,4]

  6. #====================================
  7. #存储选择结果的变量ID

  8. VA_ID = 4999

  9. #====================================
  10. #窗口设置

  11. WIDTH = 700#窗口宽度
  12. HEIGHT = 480#窗口高度
  13. OPACITY = 255#窗口透明度
  14. BACK_OPACITY = 255#窗口透明度

  15. #====================================
  16. #选择显示图形

  17. CHAORBAT = 1#2
  18. #0为显示人物战斗图,1为显示人物行走图
  19. #2为显示Pictures文件夹下的自定义图片(图片名为角色名)
  20. #其他为不显示图片

  21. #====================================
  22. #人物说明= =暂时仅限一行

  23. DES_SWI = true#说明开关
  24. ACT_DES = []#初始化,请不要修改
  25. #以下填写格式为ACT_DES[角色ID] = "说明文字"
  26. ACT_DES[1] = "阿尔西斯"
  27. ACT_DES[2] = "帕吉尔"
  28. ACT_DES[3] = "塞拉斯"
  29. ACT_DES[4] = "特萝西"

  30. #====================================
  31. #背景图片

  32. BGP_SWI = false#背景开关= =打开后PDE_SWI被屏蔽
  33. BGP_PIC = "Logo"#背景图片文件名Pictures文件夹下
  34. BGP_OPA = 180#开关打开后,窗口透明度
  35. BGP_BOP = 0#开关打开后,窗口(不包括边框)透明度

  36. #====================================
  37. #说明图片
  38. #移动光标矩形时自动切换图片

  39. PDE_SWI = true#图片开关= =BGP_SWI打开后被屏蔽
  40. PIC_DES = []#初始化,请不要修改
  41. #以下填写格式为PIC_DES[角色ID] = "图片文件名"
  42. PIC_DES[1] = "Logo"
  43. PIC_DES[2] = "Logo"
  44. PIC_DES[3] = "Logo"
  45. PIC_DES[4] = "Logo"
  46. PDE_OPA = 180#开关打开后,窗口透明度
  47. PDE_BOP = 0#开关打开后,窗口(不包括边框)透明度

  48. #====================================
  49. class Window_SelectActor < Window_Selectable
  50.   def initialize
  51.     super(0, 0, WIDTH, HEIGHT)
  52.     self.contents = Bitmap.new(width - 32, height - 32)
  53.     @item_max = ACT_SEL.size
  54.     @column_max = ACT_SEL.size
  55.     @index = 0
  56.     self.x = (640-self.width)/2
  57.     self.y = (480-self.height)/2
  58.     refresh
  59.   end
  60.   def refresh
  61.     self.contents.clear
  62.     for i in 0...ACT_SEL.size
  63.       x = (self.width-32)/ACT_SEL.size * i
  64.       actor = $game_actors[ACT_SEL[i]]
  65.       x_plus = contents.text_size(actor.name).width
  66.       x_plus = ((self.width-32)/ACT_SEL.size - x_plus)/2
  67.       draw_actor_name(actor, x+4+x_plus, 4)
  68.       case CHAORBAT
  69.       when 0
  70.         bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  71.         src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  72.         x_plus = bitmap.width
  73.         x_plus = ((self.width-32)/ACT_SEL.size - x_plus)/2
  74.         self.contents.blt(x+x_plus, 36, bitmap, src_rect)
  75.       when 1
  76.         bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  77.         y_plus = bitmap.height/4
  78.         x_plus = bitmap.width/4
  79.         x_plus2 = ((self.width-32)/ACT_SEL.size - x_plus)/2
  80.         draw_actor_graphic(actor, x+x_plus/2+x_plus2, y_plus+36)
  81.       when 2
  82.         bitmap = RPG::Cache.picture(actor.name)
  83.         src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  84.         x_plus = bitmap.width
  85.         x_plus = ((self.width-32)/ACT_SEL.size - x_plus)/2
  86.         self.contents.blt(x+x_plus, 36, bitmap, src_rect)
  87.       end
  88.     end
  89.   end
  90.   def update_cursor_rect
  91.     if @index < 0
  92.       self.cursor_rect.empty
  93.     else
  94.       self.cursor_rect.set( @index * (self.width-32)/ACT_SEL.size,0, (self.width-32)/ACT_SEL.size, self.height-32)
  95.     end
  96.   end
  97. end
  98. class Window_Help_New < Window_Help
  99.   def initialize
  100.     super
  101.     self.contents = Bitmap.new(width, height)
  102.     self.width = WIDTH
  103.     self.contents = Bitmap.new(width - 32, height - 32)
  104.   end
  105. end
  106. class Scene_SelectActor
  107.   def main
  108.     @window = Window_SelectActor.new
  109.     @help_window = Window_Help_New.new
  110.     @help_window.visible = DES_SWI
  111.     @help_window.x = @window.x
  112.     @help_window.y = @window.y + @window.height
  113.     @help_window.width = @window.width
  114.     @help_window.back_opacity = @window.back_opacity = PDE_SWI ? PDE_BOP : BACK_OPACITY
  115.     @help_window.opacity = @window.opacity = PDE_SWI ? PDE_OPA : OPACITY
  116.     @help_window.back_opacity = @window.back_opacity = BGP_BOP if BGP_SWI
  117.     @help_window.opacity = @window.opacity = BGP_OPA if BGP_SWI
  118.     if BGP_SWI
  119.       @sprite = Sprite.new
  120.       @sprite.bitmap = RPG::Cache.picture(BGP_PIC)
  121.       a=$game_variables[1]
  122.     elsif PDE_SWI
  123.       @sprite = Sprite.new
  124.       @sprite.bitmap = RPG::Cache.picture(PIC_DES[1])
  125.     else
  126.       @sprite = Spriteset_Map.new
  127.     end
  128.     # 执行过度4
  129.     Graphics.transition
  130.     # 主循环
  131.     loop do
  132.       # 刷新游戏画面
  133.       Graphics.update
  134.       # 刷新输入信息
  135.       Input.update
  136.       # 刷新画面
  137.       update
  138.       # 如果画面切换就中断循环
  139.       if $scene != self
  140.         break
  141.       end
  142.     end
  143.     # 装备过渡
  144.     Graphics.freeze
  145.     @window.dispose
  146.     @help_window.dispose
  147.     @sprite.dispose
  148.   end
  149.   def update
  150.     @window.update
  151.     @sprite.update
  152.     if DES_SWI
  153.       @help_window_update
  154.       actor_id = ACT_SEL[@window.index]
  155.       text = ACT_DES[actor_id]
  156.       @help_window.set_text(text,1) if text != nil
  157.     end
  158.     if !BGP_SWI and PDE_SWI
  159.       pic = PIC_DES[ACT_SEL[@window.index]]
  160.       @sprite.bitmap = RPG::Cache.picture(pic) if pic != nil
  161.     end
  162.     if Input.trigger?(Input::C)
  163.       $game_system.se_play($data_system.decision_se)
  164.       for i in 0...$game_party.actors.size
  165.         id = $game_party.actors[i].id
  166.         actors_id = [] if actors_id == nil
  167.         actors_id.push(id)
  168.       end
  169.       actors_id.each do |i|
  170.         $game_party.remove_actor(i)
  171.       end
  172.       id = ACT_SEL[@window.index]
  173.       $game_party.add_actor(id)
  174.       $game_variables[VA_ID] = id
  175.       $scene = Scene_Map.new
  176.     end
  177.   end
  178. end
复制代码
如题
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-4-9 07:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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