查看: 2114|回复: 5

[已经过期] 仿手机网游天龙八部自动加血自动加蓝

[复制链接]
梦石
0
星屑
50
在线时间
865 小时
注册时间
2010-6-27
回帖
123
发表于 2013-5-8 17:40:15 | 显示全部楼层 |阅读模式

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

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

×
在rm上实现这种效果,怎么设置简单点,用脚本还是事件方便点,具体就是用一个变量作为血库,战斗胜利后补充角色hp(sp),补完了就没了,如果不够的话,按照队伍顺序补血,如果角色死亡则不补,直接跳到下一个。
梦石
0
星屑
275
在线时间
1373 小时
注册时间
2005-10-16
回帖
5038

贵宾

发表于 2013-5-8 18:35:44 | 显示全部楼层
用事件吧,战斗结束后执行公共事件,挨个计算每个活着角色的缺失血量,然后和变量选一个更小的值,然后把这个值恢复给这个角色,变量减去这个值。
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复

使用道具 举报

梦石
0
星屑
34467
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2013-5-9 00:11:04 | 显示全部楼层
本帖最后由 芯☆淡茹水 于 2013-5-9 01:49 编辑

    LS是事件,本楼是脚本。(事件,脚本都有了)


下面的脚本是在战斗场景胜利后插入了一段(因为比较简单,未测试)


复制下面的脚本,插入 main 前。

[pre lang="ruby" line="1"]#==============================================================================
# 储存回复 HP 血量的变量 ID
VAR_HP = 1
# 储存回复 SP 血量的变量 ID
VAR_SP = 2
#  战斗不能的状态 ID ,加HP/SP时排除死亡角色。
DEAD_ID = 1
#==============================================================================
class Scene_Battle
  def battle_end(result)
    # 清除战斗中标志
    $game_temp.in_battle = false
    # 清除全体同伴的行动
    $game_party.clear_actions
    # 解除战斗用状态
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    # 清除敌人
    $game_troop.enemies.clear
    # 调用战斗返回
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
    ###########################################################################
    #  HP
    if $game_variables[VAR_HP] > 0
      for i in 0...$game_party.actors.size
        if $game_variables[VAR_HP] == 0
          break
        end
        actor = $game_party.actors
        if not actor.state?(DEAD_ID) and actor.hp < actor.maxhp
          if actor.maxhp - actor.hp <= $game_variables[VAR_HP]
            renew_hp = actor.maxhp - actor.hp
          else
            renew_hp = $game_variables[VAR_HP]
          end
          $game_variables[VAR_HP] -= renew_hp
          actor.hp += renew_hp
        end
      end
    end
    #  SP
    if $game_variables[VAR_SP] > 0
      for i in 0...$game_party.actors.size
        if $game_variables[VAR_SP] == 0
          break
        end
        actor = $game_party.actors
        if not actor.state?(DEAD_ID) and actor.sp < actor.maxsp
          if actor.maxsp - actor.sp <= $game_variables[VAR_SP]
            renew_sp = actor.maxsp - actor.sp
          else
            renew_sp = $game_variables[VAR_SP]
          end
          $game_variables[VAR_SP] -= renew_sp
          actor.sp += renew_sp
        end
      end
    end
    ###########################################################################
    # 切换到地图画面
    $scene = Scene_Map.new
  end
end
#===============================================================================
[/pre]

评分

参与人数 1星屑 +12 收起 理由
Zhangjiaxing1 + 12 不错

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
275
在线时间
1373 小时
注册时间
2005-10-16
回帖
5038

贵宾

发表于 2013-5-9 07:05:36 | 显示全部楼层
本帖最后由 亿万星辰 于 2013-5-9 07:18 编辑
  1. for actor in $game_party.actors
  2.   break if $game_variables[VAR_HP] <= 0 and $game_variables[VAR_SP] <= 0
  3.   unless actor.dead?
  4.     recoverhp = [actor.maxhp - actor.hp, $game_variables[VAR_HP]].min
  5.     recoversp = [actor.maxsp - actor.sp, $game_variables[VAR_SP]].min
  6.     actor.hp += recoverhp
  7.     actor.sp += recoversp
  8.     $game_variables[VAR_HP] -= recoverhp
  9.     $game_variables[VAR_SP] -= recoversp
  10.   end
  11. end
复制代码
精简了一下中间的部分,楼上也可以看下~@芯☆淡茹水  

点评

不错,确实简洁。  发表于 2013-5-9 23:31

评分

参与人数 1星屑 +6 收起 理由
Zhangjiaxing1 + 6 这个简洁

查看全部评分

我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复

使用道具 举报

梦石
0
星屑
50
在线时间
865 小时
注册时间
2010-6-27
回帖
123
 楼主| 发表于 2013-5-9 11:26:32 | 显示全部楼层
我想到一个:
   for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]  
     if not actor.state?(1)
       if actor.maxhp - actor.hp > $game_variables[1]
         actor.hp += $game_variables[1]
        $game_variables[1] = 0
       else
       $game_variables[1] -= actor.maxhp - actor.hp
       actor.hp  = actor.maxhp
    end
   end
end

点评

条条大路通罗马  发表于 2013-5-9 23:32
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2013-5-11 12:21:48 | 显示全部楼层
楼主难道还是没解决吗?这个问题可以设定成已经解决了@hcm @hys111111  

点评

解决了,我不知道怎么设置  发表于 2013-5-13 08:46
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部