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

Project1

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

[已经解决] 如何设置主角的初始物品?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
84
在线时间
130 小时
注册时间
2014-9-1
帖子
98
跳转到指定楼层
1
发表于 2015-7-31 22:35:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
大家安好,最近刚用RMXP,
1.请问如何设置主角的初始物品。
(比如:一进入游戏便有回复药之类的)
2.怎么做传送卷轴。
3.怎么做怪兽图鉴。
请各位大神帮忙援助。
谢谢(=゚ω゚)=
halo大家好,欢迎支持我的部落格
http://dedarknightstudio.blogspot.com

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

2
发表于 2015-7-31 22:53:49 | 只看该作者
首先,请勿一帖多问,三个无关的问题最好分别发帖询问。
如果对一些基本事件概念不清楚请参考置顶的入门教程。
1. 最简单的办法就是把在主角初期位置的地图上设置一个事件,事件开启条件为自动执行,内容为增减一系列物品,当然增添完物品之后必须打开独立开关,然后在第二页事件页上把事件出现的条件选择对应的独立开关,防止重复获得物品。
2. 在公共事件里添加场所移动的指令,然后将物品关联到这个公共事件上。
3. 你需要怪物图鉴脚本,请在论坛上搜索一下。

点评

谢谢啦,下次不会再一帖多问了。  发表于 2015-7-31 23:06
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
211
在线时间
845 小时
注册时间
2014-5-5
帖子
944
3
发表于 2015-8-1 12:39:55 | 只看该作者
第一个问题跳过
第二个用脚本简单点
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  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]=["测试点",26,[1,9,3],2]
  22. TOWNS[1]=["揽仙布店",27,[2,11,12],6]
  23. TOWNS[2]=["",0,[3,3,6],4]
  24. TOWNS[3]=["",0,[4,2,6],4]
  25. TOWNS[4]=["",0,[5,2,6],4]
  26. TOWNS[5]=["",0,[6,9,6],4]
  27. TOWNS[6]=["",0,[1,2,3],2]
  28. TOWNS[7]=["",0,[1,2,5],4]
  29. TOWNS[8]=["",0,[3,3,6],4]
  30. TOWNS[9]=["",0,[4,2,6],4]
  31. TOWNS[10]=["",0,[5,2,6],4]
  32. TOWNS[11]=["",0,[6,9,6],4]
  33. TOWNS[12]=["",0,[1,2,3],2]
  34. TOWNS[13]=["",0,[1,2,5],4]
  35. TOWNS[14]=["",0,[3,3,6],4]
  36. TOWNS[15]=["",0,[4,2,6],4]
  37. TOWNS[16]=["",0,[5,2,6],4]
  38. TOWNS[17]=["",0,[6,9,6],4]
  39. TOWNS[18]=["",0,[1,2,3],2]
  40. TOWNS[19]=["",0,[1,2,5],4]
  41. TOWNS[20]=["",0,[3,3,6],4]
  42. TOWNS[21]=["",0,[4,2,6],4]
  43. TOWNS[22]=["",0,[5,2,6],4]
  44. TOWNS[23]=["",0,[6,9,6],4]
  45. TOWNS[24]=["",0,[1,2,3],2]
  46. TOWNS[25]=["",0,[1,2,5],4]
  47. TOWNS[26]=["",0,[3,3,6],4]
  48. TOWNS[27]=["",0,[4,2,6],4]
  49. TOWNS[28]=["",0,[5,2,6],4]
  50. TOWNS[29]=["",0,[6,9,6],4]
  51. TOWNS[30]=["",0,[1,2,3],2]
  52. TOWNS[31]=["",0,[1,2,5],4]
  53. TOWNS[32]=["",0,[3,3,6],4]
  54. TOWNS[33]=["",0,[4,2,6],4]
  55. TOWNS[34]=["",0,[5,2,6],4]
  56. TOWNS[35]=["",0,[6,9,6],4]
  57. TOWNS[36]=["",0,[1,2,3],2]
  58. TOWNS[37]=["",0,[1,2,5],4]
  59. TOWNS[38]=["",0,[3,3,6],4]
  60. TOWNS[39]=["",0,[4,2,6],4]
  61. TOWNS[40]=["",0,[5,2,6],4]
  62. TOWNS[41]=["",0,[6,9,6],4]
  63. TOWNS[42]=["",0,[1,2,3],2]
  64. TOWNS[43]=["",0,[1,2,5],4]
  65. TOWNS[44]=["",0,[3,3,6],4]
  66. TOWNS[45]=["",0,[4,2,6],4]
  67. TOWNS[46]=["",0,[5,2,6],4]
  68. TOWNS[47]=["",0,[6,9,6],4]
  69. #==============================================================================
  70. # ■ Window_Teleport
  71. #------------------------------------------------------------------------------
  72. #  处理传送的窗口
  73. #==============================================================================
  74. class Window_Teleport < Window_Selectable
  75.   #--------------------------------------------------------------------------
  76.   # ● 初始化对像
  77.   #--------------------------------------------------------------------------
  78.   def initialize
  79.     super(640,640,64,64)
  80.     self.contents = Bitmap.new(width, height)
  81.     self.opacity = 180
  82.     get_towns
  83.     draw_towns
  84.     @column_max = 1
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 获取可到达的城镇和窗口大小
  88.   #--------------------------------------------------------------------------
  89.   def get_towns
  90.     @carol3_towns = []
  91.     @width_temp = 0
  92.     @cont_use = false
  93.     for town in TOWNS
  94.       if $game_switches[town[1]]==true
  95.         @carol3_towns.push(town)
  96.         if contents.text_size(town[0]).width >= @width_temp
  97.           @width_temp = contents.text_size(town[0]).width
  98.         end
  99.       end
  100.     end
  101.     @item_max = @carol3_towns.size
  102.     if @item_max == 0
  103.       @carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
  104.       @width_temp = contents.text_size(@carol3_towns[0][0]).width
  105.       @item_max = 1
  106.       @cont_use = true
  107.     end
  108.     self.width = [@width_temp+32,480].min
  109.     self.height = [(@item_max+1)*32,360].min
  110.     self.x = (640-self.width)/2
  111.     self.y = (480-self.height)/2
  112.     self.contents = Bitmap.new(width-32,row_max*32)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 描绘城镇名称
  116.   #--------------------------------------------------------------------------
  117.   def draw_towns
  118.     for i in 0...@carol3_towns.size
  119.       self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 返回的内容
  124.   #========================================================================
  125.   # ● 地图编号
  126.   #--------------------------------------------------------------------------
  127.   def map_id
  128.     return @carol3_towns[self.index][2][0]
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 地图x坐标
  132.   #--------------------------------------------------------------------------
  133.   def map_x
  134.     return @carol3_towns[self.index][2][1]
  135.   end      
  136.   #--------------------------------------------------------------------------
  137.   # ● 地图y坐标
  138.   #--------------------------------------------------------------------------
  139.   def map_y
  140.     return @carol3_towns[self.index][2][2]
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 角色朝向
  144.   #--------------------------------------------------------------------------
  145.   def map_direction
  146.     return @carol3_towns[self.index][2][3]
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 判断是否一个城市都没有
  150.   #--------------------------------------------------------------------------
  151.   def cant_use?
  152.     return @cont_use
  153.   end
  154. end
  155. #==============================================================================
  156. # ■ Scene_Teleport
  157. #------------------------------------------------------------------------------
  158. #  处理传送执行的类
  159. #==============================================================================
  160. class Scene_Teleport
  161.   #--------------------------------------------------------------------------
  162.   # ● 主处理
  163.   #--------------------------------------------------------------------------
  164.   def main
  165.     $game_system.se_play($data_system.decision_se)
  166.     @carol3_trans_white = false
  167.     @carol3_map_sprite = Spriteset_Map.new
  168.     @carol3_teleport_window = Window_Teleport.new
  169.     if @carol3_teleport_window.cant_use?
  170.       @carol3_teleport_window.index = -1
  171.     else
  172.       @carol3_teleport_window.index = 0
  173.     end
  174.     @carol3_teleport_window.active = true
  175.     Graphics.transition
  176.     loop do
  177.       Graphics.update
  178.       Input.update
  179.       carol3_update
  180.       if $scene != self
  181.         break
  182.       end
  183.     end   
  184.     if @carol3_trans_white==true
  185.       @carol3_white_sprite = Sprite.new
  186.       @carol3_white_sprite.bitmap = Bitmap.new(640,480)
  187.       @carol3_white_sprite.opacity = 0
  188.       @carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
  189.       for i in 0..20
  190.         @carol3_white_sprite.opacity += 15
  191.         @carol3_teleport_window.opacity -= 12
  192.         @carol3_teleport_window.contents_opacity -= 12
  193.         Graphics.update
  194.       end
  195.       Graphics.freeze
  196.       Graphics.transition(0)
  197.       Graphics.update
  198.       @carol3_map_sprite.dispose
  199.       $game_map.setup($game_temp.player_new_map_id)
  200.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  201.       $game_player.turn_down
  202.       $game_player.straighten
  203.       $game_map.autoplay      
  204.       Graphics.frame_reset
  205.       for i in 0..20
  206.         @carol3_white_sprite.opacity -= 15
  207.         Graphics.update
  208.       end
  209.       @carol3_white_sprite.dispose
  210.       @carol3_teleport_window.dispose
  211.       Graphics.freeze
  212.     else
  213.       Graphics.freeze
  214.       @carol3_teleport_window.dispose
  215.       @carol3_map_sprite.dispose
  216.     end   
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 刷新画面
  220.   #--------------------------------------------------------------------------
  221.   def carol3_update
  222.     @carol3_teleport_window.update
  223.     if Input.trigger?(Input::B)
  224.       $game_system.se_play($data_system.cancel_se)
  225.       $scene = Scene_Map.new
  226.       return
  227.     end
  228.     if Input.trigger?(Input::C)
  229.       if @carol3_teleport_window.index == -1
  230.         $game_system.se_play($data_system.cancel_se)
  231.         $scene = Scene_Map.new
  232.         return
  233.       else        
  234.         $game_temp.player_new_map_id = @carol3_teleport_window.map_id
  235.         $game_temp.player_new_x = @carol3_teleport_window.map_x
  236.         $game_temp.player_new_y = @carol3_teleport_window.map_y
  237.         $game_temp.player_new_direction = @carol3_teleport_window.map_direction
  238.         $game_temp.player_transferring = true
  239.         $game_temp.transition_processing = true
  240.         $game_temp.transition_name = ""
  241.         $scene = Scene_Map.new
  242.         @carol3_trans_white = true
  243.         Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
  244.         return
  245.       end
  246.     end   
  247.   end
  248. end

  249. #==============================================================================
  250. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  251. #==============================================================================

