do -- 自動PP 参考:rhapsoAI -- 設定 ------------------------------------------- -- ホムにPPをするHPの割合(パーセント)nilで無効 local AUTOPP_HP_PERCENTAGE = 30 -- HPが減った際にホムにPPをする使用スキルレベル local AUTOPP_LEVEL = 4 -- PPの最大試行回数 nilで無制限 local AUTOPP_LIMIT_COUNT = 20 -- ホムに青PPをするSPの割合(パーセント)nilで無効 local AUTOPP_SP_PERCENTAGE = nil -- PPのディレイ(ミリ秒) local AUTOPP_DELAY = 1000 --------------------------------------------------- local function tick_timer( interval ) -- intervalミリ秒が経過するごとにtrueを返す local t = 0 return function() local t2 = GetTick() local r = t2 - t >= interval if r then t = t2 end return r end end local t = tick_timer( AUTOPP_DELAY ) local counthp, countsp = 0, 0 local function UseSkill( level, count ) if not AUTOPP_LIMIT_COUNT or count < AUTOPP_LIMIT_COUNT then if not t() then -- ディレイ中 return true end SkillObject( MyID, level, 231, MyID ) return true else return false end end local function AutoPP( eventid, eventflag ) if AUTOPP_HP_PERCENTAGE then local perhp = GetV( V_HP, MyID ) / GetV( V_MAXHP, MyID ) * 100 if perhp <= AUTOPP_HP_PERCENTAGE then if UseSkill( AUTOPP_LEVEL, counthp ) then counthp = counthp + 1 return else TraceAI("ポーションがないかも") end end end counthp = 0 if AUTOPP_SP_PERCENTAGE then local persp = GetV( V_SP, MyID ) / GetV( V_MAXSP, MyID ) * 100 if persp <= AUTOPP_SP_PERCENTAGE then if UseSkill( 5, countsp ) then countsp = countsp + 1 return else TraceAI("青ポーションがないかも") end end end countsp = 0 end ROAIPlus.setEvent( ROAIPlus.EVENT_BEGIN, AutoPP ) end