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

Project1

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

[已经解决] 怎样禁止空手攻防?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
120
在线时间
92 小时
注册时间
2009-8-1
帖子
438
跳转到指定楼层
1
发表于 2010-8-29 15:57:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 tree52 于 2010-8-29 16:57 编辑

  怎样使人物装备身上的武器不能为空,也就是说不准将武器脱掉,手上必须持武器,但可以更换。因为空手攻防脚本不适合我的游戏。

Lv1.梦旅人

梦石
0
星屑
79
在线时间
211 小时
注册时间
2010-8-21
帖子
442
2
发表于 2010-8-29 16:08:48 | 只看该作者
虽然无法解决LZ的第一个问题,但是给你个好点的空手攻击力脚本,空手有攻击力,然后武器装备后有加成攻击力
把这个覆盖掉 Game_Battler 1这个即可
  1. # ————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————


  4. #==========================================================================
  5. # ■ Game_Battler (分割定义 1)
  6. #--------------------------------------------------------------------------
  7. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  8. # 超级类来使用。
  9. #==========================================================================

  10. class Game_Battler
  11.   #----------------------------------------------------------------------
  12.   # ● 定义实例变量
  13.   #----------------------------------------------------------------------
  14.   attr_reader   :battler_name             # 战斗者 文件名
  15.   attr_reader   :battler_hue              # 战斗者 色相
  16.   attr_reader   :hp                       # HP
  17.   attr_reader   :sp                       # SP
  18.   attr_reader   :states                   # 状态
  19.   attr_accessor :hidden                   # 隐藏标志
  20.   attr_accessor :immortal                 # 不死身标志
  21.   attr_accessor :damage_pop               # 显示伤害标志
  22.   attr_accessor :damage                   # 伤害值
  23.   attr_accessor :critical                 # 会心一击标志
  24.   attr_accessor :animation_id             # 动画 ID
  25.   attr_accessor :animation_hit            # 动画 击中标志
  26.   attr_accessor :white_flash              # 白色屏幕闪烁标志
  27.   attr_accessor :blink                    # 闪烁标志
  28.   #----------------------------------------------------------------------
  29.   # ● 初始化对像
  30.   #----------------------------------------------------------------------
  31.   def initialize
  32.     @battler_name = ""
  33.     @battler_hue = 0
  34.     @hp = 0
  35.     @sp = 0
  36.     @states = []
  37.     @states_turn = {}
  38.     @maxhp_plus = 0
  39.     @maxsp_plus = 0
  40.     @str_plus = 0
  41.     @dex_plus = 0
  42.     @agi_plus = 0
  43.     @int_plus = 0
  44.     @hidden = false
  45.     @immortal = false
  46.     @damage_pop = false
  47.     @damage = nil
  48.     @critical = false
  49.     @animation_id = 0
  50.     @animation_hit = false
  51.     @white_flash = false
  52.     @blink = false
  53.     @current_action = Game_BattleAction.new
  54.   end
  55.   #----------------------------------------------------------------------
  56.   # ● 获取 MaxHP
  57.   #----------------------------------------------------------------------
  58.   def maxhp
  59.     n = [[base_maxhp + @maxhp_plus, 1].max, 999999].min
  60.     for i in @states
  61.       n *= $data_states[i].maxhp_rate / 100.0
  62.     end
  63.     n = [[Integer(n), 1].max, 999999].min
  64.     return n
  65.   end

  66.   #----------------------------------------------------------------------
  67.   # ● 获取 MaxSP
  68.   #----------------------------------------------------------------------
  69.   def maxsp
  70.     n = [[base_maxsp + @maxsp_plus, 0].max, 999999].min
  71.     for i in @states
  72.       n *= $data_states[i].maxsp_rate / 100.0
  73.     end
  74.     n = [[Integer(n), 0].max, 999999].min
  75.     return n
  76.   end
  77.   #---------------------------------------------------------------------
  78.   # ● 获取力量
  79.   #---------------------------------------------------------------------
  80.   def str
  81.     n = [[base_str + @str_plus, 1].max, 999].min
  82.     for i in @states
  83.       n *= $data_states[i].str_rate / 100.0
  84.     end
  85.     n = [[Integer(n), 1].max, 999].min
  86.     return n
  87.   end
  88.   #----------------------------------------------------------------------
  89.   # ● 获取灵巧
  90.   #----------------------------------------------------------------------
  91.   def dex
  92.     n = [[base_dex + @dex_plus, 1].max, 999].min
  93.     for i in @states
  94.       n *= $data_states[i].dex_rate / 100.0
  95.     end
  96.     n = [[Integer(n), 1].max, 999].min
  97.     return n
  98.   end
  99.   #----------------------------------------------------------------------
  100.   # ● 获取速度
  101.   #----------------------------------------------------------------------
  102.   def agi
  103.     n = [[base_agi + @agi_plus, 1].max, 999].min
  104.     for i in @states
  105.       n *= $data_states[i].agi_rate / 100.0
  106.     end
  107.     n = [[Integer(n), 1].max, 999].min
  108.     return n
  109.   end
  110.   #------------------------------------------------------------------------
  111.   # ● 获取魔力
  112.   #------------------------------------------------------------------------
  113.   def int
  114.     n = [[base_int + @int_plus, 1].max, 999].min
  115.     for i in @states
  116.       n *= $data_states[i].int_rate / 100.0
  117.     end
  118.     n = [[Integer(n), 1].max, 999].min
  119.     return n
  120.   end
  121.   #------------------------------------------------------------------------
  122.   # ● 设置 MaxHP
  123.   #     maxhp : 新的 MaxHP
  124.   #------------------------------------------------------------------------
  125.   def maxhp=(maxhp)
  126.     @maxhp_plus += maxhp - self.maxhp
  127.     @maxhp_plus = [[@maxhp_plus, -9999].max, 9999].min
  128.     @hp = [@hp, self.maxhp].min
  129.   end
  130.   #------------------------------------------------------------------------
  131.   # ● 设置 MaxSP
  132.   #     maxsp : 新的 MaxSP
  133.   #------------------------------------------------------------------------
  134.   def maxsp=(maxsp)
  135.     @maxsp_plus += maxsp - self.maxsp
  136.     @maxsp_plus = [[@maxsp_plus, -999999].max, 999999].min
  137.     @sp = [@sp, self.maxsp].min
  138.   end
  139.   #------------------------------------------------------------------------
  140.   # ● 设置力量
  141.   #     str : 新的力量
  142.   #------------------------------------------------------------------------
  143.   def str=(str)
  144.     @str_plus += str - self.str
  145.     @str_plus = [[@str_plus, -999].max, 999].min
  146.   end
  147.   #------------------------------------------------------------------------
  148.   # ● 设置灵巧
  149.   #     dex : 新的灵巧
  150.   #------------------------------------------------------------------------
  151.   def dex=(dex)
  152.     @dex_plus += dex - self.dex
  153.     @dex_plus = [[@dex_plus, -999].max, 999].min
  154.   end
  155.   #------------------------------------------------------------------------
  156.   # ● 设置速度
  157.   #     agi : 新的速度
  158.   #------------------------------------------------------------------------
  159.   def agi=(agi)
  160.     @agi_plus += agi - self.agi
  161.     @agi_plus = [[@agi_plus, -999].max, 999].min
  162.   end
  163.   #------------------------------------------------------------------------
  164.   # ● 设置魔力
  165.   #     int : 新的魔力
  166.   #------------------------------------------------------------------------
  167.   def int=(int)
  168.     @int_plus += int - self.int
  169.     @int_plus = [[@int_plus, -999].max, 999].min
  170.   end
  171.   #------------------------------------------------------------------------
  172.   # ● 获取命中率
  173.   #------------------------------------------------------------------------
  174.   def hit
  175.     n = 100
  176.     for i in @states
  177.       n *= $data_states[i].hit_rate / 100.0
  178.     end
  179.     return Integer(n)
  180.   end
  181.   #------------------------------------------------------------------------
  182.   # ● 获取攻击力
  183.   #------------------------------------------------------------------------
  184.   def atk
  185.     n = base_atk + base_str + @str_plus.to_i
  186.     for i in @states
  187.       n *= $data_states[i].atk_rate / 100.0
  188.     end
  189.     return Integer(n)
  190.   end
  191.   #------------------------------------------------------------------------
  192.   # ● 获取物理防御
  193.   #------------------------------------------------------------------------
  194.   def pdef
  195.     n = base_pdef + base_dex + @dex_plus.to_i
  196.     for i in @states
  197.       n *= $data_states[i].pdef_rate / 100.0
  198.     end
  199.     return Integer(n)
  200.   end
  201.   #------------------------------------------------------------------------
  202.   # ● 获取魔法防御
  203.   #------------------------------------------------------------------------
  204.   def mdef
  205.     n = base_mdef + base_int + @int_plus.to_i
  206.     for i in @states
  207.       n *= $data_states[i].mdef_rate / 100.0
  208.     end
  209.     return Integer(n)
  210.   end
  211.   #------------------------------------------------------------------------
  212.   # ● 获取回避修正
  213.   #------------------------------------------------------------------------
  214.   def eva
  215.     n = base_eva + base_agi + @agi_plus.to_i
  216.     for i in @states
  217.       n += $data_states[i].eva
  218.     end
  219.     return n
  220.   end
  221.   #------------------------------------------------------------------------
  222.   # ● 更改 HP
  223.   #     hp : 新的 HP
  224.   #------------------------------------------------------------------------
  225.   def hp=(hp)
  226.     @hp = [[hp, maxhp].min, 0].max
  227.     # 解除附加的战斗不能状态
  228.     for i in 1...$data_states.size
  229.       if $data_states[i].zero_hp
  230.         if self.dead?
  231.           add_state(i)
  232.         else
  233.           remove_state(i)
  234.         end
  235.       end
  236.     end
  237.   end
  238.   #------------------------------------------------------------------------
  239.   # ● 更改 SP
  240.   #     sp : 新的 SP
  241.   #------------------------------------------------------------------------
  242.   def sp=(sp)
  243.     @sp = [[sp, maxsp].min, 0].max
  244.   end
  245.   #------------------------------------------------------------------------
  246.   # ● 全回复
  247.   #------------------------------------------------------------------------
  248.   def recover_all
  249.     @hp = maxhp
  250.     @sp = maxsp
  251.     for i in @states.clone
  252.       remove_state(i)
  253.     end
  254.   end
  255.   #------------------------------------------------------------------------
  256.   # ● 获取当前的动作
  257.   #------------------------------------------------------------------------
  258.   def current_action
  259.     return @current_action
  260.   end
  261.   #------------------------------------------------------------------------
  262.   # ● 确定动作速度
  263.   #------------------------------------------------------------------------
  264.   def make_action_speed
  265.     @current_action.speed = agi + rand(10 + agi / 4)
  266.   end
  267.   #------------------------------------------------------------------------
  268.   # ● 战斗不能判定
  269.   #------------------------------------------------------------------------
  270.   def dead?
  271.     return (@hp == 0 and not @immortal)
  272.   end
  273.   #------------------------------------------------------------------------
  274.   # ● 存在判定
  275.   #------------------------------------------------------------------------
  276.   def exist?
  277.     return (not @hidden and (@hp > 0 or @immortal))
  278.   end
  279.   #------------------------------------------------------------------------
  280.   # ● HP 0 判定
  281.   #------------------------------------------------------------------------
  282.   def hp0?
  283.     return (not @hidden and @hp == 0)
  284.   end
  285.   #------------------------------------------------------------------------
  286.   # ● 可以输入命令判定
  287.   #------------------------------------------------------------------------
  288.   def inputable?
  289.     return (not @hidden and restriction <= 1)
  290.   end
  291.   #------------------------------------------------------------------------
  292.   # ● 可以行动判定
  293.   #------------------------------------------------------------------------
  294.   def movable?
  295.     return (not @hidden and restriction < 4)
  296.   end
  297.   #------------------------------------------------------------------------
  298.   # ● 防御中判定
  299.   #------------------------------------------------------------------------
  300.   def guarding?
  301.     return (@current_action.kind == 0 and @current_action.basic == 1)
  302.   end
  303.   #------------------------------------------------------------------------
  304.   # ● 休止中判定
  305.   #------------------------------------------------------------------------
  306.   def resting?
  307.     return (@current_action.kind == 0 and @current_action.basic == 3)
  308.   end
  309. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
