| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 4517 | 
 
| 最后登录 | 2017-8-23 | 
 
| 在线时间 | 58 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 58 小时
 
        - 注册时间
 - 2015-8-11
 
        - 帖子
 - 64
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
#状态备注栏、技能备注栏、怪物备注栏  
#填写<变量X X>或<变量X -X>就能增减变量X  
#填写复数变量时可以同时增减复数变量 
#状态为每得到一次状态计算一次,技能为每使用一次计算一次 ,怪物为每消灭一只计算一次 
#可以用在杀怪计数器,装备,技能熟练度,死亡,中毒次数的计数等方面 
#杀怪任务接取时记得先把变量清零!从0开始计算杀怪数 
#注意:要放在横版战斗脚本上方,不然会出现战斗速度飞快,显得无动作的BUG 
class Game_Battler < Game_BattlerBase 
  #-------------------------------------------------------------------------- 
  # ● 判定状态是否可以附加 
  #-------------------------------------------------------------------------- 
  def state_addable?(state_id) 
    if alive? && $data_states[state_id] && !state_resist?(state_id) && 
      !state_removed?(state_id) && !state_restrict?(state_id) 
      variable_change(state_id, 0) # 附加状态时调用变量变化的公共脚本 
      if state_id == 1 and self.is_a?(Game_Enemy) 
        variable_change(self.enemy_id, 2) # 敌人死亡时调用变量变化的公共脚本 
      end   
      return true 
    else 
      return false 
    end   
  end 
end   
   
class Scene_ItemBase < Scene_MenuBase 
  #-------------------------------------------------------------------------- 
  # ● 使用物品 
  #-------------------------------------------------------------------------- 
  def use_item 
    variable_change(item.id, 1) if item.is_a?(RPG::Skill) # 平时使用技能时调用变量变化的公共脚本 
    play_se_for_item 
    user.use_item(item) 
    use_item_to_actors 
    check_common_event 
    check_gameover 
    @actor_window.refresh 
  end 
end 
 
class Scene_Battle < Scene_Base 
  #-------------------------------------------------------------------------- 
  # ● 使用技能/物品 
  #-------------------------------------------------------------------------- 
  def use_item 
    item = @subject.current_action.item 
    @log_window.display_use_item(@subject, item) 
    @subject.use_item(item) 
    refresh_status 
    targets = @subject.current_action.make_targets.compact 
    show_animation(targets, item.animation_id) 
    targets.each {|target| item.repeats.times { invoke_item(target, item) } } 
    variable_change(item.id, 1) if item.is_a?(RPG::Skill) # 战斗时使用技能时调用变量变化的公共脚本 
  end 
end   
 
#-------------------------------------------------------------------------- 
# ● 变量变化的公共脚本 
#-------------------------------------------------------------------------- 
def variable_change(obj_id, type) 
  case type 
  when 0 
    object = $data_states[obj_id] 
  when 1 
    object = $data_skills[obj_id] 
  when 2 
    object = $data_enemies[obj_id] 
  end   
  object.note.each_line do |line| 
    if line.include?("<变量") 
      string = line.delete("<") 
      string = string.delete(">") 
      string = string.delete("\r\n").split(/ /) 
      $game_variables[string[0].delete("变量").to_i] += string[1].to_i 
    end   
  end 
end  
 
我想利用这个变量计数脚本做一个杀怪的计数,可是一直不懂这个脚本怎么用?他说“填写<变量X X>或<变量X -X>就能增减变量X”  
“填写复数变量时可以同时增减复数变量”这两句是什么意思 |   
 
 
 
 |