XP 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆入手経験値&金増加 - KGC_ExpGoldIncrease◆
#_/----------------------------------------------------------------------------
#_/  戦闘後に獲得する経験値・金を増加する機能を追加します。
#_/  Provides the function which increases gain EXP and Gold of battle result.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
  # ◆増加ステートの重複を許可
  ### Permits repetition of gain states.
  EXPGLD_INC_PERMIT_DOUBLE = true
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["ExpGoldIncrease"] = true

if $game_special_states == nil
  $game_special_states = {}
  $data_states = load_data("Data/States.rxdata")
end
# 経験値○%ステート
### <e.g.> GainEXP150%
$game_special_states["inc_exp"] = /(?:(?:경험치)|(?:GainEXP))(d+)(%|%)/
# 入手金○%ステート                   
### <e.g.> GainGold150%           
$game_special_states["inc_gold"] = /(?:(?:입수금)|(?:GainGold))(d+)(%|%)/

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● EXP の変更
  #    exp : 新しい EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    rate = calc_exp_increase_rate(KGC::EXPGLD_INC_PERMIT_DOUBLE)
    exp = @exp + (exp - @exp) * rate / 100
    @exp = [[exp, $imported["LimitBreak"] ?
      KGC::LB_ACTOR_EXP_LIMIT : 9999999].min, 0].max
    # レベルアップ
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # スキル習得
      for j in $data_classes[@class_id].learnings
        learn_skill(j.skill_id) if j.level == @level
      end
    end
    # レベルダウン
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # 現在の HP と SP が最大値を超えていたら修正
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  #--------------------------------------------------------------------------
  # ● 経験値増加率計算
  #    permit_double : 重複許可
  #--------------------------------------------------------------------------
  def calc_exp_increase_rate(permit_double)
    rate = 100
    max_rate = -1
    # ステート[経験値○%]判定
    self.states.each { |state|
      if $data_states[state].name =~ $game_special_states["inc_exp"]
        if permit_double
          rate = rate * $1.to_i / 100
        else
          max_rate = [$1.to_i, max_rate].max
        end
      end
    }
    unless permit_double
      rate = [max_rate, 0].max
    end
    return rate
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● ゴールドの取得
  #--------------------------------------------------------------------------
  alias gold_KGC_ExpGoldIncrease gold
  def gold
    n = gold_KGC_ExpGoldIncrease
    rate = calc_gold_increase_rate(KGC::EXPGLD_INC_PERMIT_DOUBLE)
    return n * rate / 100
  end
  #--------------------------------------------------------------------------
  # ● ゴールド増加率計算
  #    permit_double : 重複許可
  #--------------------------------------------------------------------------
  def calc_gold_increase_rate(permit_double)
    rate = 100
    max_rate = -1
    $game_party.actors.each { |actor|
      if actor.exist?
        # ステート[入手金○%]判定
        actor.states.each { |state|
          if $data_states[state].name =~ $game_special_states["inc_gold"]
            if permit_double
              rate = rate * $1.to_i / 100
            else
              max_rate = [$1.to_i, max_rate].max
            end
          end
        }
      end
    }
    unless permit_double
      rate = [max_rate, 0].max
    end
    return rate
  end
end
#-----------끝

귀찮아서 한글번역은 안했음;;;;;; (퍽)
사용법
스크립트 도입 후, 데이타베이스로 설정을 실시합니다.
우선, 스테이트에 「경험치○%」 「입수금○%」를 만듭니다.( ○은 임의의 자연수)
다음에[ 레이팅] (을)를0 ,[ 저항하지 않는다][ 배틀 종료시에 해제] (을)를 체크.
예를 들면 「경험치 2배」를 만들고 싶은 경우, 스테이트명을 「경험치200 %」로 하면OK 입니다.

출처는 KGC

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
174 기타 Shift Puzzles by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 1390
173 기타 Shift Puzzles v2 by SephirothSpawn (SDK호환) 3 file 백호 2009.02.22 1170
172 기타 Sized Events 0.1 by Toby@rmxp.org file 백호 2009.02.22 848
171 기타 Sphere Grid System file 백호 2009.02.21 765
170 기타 Steal Script (SDK Required) file 백호 2009.02.21 1182
169 기타 Tax Script 1.2 by The Darklord@rmxp.org 2 file 백호 2009.02.22 1130
168 기타 Terrain Encounter Areas by SephirothSpawn 백호 2009.02.22 778
167 기타 Tetris Attack by trickster 1 file 백호 2009.02.22 986
166 기타 Text Scroll by Dubealex (Release 3) 2 file 백호 2009.02.22 940
165 기타 Text to RGSS by DerVVulfman Alkaid 2011.04.18 1319
164 기타 The General Monster Generator 1.1 by DerVVulfman 1 file Alkaid 2011.03.02 1496
163 기타 Trailing Characters ver.1 by SephirothSpawn 6 file 백호 2009.02.22 1551
162 기타 Upload & Download files with RGSS 2.1 by berka (XP/VX 공용) 5 Alkaid 2010.11.20 2138
161 기타 Weather Script 1.02 by ccoa 1 file 백호 2009.02.22 810
160 기타 XP 각종 스크립트입니다. 36 file 쿠도신이치 2009.04.26 4272
159 기타 [All RGSS] File-Ex file Cheapmunk 2014.12.29 964
158 기타 [All RGSS] FileTest (Unicode) file Cheapmunk 2014.12.29 614
157 기타 [All RGSS] 게임 다중 실행 방지 스크립트 1 file Cheapmunk 2014.05.24 1381
156 기타 [All RGSS] 윈도우 메세지박스 스크립트 (Completed ver) 5 file Cheapmunk 2014.06.22 2186
155 기타 [All RGSS] 윈도우 커서 숨기기/보이기 1 file Cheapmunk 2014.03.02 1963
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13