92 小时
注册时间
2009-8-1
帖子
438
3
 楼主| 发表于 2010-8-29 16:30:18 | 只看该作者
回复 oОS+WEi 的帖子


    呵呵,我之前用的这个,现在做的这个游戏不适合用这个。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
211 小时
注册时间
2010-8-21
帖子
442
4
发表于 2010-8-29 16:33:38 | 只看该作者
回复 tree52 的帖子

虽然不能解决你的问题,还是帮你找了个帖子看看能不能解决你的问题
http://rpg.blue/forum.php?mod=vi ... =%E7%A9%BA%E6%89%8B
   

点评

谢谢你的链接,挺有用的呢~  发表于 2010-8-29 16:56

评分

参与人数 1星屑 +200 收起 理由
IamI + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

旅之愚者

梦石
0
星屑
240
在线时间
812 小时
注册时间
2007-7-28
帖子
2148

贵宾

5
发表于 2010-8-29 16:35:55 | 只看该作者
回复 tree52 的帖子

Scene_Equip脚本第209行
  1.       item = @item_window.item
复制代码
在其后跟上
  1. if item == nil
  2. $game_system.se_play($data_system.buzzer_se)
  3. return
  4. end
复制代码

评分

参与人数 1星屑 +300 收起 理由
IamI + 300 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
92 小时
注册时间
2009-8-1
帖子
438
6
 楼主| 发表于 2010-8-29 16:57:01 | 只看该作者
回复 六祈 的帖子


    搞定,谢谢!等认可帖子出来了认可你哈。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 05:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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