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

Project1

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

[已经过期] 宠物脚本~~!!

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
723 小时
注册时间
2014-3-29
帖子
509
跳转到指定楼层
1
发表于 2014-8-4 11:19:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 neverstop 于 2014-8-4 15:38 编辑

拿到了 tan12345 的宠物脚本,曾经还正常。。最近
     
                   发现给宠物进化的时候,点击进阶,就会出现脚本错误    (太悲了~都快结了)
   
                    

                   求助~




{:2_249:}
                 
                                                                                                                               {:2_272:}

                                                                                                                              

Lv5.捕梦者

梦石
0
星屑
30555
在线时间
606 小时
注册时间
2014-7-18
帖子
729

开拓者

2
发表于 2014-8-4 11:30:47 | 只看该作者
在哪一个帖子里找到的脚本?要么把网址写出来,要么把脚本全部写出来。不然好像没办法解决!

点评

本人喳喳一枚,,@taroxd  发表于 2014-8-5 17:52
那有没办法将宠物进阶的内个指令窗口改一下,普通的选项鼠标是可以显示的。  发表于 2014-8-5 17:45
鼠标方便耶。而且个人比较喜欢鼠标  发表于 2014-8-5 17:43
那为什么要鼠标呢?,,个人感觉鼠标什么的没什么用,,  发表于 2014-8-5 12:50
好吧好吧。。这根本原因不是宠物脚本,而是鼠标的缘故,(用键盘移动到上面,正常显示,可是鼠标只是浮在内个按键上。。那要怎么办。哭)  发表于 2014-8-5 09:16
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
723 小时
注册时间
2014-3-29
帖子
509
3
 楼主| 发表于 2014-8-4 12:04:47 | 只看该作者
  1. module Advanced
  2.   
  3.   #为true则代表当等级满级并且持有i2号物品、武器、防具时可以进阶
  4.   #为false则代表只需要持有i2号物品、武器、防具时可以进阶
  5.   CONDITION = true
  6.   ADVANCED_OBJ   = /<advanced = (\d+) if (lv|i|w|a) = (\d+)>/i
  7.   
  8.   #获取进阶后的id,同时根据返回值的size来判定是否可以进阶
  9.   def self.get_advanced_id(actor)
  10.     ren = []
  11.     return ren if actor == nil
  12.     return ren if !actor.is_pet?
  13.     $data_actors[actor.id].note.scan(ADVANCED_OBJ){|id1,type,id2|
  14.       j = [];j.push(id1);j.push(type);j.push(id2);
  15.       ren.push(j)
  16.     }
  17.     return ren
  18.   end
  19. end
  20. #--------------------------------------------------------------------------
  21. # 主窗体
  22. #--------------------------------------------------------------------------
  23. class Scene_Advanced < Scene_MenuBase
  24.   def start
  25.     super
  26.     create_select_window
  27.     create_command_window
  28.   end
  29.   
  30.   def create_select_window
  31.     @select_window = Window_AdvancedSelect.new
  32.     @select_window.viewport = @viewport
  33.     @select_window.activate
  34.     @select_window.set_handler(:ok, method(:select_advanced_ok))
  35.     @select_window.set_handler(:cancel, method(:select_advanced_cancel))
  36.   end
  37.   
  38.   def create_command_window
  39.     @command_window = Window_AdvancedCommand.new
  40.     @command_window.viewport = @viewport
  41.     @command_window.deactivate
  42.     @command_window.set_handler(:ok, method(:advanced))
  43.     @command_window.set_handler(:cancel, method(:back_to_select))
  44.   end
  45.   
  46.   #选人窗口按确定
  47.   def select_advanced_ok
  48.     @command_window.advanced_actor = @select_window.select_actor
  49.     @select_window.deactivate
  50.     @command_window.refresh
  51.     @command_window.activate
  52.   end
  53.   #选人窗口按取消
  54.   def select_advanced_cancel
  55.     @command_window.advanced_actor = nil
  56.     SceneManager.return
  57.   end
  58.   #进阶窗口按确定
  59.   def advanced
  60.     @command_window.do_advanced
  61.     SceneManager.return
  62.   end
  63.   #进阶窗口按取消
  64.   def back_to_select
  65.     @command_window.del_test_advanced_actor if @command_window.test_advanced_actor
  66.     @command_window.clear
  67.     @command_window.deactivate
  68.     @select_window.refresh
  69.     @select_window.activate
  70.   end
  71. end




  72. #--------------------------------------------------------------------------
  73. # 选择窗口
  74. #--------------------------------------------------------------------------
  75. class Window_AdvancedSelect < Window_HorzCommand
  76.   def initialize
  77.     super(0,0)
  78.     @data = []
  79.     @last_index ||= 0
  80.     @animtime = 0
  81.     [url=home.php?mod=space&uid=348285]@walk[/url] = 0
  82.     refresh
  83.     select_last
  84.   end
  85.   
  86.   def window_width;Graphics.width;end
  87.   def window_height;115;end
  88.   def item_width;85;end
  89.   def item_height; 85; end
  90.   def spacing; return 1; end
  91.   def col_max; return 6; end
  92.   def item_max; @data ? @data.size : 1; end
  93.   def select_actor; @data && index >= 0 ? @data[index] : nil; end
  94.   
  95.   def current_item_enabled?
  96.     enable?(@data[index])
  97.   end
  98.   def enable?(actor)
  99.     return false if !actor
  100.     return true
  101.   end
  102.   
  103.   def include?(actor)
  104.     return false if actor.nil?
  105.     return true
  106.   end
  107.   
  108.   def make_item_list
  109.     @data = $game_party.members.select {|actor| include?(actor) }
  110.     @data.push(nil) if include?(nil)
  111.   end
  112.   
  113.   def select_last
  114.     select(@data.index($select_advanced) || 0)
  115.   end
  116.   
  117.   def actor_rect(index)
  118.     rect = Rect.new
  119.     rect.width = item_width
  120.     rect.height = item_height
  121.     rect.x = index * (item_width + spacing)
  122.     rect.y = 0
  123.     rect
  124.   end
  125.   
  126.   def draw_item(index)
  127.     actor = @data[index]
  128.     if actor
  129.       rect = actor_rect(index)
  130.       rect.width -= 4
  131.       draw_actor_text(actor,rect.x + 2,rect.y, enable?(actor),
  132.         rect.width)
  133.       draw_character(actor.character_name, actor.character_index,
  134.         rect.x + item_width / 1.6 - 1, rect.y + 38,
  135.         enable?(actor),index)
  136.     end
  137.   end
  138.   
  139.   def draw_actor_text(actor, x, y, enabled = true, w)
  140.     return unless actor
  141.     change_color(normal_color, enabled)
  142.     contents.font.size = 15
  143.     draw_text(x + 4, y, w, 15, Vocab::level_a + actor.level.to_s,0)
  144.     draw_text(x, y + 50, w, 15, actor.name,1)
  145.     draw_text(x, y + 65, w, 15, actor.class.name,1)
  146.   end
  147.   
  148.   def draw_character(character_name, character_index, x, y,enabled,i)
  149.     return unless character_name
  150.     bitmap = Cache.character(character_name)
  151.     sign = character_name[/^[\!\$]./]
  152.     if sign && sign.include?('这个是宠物进阶的脚本。。说实话,脚本好多啊

  153. )
  154.       cw = bitmap.width / 3
  155.       ch = bitmap.height / 4
  156.     else
  157.       cw = bitmap.width / 12
  158.       ch = bitmap.height / 8
  159.     end
  160.     n = character_index
  161.     step = 0
  162.     step = @walk if enabled && i == index
  163.     src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
  164.     contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 150)
  165.   end
  166.   
  167.   def refresh
  168.     make_item_list
  169.     create_contents
  170.     draw_all_items
  171.   end
  172.   
  173.   def update
  174.     super
  175.     update_walk
  176.     redraw_item(index)
  177.   end
  178.   
  179.   def update_walk
  180.     @animtime += 1
  181.     if @animtime == 10
  182.       case @walk
  183.       when 1; @walk -= 1
  184.       when -1; @walk += 1
  185.       when 0
  186.         if [url=home.php?mod=space&uid=2129346]@step[/url] == 1
  187.           @walk = -1; @step = 0
  188.         else
  189.           @walk = 1; @step = 1
  190.         end
  191.       end
  192.       @animtime = 0
  193.     end
  194.   end
  195.   
  196.   def cursor_down(wrap = false); super; cursor_move_extras; end
  197.   def cursor_up(wrap = false); super; cursor_move_extras; end
  198.   def cursor_left(wrap = false); super; cursor_move_extras; end
  199.   def cursor_right(wrap = false); super; cursor_move_extras; end
  200.    
  201.   def cursor_move_extras
  202.     @walk = 0
  203.     @animtime = 0
  204.     redraw_item(@last_index)
  205.     @last_index = index
  206.   end
  207.   
  208.   def process_ok
  209.     if current_item_enabled?
  210.       psound
  211.       Input.update
  212.       deactivate
  213.       call_ok_handler
  214.     else
  215.       Sound.play_buzzer
  216.     end
  217.   end
  218.   
  219.   def psound
  220.     if @psound.nil?
  221.       Sound.play_ok
  222.     else
  223.       name,vol,pitch = @psound
  224.       RPG::SE.new(name,vol,pitch).play
  225.       @psound = nil
  226.     end
  227.   end
  228. end




  229. #--------------------------------------------------------------------------
  230. # 命令窗口
  231. #--------------------------------------------------------------------------
  232. class Window_AdvancedCommand < Window_Command
  233.   attr_accessor :advanced_actor                  #进阶前的人物
  234.   attr_accessor :test_advanced_actor             #进阶后的人物
  235.   attr_accessor :advanced_item                   #进阶所需物品
  236.   def initialize
  237.     super(0,115)
  238.     @advanced_actor = nil
  239.     @test_advanced_actor = nil
  240.     @advanced_item = nil
  241.   end
  242.   
  243.   def window_width;Graphics.width;end
  244.   def window_height;Graphics.height - 115;end
  245.   def item_width;120;end
  246.   def row_max;return 4;end
  247.   
  248.   #--------------------------------------------------------------------------
  249.   # ● 刷新
  250.   #--------------------------------------------------------------------------
  251.   def refresh
  252.     clear
  253.     clear_command_list
  254.     make_command_list
  255.     create_contents
  256.     super
  257.     draw_advanced_actor_status if @advanced_actor
  258.   end
  259.   def cursor_down(wrap = false); super;refresh;end
  260.   def cursor_up(wrap = false); super;refresh;end
  261.   def cursor_left(wrap = false); super;refresh;end
  262.   def cursor_right(wrap = false); super;refresh;end
  263.   #--------------------------------------------------------------------------
  264.   # ● 生成指令列表
  265.   #--------------------------------------------------------------------------
  266.   def make_command_list
  267.     return if @advanced_actor == nil
  268.     add_command("取消",:cancel)
  269.     Advanced.get_advanced_id(@advanced_actor).each {|i|
  270.       text = "进阶成" + $data_actors[i[0].to_i].name
  271.       handle = ":id"+i[0].to_s+"type"+i[1].to_s+"item"+i[2].to_s
  272.       add_command(text,handle,check_enabled(i))
  273.     }
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 是否可以确定命令
  277.   #--------------------------------------------------------------------------
  278.   def check_enabled(condition)
  279.     return false if condition[0].to_i == 0
  280.     return false if condition[0].to_i == @advanced_actor.id
  281.     case condition[1]
  282.     when "lv"
  283.       return true if @advanced_actor.level >= condition[2].to_i
  284.     when "w"
  285.       if $game_party.weapons.include?($data_weapons[condition[2].to_i])
  286.         if Advanced::CONDITION
  287.           return true if @advanced_actor.level >= @advanced_actor.max_level
  288.         else
  289.           return true
  290.         end
  291.       end
  292.     when "a"
  293.       if $game_party.armors.include?($data_armors[condition[2].to_i])
  294.         if Advanced::CONDITION
  295.           return true if @advanced_actor.level >= @advanced_actor.max_level
  296.         else
  297.           return true
  298.         end
  299.       end
  300.     when "i"
  301.       if $game_party.items.include?($data_items[condition[2].to_i])
  302.         if Advanced::CONDITION
  303.           return true if @advanced_actor.level >= @advanced_actor.max_level
  304.         else
  305.           return true
  306.         end
  307.       end
  308.     end
  309.     return false
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● 绘制命令框
  313.   #--------------------------------------------------------------------------
  314.   def item_rect(index)
  315.     rect = Rect.new
  316.     rect.width = item_width
  317.     rect.height = item_height
  318.     rect.x = (window_width - item_width) / 2 - 22
  319.     rect.y = item_height * index + 35
  320.     return rect
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 绘制项目
  324.   #--------------------------------------------------------------------------
  325.   def draw_item(index)
  326.     change_color(normal_color, command_enabled?(index))
  327.     contents.font.size = 15
  328.     draw_text(item_rect_for_text(index), command_name(index), 1)
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● 清空
  332.   #--------------------------------------------------------------------------
  333.   def clear
  334.     contents.clear
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   #寻找空位
  338.   #--------------------------------------------------------------------------
  339.   def get_nil_actorid
  340.     for i in 1..$data_actors.size
  341.       return i if $data_actors[i] == nil
  342.     end
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   #模拟生成进阶后的人物
  346.   #--------------------------------------------------------------------------
  347.   def creat_test_advanced_actor
  348.     case current_symbol
  349.     when ":cancel"
  350.     when /:id(\d+)type(lv|i|w|a)item(\d+)/i
  351.       actor_id = $1.to_i
  352.       new_id = get_nil_actorid
  353.       $data_actors[new_id] = $data_actors[actor_id]
  354.       $game_actors[new_id].setup(new_id)
  355.       @test_advanced_actor = $game_actors[new_id]
  356.       @test_advanced_actor.set_pet_by(false)
  357.       @test_advanced_actor.set_pet_by(true) if @advanced_actor.is_pet_by?
  358.       @test_advanced_actor.nickname = ""
  359.       @test_advanced_actor.nickname = "变异" if @advanced_actor.is_pet_by?
  360.       @test_advanced_actor.set_pet_up_param(get_newpet_up_param(@advanced_actor)) if @test_advanced_actor.is_pet?
  361.       @advanced_actor.skills.each {|i| @test_advanced_actor.learn_skill(i.id)}
  362.       case $2.to_s
  363.       when "lv"
  364.         @advanced_item = $3.to_i
  365.       when "i"
  366.         @advanced_item = $data_items[$3.to_i]
  367.       when "w"
  368.         @advanced_item = $data_weapons[$3.to_i]
  369.       when "a"
  370.         @advanced_item = $data_armors[$3.to_i]
  371.       else
  372.       end
  373.     end
  374.   end
  375.   #计算进阶后的宠物的成长
  376.   def get_newpet_up_param(pet)
  377.     ren = [0] * 8
  378.     newpetid = @test_advanced_actor.get_pet_id
  379.     8.times {|i|
  380.       oldpi = pet.get_pet_oneup_param(i)
  381.       oldpa = Tan_pet_set::Tan_pet_base_param[pet.get_pet_id][i] + Tan_pet_set::Tan_pet_rand_param[pet.get_pet_id][i]
  382.       newpa = Tan_pet_set::Tan_pet_base_param[newpetid][i] + Tan_pet_set::Tan_pet_rand_param[newpetid][i]
  383.       ren[i] = format("%.2f",oldpi / oldpa * newpa).to_f
  384.     }
  385.     return ren
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   #删除模拟生成的人物
  389.   #--------------------------------------------------------------------------
  390.   def del_test_advanced_actor
  391.     $data_actors[@test_advanced_actor.id] = nil
  392.     @test_advanced_actor = nil
  393.     @advanced_item = nil
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   #绘制进阶人物信息
  397.   #--------------------------------------------------------------------------
  398.   def draw_advanced_actor_status
  399.     del_test_advanced_actor if @test_advanced_actor
  400.     draw_actor_number(@advanced_actor, 0, 0)
  401.     creat_test_advanced_actor
  402.     draw_actor_number(@test_advanced_actor, Graphics.width - 220, 0)
  403.     if @advanced_item.is_a?(Integer)
  404.       draw_text(190,0,140,15,"进阶条件:")
  405.       draw_text(190,18,140,15,"lv#{@advanced_item}以上")
  406.     elsif @advanced_item != nil
  407.       if Advanced::CONDITION
  408.         draw_text(190,0,140,15,"进阶条件:")
  409.         draw_text(190,18,140,15,"满级且拥有#{@advanced_item.name}")
  410.       else
  411.         draw_text(190,0,140,15,"进阶条件:")
  412.         draw_text(190,18,140,15,"拥有#{@advanced_item.name}")
  413.       end
  414.     else
  415.     end
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   #绘制信息
  419.   #--------------------------------------------------------------------------
  420.   def draw_actor_number(actor, x, y)
  421.     return if actor == nil
  422.     draw_actor_face(actor, x, y)
  423.     draw_actor_name(actor, x + 115, y)
  424.     draw_actor_class(actor, x + 115, y + 20)
  425.     draw_actor_nickname(actor, x + 115, y + 40)
  426.     draw_actor_level(actor, x + 115, y + 60)
  427.     contents.font.size = 18
  428.     8.times {|i|
  429.       change_color(system_color)
  430.       draw_text(x, y + 105 + 20 * i, 60, 18, Vocab::param(i))
  431.       change_color(normal_color)
  432.       draw_text(x + 25, y + 105 + 20 * i, 60, 18, actor.param(i), 2)
  433.       draw_text(x + 95, y + 105 + 20 * i, 60, 18, actor.get_pet_oneup_param(i), 2) if actor.is_pet?
  434.       draw_text(x + 155, y + 105 + 20 * i, 20,18,"↑") if actor.is_pet?
  435.     }
  436.     contents.font.size = 15
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   #确定进阶
  440.   #--------------------------------------------------------------------------
  441.   def do_advanced
  442.     $game_party.tan_remove_actor(@advanced_actor.id)
  443.     $game_party.tan_add_actor(@test_advanced_actor.id)
  444.     $game_party.gain_item(@advanced_item, -1) if !@advanced_item.is_a?(Integer) && @advanced_item != nil
  445.   end
  446. end
复制代码
这个是宠物进阶的脚本。。说实话,脚本好多啊

点评

有一个麻烦的,,你把你工程复制一个,然后一个一个的删你弄得插件脚本,看删到哪个没事了,,,,就,  发表于 2014-8-4 16:51
没说。  发表于 2014-8-4 15:26
那就是脚本冲突了吧,,你还用了什么脚本,这个宠物脚本有没有说和什么脚本有冲突?  发表于 2014-8-4 14:49
进化图。能找的都找了。。都有。  发表于 2014-8-4 14:42
进化图。去检查一下。内个464就是上面的脚本452行(我复制的时候吧几行注释删了)  发表于 2014-8-4 14:34
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 05:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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