复制代码
第三个问题
  1. #==============================================================================
  2. # ■ RPG追加定义,使用@符号分类
  3. #==============================================================================
  4. module RPG
  5.   class Enemy
  6.     def name
  7.       name = @name.split(/@/)[0]
  8.       return name != nil ? name : ''
  9.     end
  10.     def local
  11.       local = @name.split(/@/)[1]
  12.       return local != nil ? local : "未知"
  13.     end
  14.   end
  15.   
  16. end
  17. #==============================================================================
  18. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  19. #==============================================================================
复制代码
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================  
  4. #——————————————————————————————————————
  5. #魔物图鉴
  6. #
  7. #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。)
  8. #
  9. #Window_MonsterBook_Info 的 DROP_ITEM_NEED_ANALYZE 为 true  
  10. #则会显示敌人携带的物品,通常为false
  11. #图鉴完成度的表示功能追加
  12. #SHOW_COMPLETE_TYPE 的数值可以设定
  13. #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
  14. #使用方法:$scene = Scene_MonsterBook.new
  15. #特殊敌人ID指定:对于不想加入怪物图鉴的,首先设置一种属性名为“不加入图鉴”
  16. #然后让这个敌人对此属性为A即可。
  17. #——————————————————————————————————————
  18. module Enemy_Book_Config
  19.   DROP_ITEM_NEED_ANALYZE = false #显示物品
  20.   EVA_NAME = "回避"              #回避修正的名称(因为数据库中没有定义)
  21.   SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  22. end
  23. class Data_MonsterBook
  24.   #--------------------------------------------------------------------------
  25.   # ● 图鉴用ID設定
  26.   #--------------------------------------------------------------------------
  27.   def enemy_book_id_set
  28.     data = [0]
  29.     data[1] = 2
  30.     data[2] = 1
  31.     data[3] = 15
  32.     data[4] = 25
  33.     data[5] = 18
  34.     data[6] = 30
  35.     return data
  36.   end
  37. end
  38. class Game_Temp
  39.   attr_accessor :enemy_book_data
  40.   alias temp_enemy_book_data_initialize initialize
  41.   def initialize
  42.     temp_enemy_book_data_initialize
  43.     @enemy_book_data = Data_MonsterBook.new
  44.   end
  45. end
  46. class Game_Party
  47.   attr_accessor :enemy_info               # 出会った敵情報(図鑑用)
  48.   #--------------------------------------------------------------------------
  49.   # ● オブジェクト初期化
  50.   #--------------------------------------------------------------------------
  51.   alias book_info_initialize initialize
  52.   def initialize
  53.     book_info_initialize
  54.     @enemy_info = {}
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● エネミー情報の追加(図鑑用)
  58.   #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  59.   #     0:無遭遇 1:遭遇済 2:アナライズ済
  60.   #--------------------------------------------------------------------------
  61.   def add_enemy_info(enemy_id, type = 0)
  62.     case type
  63.     when 0
  64.       if @enemy_info[enemy_id] == 2
  65.         return false
  66.       end
  67.       @enemy_info[enemy_id] = 1
  68.     when 1
  69.       @enemy_info[enemy_id] = 2
  70.     when -1
  71.       @enemy_info[enemy_id] = 0
  72.     end
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 魔物図鑑の最大登録数を取得
  76.   #--------------------------------------------------------------------------
  77.   def enemy_book_max
  78.     return $game_temp.enemy_book_data.id_data.size - 1
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 魔物図鑑の現在登録数を取得
  82.   #--------------------------------------------------------------------------
  83.   def enemy_book_now
  84.     now_enemy_info = @enemy_info.keys
  85.     # 登録無視の属性IDを取得
  86.     no_add = $game_temp.enemy_book_data.no_add_element
  87.     new_enemy_info = []
  88.     for i in now_enemy_info
  89.       enemy = $data_enemies[i]
  90.       next if enemy.name == ""
  91.       if enemy.element_ranks[no_add] == 1
  92.         next
  93.       end
  94.       new_enemy_info.push(enemy.id)
  95.     end
  96.     return new_enemy_info.size
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 魔物図鑑の完成率を取得
  100.   #--------------------------------------------------------------------------
  101.   def enemy_book_complete_percentage
  102.     e_max = enemy_book_max.to_f
  103.     e_now = enemy_book_now.to_f
  104.     comp = e_now / e_max * 100
  105.     return comp.truncate
  106.   end
  107. end
  108. class Interpreter
  109.   def enemy_book_max
  110.     return $game_party.enemy_book_max
  111.   end
  112.   def enemy_book_now
  113.     return $game_party.enemy_book_now
  114.   end
  115.   def enemy_book_comp
  116.     return $game_party.enemy_book_complete_percentage
  117.   end
  118. end
  119. class Scene_Battle
  120.   alias add_enemy_info_start_phase5 start_phase5
  121.   def start_phase5
  122.     for enemy in $game_troop.enemies
  123.       # エネミーが隠れ状態でない場合
  124.       unless enemy.hidden
  125.         # 敵遭遇情報追加
  126.         $game_party.add_enemy_info(enemy.id, 0)
  127.       end
  128.     end
  129.     add_enemy_info_start_phase5
  130.   end
  131. end
  132. class Window_Base < Window
  133.   #--------------------------------------------------------------------------
  134.   # ● エネミーの戦闘後獲得アイテムの描画
  135.   #--------------------------------------------------------------------------
  136.   def draw_enemy_drop_item(enemy, x, y)
  137.     self.contents.font.color = normal_color
  138.     treasures = []
  139.     if enemy.item_id > 0
  140.       treasures.push($data_items[enemy.item_id])
  141.     end
  142.     if enemy.weapon_id > 0
  143.       treasures.push($data_weapons[enemy.weapon_id])
  144.     end
  145.     if enemy.armor_id > 0
  146.       treasures.push($data_armors[enemy.armor_id])
  147.     end
  148.     # 現状ではとりあえず1つのみ描画
  149.     if treasures.size > 0
  150.       item = treasures[0]
  151.       bitmap = RPG::Cache.icon(item.icon_name)
  152.       opacity = 255
  153.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  154.       name = treasures[0].name
  155.     else
  156.       self.contents.font.color = disabled_color
  157.       name = "无"
  158.     end
  159.     self.contents.draw_text(x+28, y, 212, 32, name)
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● エネミーの図鑑IDの描画
  163.   #--------------------------------------------------------------------------
  164.   def draw_enemy_book_id(enemy, x, y)
  165.     self.contents.font.color = normal_color
  166.     id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  167.     self.contents.draw_text(x, y, 32, 32, id.to_s)
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● エネミーの名前の描画
  171.   #     enemy : エネミー
  172.   #     x     : 描画先 X 座標
  173.   #     y     : 描画先 Y 座標
  174.   #--------------------------------------------------------------------------
  175.   def draw_enemy_name(enemy, x, y)
  176.     self.contents.font.color = normal_color
  177.     self.contents.draw_text(x, y, 152, 32, enemy.name)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● エネミーグラフィックの描画(アナライズ)
  181.   #     enemy : エネミー
  182.   #     x     : 描画先 X 座標
  183.   #     y     : 描画先 Y 座標
  184.   #--------------------------------------------------------------------------
  185.   def draw_enemy_graphic(enemy, x, y, opacity = 255)
  186.     bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  187.     cw = bitmap.width
  188.     ch = bitmap.height
  189.     src_rect = Rect.new(0, 0, cw, ch)
  190.     x = x + (cw / 2 - x) if cw / 2 > x
  191.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● エネミーの獲得EXPの描画
  195.   #     enemy : エネミー
  196.   #     x     : 描画先 X 座標
  197.   #     y     : 描画先 Y 座標
  198.   #--------------------------------------------------------------------------
  199.   def draw_enemy_exp(enemy, x, y)
  200.     self.contents.font.color = system_color
  201.     self.contents.draw_text(x, y, 120, 32, "EXP")
  202.     self.contents.font.color = normal_color
  203.     self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● エネミーの獲得GOLDの描画
  207.   #     enemy : エネミー
  208.   #     x     : 描画先 X 座標
  209.   #     y     : 描画先 Y 座標
  210.   #--------------------------------------------------------------------------
  211.   def draw_enemy_gold(enemy, x, y)
  212.     self.contents.font.color = system_color
  213.     self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)
  214.     self.contents.font.color = normal_color
  215.     self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  216.   end
  217. end
  218. class Game_Enemy_Book < Game_Enemy
  219.   #--------------------------------------------------------------------------
  220.   # ● オブジェクト初期化
  221.   #--------------------------------------------------------------------------
  222.   def initialize(enemy_id)
  223.    super(2,1)
  224.     @enemy_id = enemy_id
  225.     enemy = $data_enemies[@enemy_id]
  226.     @battler_name = enemy.battler_name
  227.     @battler_hue = enemy.battler_hue
  228.     @hp = maxhp
  229.     @sp = maxsp
  230.   end
  231. end
  232. class Data_MonsterBook
  233.   attr_reader :id_data
  234.   #--------------------------------------------------------------------------
  235.   # ● オブジェクト初期化
  236.   #--------------------------------------------------------------------------
  237.   def initialize
  238.     @id_data = enemy_book_id_set
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 図鑑用登録無視属性取得
  242.   #--------------------------------------------------------------------------
  243.   def no_add_element
  244.     no_add = 0
  245.     # 登録無視の属性IDを取得
  246.     for i in 1...$data_system.elements.size
  247.       if $data_system.elements[i] =~ /不加入图鉴/
  248.         no_add = i
  249.         break
  250.       end
  251.     end
  252.     return no_add
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 図鑑用敵ID設定
  256.   #--------------------------------------------------------------------------
  257.   def enemy_book_id_set
  258.     data = [0]
  259.     no_add = no_add_element
  260.     # 登録無視の属性IDを取得
  261.     for i in 1...$data_enemies.size
  262.       enemy = $data_enemies[i]
  263.       next if enemy.name == ""
  264.       if enemy.element_ranks[no_add] == 1
  265.         next
  266.       end
  267.       data.push(enemy.id)
  268.     end
  269.     return data
  270.   end
  271. end

  272. #==============================================================================
  273. # ■ Window_Enemylocal 显示敌人分类的窗口
  274. #==============================================================================
  275. class Window_Enemylocal < Window_Selectable
  276.   attr_accessor :commands
  277.   #--------------------------------------------------------------------------
  278.   # ● 初始化,生成commands窗口
  279.   #--------------------------------------------------------------------------
  280.   def initialize
  281.     super(0, 64, 160, 416)
  282.          self.opacity = 255

  283.    # self.z=999###标记
  284.     @commands = []
  285.     #————————生成commands窗口
  286.     for i in 1...$data_enemies.size
  287.       if $game_party.enemy_info[i] != 0 and $game_party.enemy_info[i] != nil  
  288.         push = true
  289.         for com in @commands
  290.           if com == $data_enemies[i].local
  291.             push = false
  292.           end
  293.         end
  294.         if push == true
  295.           @commands.push($data_enemies[i].local)
  296.         end
  297.       end
  298.     end
  299.    
  300.     if @commands == []
  301.       @commands.push("未知区域")
  302.     end      
  303.     @item_max = @commands.size
  304.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  305.     refresh
  306.     self.index = 0
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   #--------------------------------------------------------------------------
  310.   def refresh
  311.     self.contents.clear
  312.     for i in 0...@item_max
  313.       draw_item(i, normal_color)
  314.     end
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   #--------------------------------------------------------------------------
  318.   def draw_item(index, color)
  319.     self.contents.font.color = color
  320.     y = index * 32
  321.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # 只描绘原文字
  325.   #--------------------------------------------------------------------------
  326.   #def update_help
  327.    # @help_window.set_text(@commands[self.index])
  328.   #end
  329. end



  330. class Window_MonsterBook < Window_Selectable
  331.   attr_reader   :data
  332.   #--------------------------------------------------------------------------
  333.   # ● オブジェクト初期化
  334.   #--------------------------------------------------------------------------
  335.   def initialize(index=0)
  336.     super(160, 64, 480, 416)
  337.     @column_max = 1
  338.     @book_data = $game_temp.enemy_book_data
  339.     @data = @book_data.id_data.dup
  340.     @data.shift  
  341.     @item_max = @data.size
  342.     self.index = 0
  343.     refresh if @item_max > 0
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 遭遇データを取得
  347.   #--------------------------------------------------------------------------
  348.   def data_set
  349.     data = $game_party.enemy_info.keys
  350.     data.sort!
  351.     newdata = []
  352.     for i in data
  353.       next if $game_party.enemy_info[i] == 0
  354.       # 図鑑登録無視を考慮
  355.       if book_id(i) != nil
  356.         newdata.push(i)
  357.       end
  358.     end
  359.     return newdata
  360.   end
  361.   
  362.   
  363.   #--------------------------------------------------------------------------
  364.   # ● 表示許可取得
  365.   #--------------------------------------------------------------------------
  366.   def show?(id)
  367.     if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  368.       return false
  369.     else
  370.       return true
  371.     end
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 図鑑用ID取得
  375.   #--------------------------------------------------------------------------
  376.   def book_id(id)
  377.     return @book_data.index(id)
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● エネミー取得
  381.   #--------------------------------------------------------------------------
  382.   def item
  383.     return @data1[self.index].id
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● リフレッシュ
  387.   #--------------------------------------------------------------------------
  388.   def refresh
  389.    if self.contents != nil
  390.       self.contents.dispose
  391.       self.contents = nil
  392.     end
  393.     @data1 = []
  394.   end
  395.   
  396.   ###########3
  397.   def set_item(command)
  398.     refresh
  399.     #enemy = $data_enemies[@data[index]]
  400.     #return if enemy == nil
  401.     for i in 1...$data_enemies.size
  402.       if  $data_enemies[i].local == command
  403.         enemy = $data_enemies[i]
  404.         @data1.push( $data_enemies[i])
  405.       end
  406.     end
  407.    
  408.      @item_max = @data1.size
  409.     if @item_max > 0
  410.       self.contents = Bitmap.new(width - 0, row_max * 32)
  411.       self.contents.clear
  412.       for i in 0...$data_enemies.size
  413.         draw_item(i)
  414.       end
  415.     end
  416.   end
  417.   #############
  418.   #--------------------------------------------------------------------------
  419.   # ● 項目の描画
  420.   #     index : 項目番号
  421.   #--------------------------------------------------------------------------
  422.   def draw_item(index)
  423.     enemy = $data_enemies[@data1[index].id]
  424.     return if enemy == nil
  425.     x = 4 + index % 1 * (200 + 32)
  426.     y = index / 1 * 32
  427.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  428.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  429.     self.contents.font.color = normal_color
  430.     draw_enemy_book_id(enemy, x, y)
  431.     if show?(enemy.id)
  432.       self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  433.     else
  434.       self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  435.       return
  436.     end
  437.     if analyze?(@data[index])
  438.       self.contents.font.color = text_color(3)
  439.       self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  440.     end
  441.   end
  442.   


  443.   
  444.   #--------------------------------------------------------------------------
  445.   # ● アナライズ済かどうか
  446.   #--------------------------------------------------------------------------
  447.   def analyze?(enemy_id)
  448.     if $game_party.enemy_info[enemy_id] == 2
  449.       return true
  450.     else
  451.       return false
  452.     end
  453.   end
  454. end

  455. class Window_MonsterBook_Info < Window_Base
  456.   include Enemy_Book_Config
  457.   #--------------------------------------------------------------------------
  458.   # ● オブジェクト初期化
  459.   #--------------------------------------------------------------------------
  460.   def initialize
  461.     super(0, 0+64, 640, 480-64)
  462.     self.contents = Bitmap.new(width - 32, height - 32)
  463.     self.z = 999
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● リフレッシュ
  467.   #--------------------------------------------------------------------------
  468.   def refresh(enemy_id)
  469.     self.contents.clear
  470.     self.contents.font.size = 22
  471.     enemy = Game_Enemy_Book.new(enemy_id)
  472.     draw_enemy_graphic(enemy, 96, 240+48+64, 200)
  473.     draw_enemy_book_id(enemy, 4, 0)
  474.     draw_enemy_name(enemy, 48, 0)
  475.     draw_actor_hp(enemy, 288, 0)
  476.     draw_actor_sp(enemy, 288+160, 0)
  477.     draw_actor_parameter(enemy, 288    ,  32, 0)
  478.     self.contents.font.color = system_color
  479.     self.contents.draw_text(288+160, 32, 120, 32, EVA_NAME)
  480.     self.contents.font.color = normal_color
  481.     self.contents.draw_text(288+160 + 120, 32, 36, 32, enemy.eva.to_s, 2)
  482.     draw_actor_parameter(enemy, 288    ,  64, 3)
  483.     draw_actor_parameter(enemy, 288+160,  64, 4)
  484.     draw_actor_parameter(enemy, 288    ,  96, 5)
  485.     draw_actor_parameter(enemy, 288+160,  96, 6)
  486.     draw_actor_parameter(enemy, 288    , 128, 1)
  487.     draw_actor_parameter(enemy, 288+160, 128, 2)
  488.     draw_enemy_exp(enemy, 288, 160)
  489.     draw_enemy_gold(enemy, 288+160, 160)
  490.     if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
  491.       self.contents.draw_text(288, 192, 96, 32, "掉落物品:")
  492.       draw_enemy_drop_item(enemy, 288+96+4, 192)
  493.       self.contents.font.color = normal_color
  494.       #draw_element_guard(enemy, 320-32, 160-16+96)
  495.     end
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ● アナライズ済かどうか
  499.   #--------------------------------------------------------------------------
  500.   def analyze?(enemy_id)
  501.     if $game_party.enemy_info[enemy_id] == 2
  502.       return true
  503.     else
  504.       return false
  505.     end
  506.   end
  507. end

  508. class Scene_MonsterBook
  509.   include Enemy_Book_Config
  510.   #--------------------------------------------------------------------------
  511.   # ● メイン処理
  512.   #--------------------------------------------------------------------------
  513.   def main
  514.     $game_temp.enemy_book_data = Data_MonsterBook.new
  515.     # ウィンドウを作成
  516.    
  517.     @title_window = Window_Base.new(0, 0, 640, 64)
  518.     @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  519.     @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
  520.    
  521.     if SHOW_COMPLETE_TYPE != 0
  522.       case SHOW_COMPLETE_TYPE
  523.       when 1
  524.         e_now = $game_party.enemy_book_now
  525.         e_max = $game_party.enemy_book_max
  526.         text = e_now.to_s + "/" + e_max.to_s
  527.       when 2
  528.         comp = $game_party.enemy_book_complete_percentage
  529.         text = comp.to_s + "%"
  530.       when 3
  531.         e_now = $game_party.enemy_book_now
  532.         e_max = $game_party.enemy_book_max
  533.         comp = $game_party.enemy_book_complete_percentage
  534.         text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  535.       end
  536.       if text != nil
  537.         @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  538.       end
  539.     end
  540.     @itemcommand_window = Window_Enemylocal.new
  541.     @command_index = @itemcommand_window.index
  542.     @main_window = Window_MonsterBook.new
  543.     @itemcommand_window.active = true
  544.     @main_window.active = false
  545.     # インフォウィンドウを作成 (不可視?非アクティブに設定)
  546.     @info_window = Window_MonsterBook_Info.new
  547.     @info_window.z = 110
  548.     @info_window.visible = false
  549.     @info_window.active = false
  550.     @visible_index = 0
  551.     @main_window.set_item(@itemcommand_window.commands[@command_index])
  552.     # トランジション実行
  553.     Graphics.transition
  554.     # メインループ
  555.     loop do
  556.       # ゲーム画面を更新
  557.       Graphics.update
  558.       # 入力情報を更新
  559.       Input.update
  560.       # フレーム更新
  561.       update
  562.       # 画面が切り替わったらループを中断
  563.       if $scene != self
  564.         break
  565.       end
  566.     end
  567.     # トランジション準備
  568.     Graphics.freeze
  569.     # ウィンドウを解放
  570.     @itemcommand_window.dispose
  571.     @main_window.dispose
  572.     @info_window.dispose
  573.     @title_window.dispose
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● フレーム更新
  577.   #--------------------------------------------------------------------------
  578.   def update
  579.     # ウィンドウを更新
  580.     @itemcommand_window.update
  581.     @main_window.update
  582.     @info_window.update
  583.     if @command_index != @itemcommand_window.index
  584.       @command_index = @itemcommand_window.index
  585.       @main_window.set_item(@itemcommand_window.commands[@command_index])
  586.     end
  587.     if @itemcommand_window.active
  588.       update_itemcommand
  589.       return
  590.     end
  591.    # if @main_window.active
  592.     #  update_main
  593.      # return
  594.     #end
  595.     if @info_window.active
  596.       update_info
  597.       return
  598.     end
  599.     # メインウィンドウがアクティブの場合: update_target を呼ぶ
  600.     if @main_window.active
  601.       update_main
  602.       return
  603.     end
  604.   end
  605.   #--------------------------------------------------------------------------
  606.   # ● フレーム更新 (メインウィンドウがアクティブの場合)
  607.   #--------------------------------------------------------------------------
  608.   def update_main
  609.     # B ボタンが押された場合
  610.     if Input.trigger?(Input::B)
  611.       # キャンセル SE を演奏
  612.       $game_system.se_play($data_system.cancel_se)
  613.       @main_window.active = false
  614.       @itemcommand_window.active = true
  615.       return
  616.     end
  617.     # C ボタンが押された場合
  618.     if Input.trigger?(Input::C)
  619.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  620.         # ブザー SE を演奏
  621.         $game_system.se_play($data_system.buzzer_se)
  622.         return
  623.       end
  624.       # 決定 SE を演奏
  625.       $game_system.se_play($data_system.decision_se)
  626.       @main_window.active = false
  627.       @info_window.active = true
  628.       @info_window.visible = true
  629.       @visible_index = @main_window.index
  630.       @info_window.refresh(@main_window.item)
  631.       return
  632.     end
  633.   end
  634.   #######################
  635.     def update_itemcommand
  636.     if Input.trigger?(Input::B)
  637.       $game_system.se_play($data_system.cancel_se)
  638.       #$game_temp.in_item = false#initem
  639.       $scene = Scene_Map.new
  640.       return
  641.     end
  642.     if Input.trigger?(Input::C)
  643.       #$game_temp.in_item = true#initem
  644.       #if @itemlist_window.item_number == 0
  645.        # $game_system.se_play($data_system.buzzer_se)
  646.         #return
  647.       #end
  648.       $game_system.se_play($data_system.decision_se)
  649.       @itemcommand_window.active = false
  650.       @main_window.active = true
  651.       @main_window.index = 0
  652.       return
  653.     end
  654.   end
  655.   
  656.   #--------------------------------------------------------------------------
  657.   # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  658.   #--------------------------------------------------------------------------
  659.   def update_info
  660.     # B ボタンが押された場合
  661.     if Input.trigger?(Input::B)
  662.       # キャンセル SE を演奏
  663.       $game_system.se_play($data_system.cancel_se)
  664.       @main_window.active = true
  665.       @info_window.active = false
  666.       @info_window.visible = false
  667.       return
  668.     end
  669.     # C ボタンが押された場合
  670.     if Input.trigger?(Input::C)
  671.       # 決定 SE を演奏
  672.       #$game_system.se_play($data_system.decision_se)
  673.       return
  674.     end
  675.     if Input.trigger?(Input::L)
  676.       # 決定 SE を演奏
  677.       $game_system.se_play($data_system.decision_se)
  678.       loop_end = false
  679.       while loop_end == false
  680.         if @visible_index != 0
  681.           @visible_index -= 1
  682.         else
  683.           @visible_index = @main_window.data.size - 1
  684.         end
  685.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  686.       end
  687.       id = @main_window.data[@visible_index]
  688.       @info_window.refresh(id)
  689.       return
  690.     end
  691.     if Input.trigger?(Input::R)
  692.       # 決定 SE を演奏
  693.       $game_system.se_play($data_system.decision_se)
  694.       loop_end = false
  695.       while loop_end == false
  696.         if @visible_index != @main_window.data.size - 1
  697.           @visible_index += 1
  698.         else
  699.           @visible_index = 0
  700.         end
  701.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  702.       end
  703.       id = @main_window.data[@visible_index]
  704.       @info_window.refresh(id)
  705.       return
  706.     end
  707.   end
  708. end
  709. #==============================================================================
  710. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  711. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 07:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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