AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  




Partagez
 

 [VX] KGC_Skill CP System

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 0:16

Un Script que j'aime beaucoup.
Tu doit equiper tes skill pour les utilisé.

Script:
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ スキルCP制 - KGC_SkillCPSystem ◆ VX ◆
#_/    ◇ Last update : 2008/02/17 ◇
#_/----------------------------------------------------------------------------
#_/  使用可能なスキルを、全スキルの中から限定する機能を追加します。
#_/============================================================================
#_/ 【装備】≪スキル習得装備≫ より下に導入してください。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================
module KGC
module SkillCPSystem
  # ◆ 登録スキル最大数
  MAX_SKILLS = 8
  # ◆ CP の名称
  VOCAB_CP  = "SP"
  # ◆ CP の名称 (略)
  VOCAB_CP_A = "S"
  # ◆ ステータス画面に CP を表示する
  SHOW_STATUS_CP = true
  # ◆ 消費 CP 既定値
  #  消費 CP 未指定のスキルで使用。
  DEFAULT_CP_COST = 1
  # ◆ CP 上限
  CP_MAX = 15
  # ◆ CP 下限
  CP_MIN = 0
  # ◆ 最大 CP 算出式
  #  level..現在のレベル
  #  自動的に整数変換するので、結果が小数になってもOK。
  CP_CALC_EXP = "level * 0.3"
  # ◆ 戦闘テスト時は無効化
  #  true にすると、戦闘テスト時のみ全スキルを使用可能。
  DISABLE_IN_BATTLETEST  = true
  # ◆ 使用不可スキルもセット可能
  SHOW_UNUSABLE_SKILL    = true
  # ◆ 消費 CP 0 のスキルはセットしなくても使用可能
  USABLE_COST_ZERO_SKILL = true
  # ◆ パッシブスキルはセットしないと効果なし
  #  ≪パッシブスキル≫ 導入時のみ有効。
  PASSIVE_NEED_TO_SET    = true
  # ◆ CP ゲージの開始色
  #  数値  : \C[n] と同じ色。
  #  Color : 指定した色。 ( Color.new(255, 128, 128) など )
  GAUGE_START_COLOR = 13
  # ◆ CP ゲージの終了色
  GAUGE_END_COLOR  = 5
  # ◆ メニュー画面に「スキル設定」コマンドを追加する
  #  追加する場所は、メニューコマンドの最下部です。
  #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  USE_MENU_SET_SKILL_COMMAND = true
  # ◆ メニュー画面の「スキル設定」コマンドの名称
  VOCAB_MENU_SET_SKILL      = "Set Skill"
  # ◆ 未設定項目の表示文字列
  BLANK_TEXT  = "-  EMPTY  -"
  # ◆ 設定解除の表示文字列
  RELEASE_TEXT = "( None )"
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["SkillCPSystem"] = true
module KGC::SkillCPSystem
  # 正規表現
  module Regexp
    # スキル
    module Skill
      # 消費 CP
      CP_COST = /<CP[ ]*(\d+)>/i
    end
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ KGC::Commands
#==============================================================================
module KGC::Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ 固有 CP の変更
  #    actor_id : アクター ID
  #    own_cp  : 固有 CP
  #--------------------------------------------------------------------------
  def set_own_cp(actor_id, own_cp)
    $game_actors[actor_id].own_cp = own_cp
  end
  #--------------------------------------------------------------------------
  # ○ 登録スキル最大数の変更
  #    actor_id : アクター ID
  #    value    : 登録可能数
  #--------------------------------------------------------------------------
  def set_battle_skill_max(actor_id, value = -1)
    $game_actors[actor_id].battle_skill_max = value
  end
  #--------------------------------------------------------------------------
  # ○ スキルの登録
  #    actor_id : アクター ID
  #    index    : 登録箇所
  #    skill_id : 登録するスキル ID (nil で解除)
  #--------------------------------------------------------------------------
  def set_battle_skill(actor_id, index, skill_id = nil)
    actor = $game_actors[actor_id]
    if skill_id.is_a?(Integer)
      # 登録
      skill = $data_skills[skill_id]
      return unless actor.battle_skill_settable?(index, skill)  # セット不可
      actor.set_battle_skill(index, skill)
      actor.restore_battle_skill
    else
      # 解除
      actor.remove_battle_skill(index)
    end
  end
  #--------------------------------------------------------------------------
  # ○ スキルの追加登録
  #    actor_id : アクター ID
  #    skill_id : 登録するスキル ID
  #--------------------------------------------------------------------------
  def add_battle_skill(actor_id, skill_id)
    actor = $game_actors[actor_id]
    skill = $data_skills[skill_id]
    skills = actor.battle_skill_ids
    return if skills.include?(skill_id)  # 登録済み
    return if actor.cp < skill.cp_cost  # CP 不足
    actor.battle_skill_max.times { |i|
      # 空きがあれば登録
      if skills[i] == nil &&
        actor.set_battle_skill(i, skill)
        break
      end
    }
    actor.restore_battle_skill
  end
  #--------------------------------------------------------------------------
  # ○ スキルの全解除
  #    actor_id : アクター ID
  #--------------------------------------------------------------------------
  def clear_battle_skill(actor_id)
    $game_actors[actor_id].clear_battle_skill
  end
  #--------------------------------------------------------------------------
  # ○ スキル設定画面の呼び出し
  #    actor_index : アクターインデックス
  #--------------------------------------------------------------------------
  def call_set_battle_skill(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :set_battle_skill
    $game_temp.next_scene_actor_index = actor_index
  end
end
class Game_Interpreter
  include KGC::Commands
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Vocab
#==============================================================================
module Vocab
  # CP
  def self.cp
    return KGC::SkillCPSystem::VOCAB_CP
  end
  # CP (略)
  def self.cp_a
    return KGC::SkillCPSystem::VOCAB_CP_A
  end
  # スキル設定
  def self.set_battle_skill
    return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
  #--------------------------------------------------------------------------
  # ○ スキルCP制のキャッシュを生成
  #--------------------------------------------------------------------------
  def create_skill_cp_system_cache
    @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when KGC::SkillCPSystem::Regexp::Skill::CP_COST
        # 消費 CP
        @__cp_cost = $1.to_i
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 消費 CP
  #--------------------------------------------------------------------------
  def cp_cost
    create_skill_cp_system_cache if @__cp_cost == nil
    return @__cp_cost
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキルセット済み判定
  #    skill : スキル
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return true
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_writer  :own_cp                  # 固有 CP
  #--------------------------------------------------------------------------
  # ● セットアップ
  #    actor_id : アクター ID
  #--------------------------------------------------------------------------
  alias setup_KGC_SkillCPSystem setup
  def setup(actor_id)
    setup_KGC_SkillCPSystem(actor_id)
    @battle_skills = []
    @own_cp = 0
    @battle_skill_max = -1
  end
  #--------------------------------------------------------------------------
  # ○ MaxCP 取得
  #--------------------------------------------------------------------------
  def maxcp
    n = Integer(eval(KGC::SkillCPSystem::CP_CALC_EXP))
    return [[n + own_cp, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
  end
  #--------------------------------------------------------------------------
  # ○ CP 取得
  #--------------------------------------------------------------------------
  def cp
    n = 0
    battle_skills.compact.each { |skill| n += skill.cp_cost }
    return [maxcp - n, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ CP 上限取得
  #--------------------------------------------------------------------------
  def cp_limit
    return KGC::SkillCPSystem::CP_MAX
  end
  #--------------------------------------------------------------------------
  # ○ 固有 CP 取得
  #--------------------------------------------------------------------------
  def own_cp
    @own_cp = 0 if @own_cp == nil
    return @own_cp
  end
  #--------------------------------------------------------------------------
  # ● スキル取得
  #--------------------------------------------------------------------------
  alias skills_KGC_SkillCPSystem skills
  def skills
    result = skills_KGC_SkillCPSystem
Revenir en haut Aller en bas
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 0:17

Code:
    # スキルを制限する場合
    if skill_cp_restrict?
      result.each_with_index { |skill, i|
        # 消費 CP > 0 のスキルを除外
        if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
          result[i] = nil
        end
        # パッシブスキルを除外
        if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
          result[i] = nil if skill.passive
        end
      }
      result.compact!
      # 戦闘スキルを追加
      result |= battle_skills
      result.sort! { |a, b| a.id <=> b.id }
    end
    return result
  end
  #--------------------------------------------------------------------------
  # ○ スキルを制限するか
  #--------------------------------------------------------------------------
  def skill_cp_restrict?
    if $game_temp.in_battle
      # 戦闘テストでないか、戦闘テストでも制限する場合
      return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ○ 全スキル取得
  #--------------------------------------------------------------------------
  def all_skills
    # 一時的に非戦闘中にする
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false
    result = skills_KGC_SkillCPSystem
    if $imported["EquipLearnSkill"]
      result |= (equipment_skills | full_ap_skills)
      result.sort! { |a, b| a.id <=> b.id }
    end
    # 戦闘中フラグを戻す
    $game_temp.in_battle = last_in_battle
    return result
  end
  #--------------------------------------------------------------------------
  # ○ 登録スキル最大数取得
  #--------------------------------------------------------------------------
  def battle_skill_max
    @battle_skill_max = -1 if @battle_skill_max == nil
    if @battle_skill_max < 0
      return KGC::SkillCPSystem::MAX_SKILLS
    else
      return @battle_skill_max
    end
  end
  #--------------------------------------------------------------------------
  # ○ 登録スキル最大数設定
  #--------------------------------------------------------------------------
  def battle_skill_max=(value)
    @battle_skill_max = value
    if @battle_skills == nil
      @battle_skills = []
    else
      @battle_skills = @battle_skills[0...value]
    end
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキル ID 取得
  #--------------------------------------------------------------------------
  def battle_skill_ids
    @battle_skills = [] if @battle_skills == nil
    return @battle_skills
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキル取得
  #--------------------------------------------------------------------------
  def battle_skills
    result = []
    battle_skill_ids.each { |i|
      next if i == nil          # 無効なスキルは無視
      result << $data_skills[i]
    }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキル登録
  #    index : 位置
  #    skill : スキル
  #--------------------------------------------------------------------------
  def set_battle_skill(index, skill)
    return unless skill.is_a?(RPG::Skill)  # スキル以外
    return if cp < skill.cp_cost          # CP 不足
    @battle_skills[index] = skill.id
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキル解除
  #    index : 位置
  #--------------------------------------------------------------------------
  def remove_battle_skill(index)
    @battle_skills[index] = nil
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキル全解除
  #--------------------------------------------------------------------------
  def clear_battle_skill
    @battle_skills = []
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキルセット可否判定
  #    index : 位置
  #    skill : スキル
  #--------------------------------------------------------------------------
  def battle_skill_settable?(index, skill)
    return false if battle_skill_max <= index  # 範囲外
    return true  if skill == nil              # nil は解除なので OK
    return false if battle_skill_ids.include?(skill.id)  # セット済み
    curr_skill = battle_skills[index]
    offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
    return false if self.cp < (skill.cp_cost - offset)  # CP 不足
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキルを修復
  #--------------------------------------------------------------------------
  def restore_battle_skill
    result = battle_skill_ids.clone
    usable_skills = all_skills
    result.each_with_index { |n, i|
      next if n == nil
      # 未修得の場合は解除
      if (usable_skills.find { |s| s.id == n }) == nil
        result[i] = nil
      end
    }
    @battle_skills = result
  end
  #--------------------------------------------------------------------------
  # ● 装備の変更 (オブジェクトで指定)
  #    equip_type : 装備部位 (0..4)
  #    item      : 武器 or 防具 (nil なら装備解除)
  #    test      : テストフラグ (戦闘テスト、または装備画面での一時装備)
  #--------------------------------------------------------------------------
  alias change_equip_KGC_SkillCPSystem change_equip
  def change_equip(equip_type, item, test = false)
    change_equip_KGC_SkillCPSystem(equip_type, item, test)
    unless test
      restore_battle_skill
      restore_passive_rev if $imported["PassiveSkill"]
    end
  end
  #--------------------------------------------------------------------------
  # ● 装備の破棄
  #    item : 破棄する武器 or 防具
  #    武器/防具の増減で「装備品も含める」のとき使用する。
  #--------------------------------------------------------------------------
  alias discard_equip_KGC_SkillCPSystem discard_equip
  def discard_equip(item)
    discard_equip_KGC_SkillCPSystem(item)
    restore_battle_skill
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ● 経験値の変更
  #    exp  : 新しい経験値
  #    show : レベルアップ表示フラグ
  #--------------------------------------------------------------------------
  alias change_exp_KGC_SkillCPSystem change_exp
  def change_exp(exp, show)
    # 習得したスキルを表示するため、戦闘中フラグを一時的に解除
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false
    change_exp_KGC_SkillCPSystem(exp, show)
    $game_temp.in_battle = last_in_battle
  end
  #--------------------------------------------------------------------------
  # ● スキルを忘れる
  #    skill_id : スキル ID
  #--------------------------------------------------------------------------
  alias forget_skill_KGC_SkillCPSystem forget_skill
  def forget_skill(skill_id)
    # 忘れるスキルを戦闘用スキルから削除
    battle_skill_ids.each_with_index { |s, i|
      remove_battle_skill(i) if s == skill_id
    }
    forget_skill_KGC_SkillCPSystem(skill_id)
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘用スキルセット済み判定
  #    skill : スキル
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return false unless skill.is_a?(RPG::Skill)  # スキル以外
    return battle_skill_ids.include?(skill.id)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ CP の文字色を取得
  #    actor : アクター
  #--------------------------------------------------------------------------
  def cp_color(actor)
    return knockout_color if actor.maxcp > 0 && actor.cp == 0
    return normal_color
  end
  #--------------------------------------------------------------------------
  # ○ CP ゲージの色 1 の取得
  #--------------------------------------------------------------------------
  def cp_gauge_color1
    color = KGC::SkillCPSystem::GAUGE_START_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ○ CP ゲージの色 2 の取得
  #--------------------------------------------------------------------------
  def cp_gauge_color2
    color = KGC::SkillCPSystem::GAUGE_END_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ○ CP の描画
  #    actor : アクター
  #    x    : 描画先 X 座標
  #    y    : 描画先 Y 座標
  #    width : 幅
  #--------------------------------------------------------------------------
  def draw_actor_cp(actor, x, y, width = 120)
    draw_actor_cp_gauge(actor, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
    self.contents.font.color = cp_color(actor)
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
    else
      self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxcp, 2)
    end
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ○ CP ゲージの描画
  #    actor : アクター
  #    x    : 描画先 X 座標
  #    y    : 描画先 Y 座標
  #    width : 幅
  #--------------------------------------------------------------------------
  def draw_actor_cp_gauge(actor, x, y, width = 120)
    gw = width * actor.cp / [actor.maxcp, 1].max
    gc1 = cp_gauge_color1
    gc2 = cp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # ○ コマンドを追加
  #    追加した位置を返す
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
Revenir en haut Aller en bas
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 0:17

Code:
#--------------------------------------------------------------------------
  # ○ コマンドをリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ○ コマンドを挿入
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ コマンドを削除
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Status
#==============================================================================
if KGC::SkillCPSystem::SHOW_STATUS_CP
class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # ● 基本情報の描画
  #    x : 描画先 X 座標
  #    y : 描画先 Y 座標
  #--------------------------------------------------------------------------
  alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  def draw_basic_info(x, y)
    draw_basic_info_KGC_SkillCPSystem(x, y)
    draw_actor_cp(@actor, x, y + WLH * 4)
  end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_BattleSkillStatus
#------------------------------------------------------------------------------
#  戦闘スキル設定画面で、設定者のステータスを表示するウィンドウです。
#==============================================================================
class Window_BattleSkillStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    x    : ウィンドウの X 座標
  #    y    : ウィンドウの Y 座標
  #    actor : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, Graphics.width, WLH + 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 140, 0)
    draw_actor_cp(@actor, 240, 0)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_BattleSkillSlot
#------------------------------------------------------------------------------
#  戦闘スキル選択画面で、設定したスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_BattleSkillSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    x      : ウィンドウの X 座標
  #    y      : ウィンドウの Y 座標
  #    width  : ウィンドウの幅
  #    height : ウィンドウの高さ
  #    actor  : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ スキルの取得
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    skill_ids = @actor.battle_skill_ids
    @actor.battle_skill_max.times { |i|
      if skill_ids[i] != nil
        @data << $data_skills[skill_ids[i]]
      else
        @data << nil
      end
    }
    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      draw_item_name(skill, rect.x, rect.y)
      self.contents.draw_text(rect, skill.cp_cost, 2)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active
    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_BattleSkillList
#------------------------------------------------------------------------------
#  戦闘スキル選択画面で、設定できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_BattleSkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :slot_index              # スロット番号
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    x      : ウィンドウの X 座標
  #    y      : ウィンドウの Y 座標
  #    width  : ウィンドウの幅
  #    height : ウィンドウの高さ
  #    actor  : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @slot_index = 0
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ スキルの取得
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    @data = [nil]
    # 選択可能なスキルのみを取得
    @actor.all_skills.each { |skill|
      @data.push(skill) if selectable?(skill)
    }
    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ○ スキル選択可否判定
  #    skill : スキル
  #--------------------------------------------------------------------------
  def selectable?(skill)
    return false if skill == nil
    # 消費 CP 0 なら常に使用可能な場合
    if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
      return false
    end
    # 戦闘時に使用可能ならOK
    return true if skill.battle_ok?
    # 使用不可でもセット可能な場合
    if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.battle_skill_settable?(@slot_index, skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, skill.cp_cost, 2)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active
    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 画面切り替えの実行
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_SkillCPSystem update_scene_change
  def update_scene_change
    return if $game_player.moving?    # プレイヤーの移動中?
    if $game_temp.next_scene == :set_battle_skill
      call_set_battle_skill
      return
    end
    update_scene_change_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ○ スキル設定画面への切り替え
  #--------------------------------------------------------------------------
  def call_set_battle_skill
    $game_temp.next_scene = nil
    $scene = Scene_SetBattleSkill.new(
      $game_temp.next_scene_actor_index,
      0,
      Scene_SetBattleSkill::HOST_MAP)
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
  if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
  #--------------------------------------------------------------------------
  # ● コマンドウィンドウの作成
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_SkillCPSystem create_command_window
  def create_command_window
    create_command_window_KGC_SkillCPSystem
    return if $imported["CustomMenuCommand"]
    @__command_set_battle_skill_index =
      @command_window.add_command(Vocab.set_battle_skill)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
Revenir en haut Aller en bas
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 0:19

Code:
#--------------------------------------------------------------------------
  # ● コマンド選択の更新
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_SkillCPSystem update_command_selection
  def update_command_selection
    call_set_battle_skill_flag = false
    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_set_battle_skill_index  # スキル設定
        call_set_battle_skill_flag = true
      end
    end
    # スキル設定画面に移行
    if call_set_battle_skill_flag
      if $game_party.members.size == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      start_actor_selection
      return
    end
    update_command_selection_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ● アクター選択の更新
  #--------------------------------------------------------------------------
  alias update_actor_selection_KGC_SkillCPSystem update_actor_selection
  def update_actor_selection
    if Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when @__command_set_battle_skill_index  # スキル設定
        $scene = Scene_SetBattleSkill.new(
          @status_window.index,
          @__command_set_battle_skill_index,
          Scene_SetBattleSkill::HOST_MENU)
        return
      end
    end
    update_actor_selection_KGC_SkillCPSystem
  end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Scene_SetBattleSkill
#------------------------------------------------------------------------------
#  戦闘スキル設定画面の処理を行うクラスです。
#==============================================================================
class Scene_SetBattleSkill < Scene_Base
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  HOST_MENU  = 0  # 呼び出し元 : メニュー
  HOST_MAP    = 1  # 呼び出し元 : マップ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    actor_index : アクターインデックス
  #    menu_index  : コマンドのカーソル初期位置
  #    host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
    @actor_index = actor_index
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    create_windows
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ作成
  #--------------------------------------------------------------------------
  def create_windows
    @help_window = Window_Help.new
    if $imported["HelpExtension"]
      @help_window.row_max = KGC::HelpExtension::ROW_MAX
    end
    dy = @help_window.height
    @status_window = Window_BattleSkillStatus.new(0, dy, @actor)
    dy += @status_window.height
    @slot_window = Window_BattleSkillSlot.new(
      0,
      dy,
      Graphics.width / 2,
      Graphics.height - dy,
      @actor)
    @slot_window.help_window = @help_window
    @slot_window.active = true
    @list_window = Window_BattleSkillList.new(
      Graphics.width - @slot_window.width,
      dy,
      Graphics.width - @slot_window.width,
      Graphics.height - dy,
      @actor)
    @list_window.help_window = @help_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @status_window.dispose
    @slot_window.dispose
    @list_window.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 元の画面へ戻る
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_window
    if @slot_window.active
      update_slot
    elsif @list_window.active
      update_list
    end
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ更新
  #--------------------------------------------------------------------------
  def update_window
    @help_window.update
    @status_window.update
    @slot_window.update
    @list_window.update
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ再描画
  #--------------------------------------------------------------------------
  def refresh_window
    @status_window.refresh
    @slot_window.refresh
    @list_window.refresh
  end
  #--------------------------------------------------------------------------
  # ○ 次のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ 前のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新 (スロットウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_slot
    # 選択項目が変化した場合
    if @last_slot_index != @slot_window.index
      @list_window.slot_index = @slot_window.index
      @list_window.refresh
      @last_slot_index = @slot_window.index
    end
    if Input.trigger?(Input::A)
      Sound.play_decision
      # 選択しているスキルを外す
      @actor.remove_battle_skill(@slot_window.index)
      refresh_window
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      # リストウィンドウに切り替え
      @slot_window.active = false
      @list_window.active = true
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新 (リストウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_list
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # スロットウィンドウに切り替え
      @slot_window.active = true
      @list_window.active = false
    elsif Input.trigger?(Input::C)
      skill = @list_window.skill
      # セットできない場合
      unless @actor.battle_skill_settable?(@slot_window.index, skill)
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      set_skill(@slot_window.index, skill)
      # スロットウィンドウに切り替え
      @slot_window.active = true
      @list_window.active = false
    end
  end
  #--------------------------------------------------------------------------
  # ○ スキル設定
  #    index : 設定する場所
  #    skill : 設定するスキル
  #--------------------------------------------------------------------------
  def set_skill(index, skill)
    @actor.remove_battle_skill(index)
    if skill != nil
      @actor.set_battle_skill(index, skill)
    end
    refresh_window
  end
end
Revenir en haut Aller en bas
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 0:35

INSTRUCTION:
Si votre personnage a 20 Skill ils peuvent seulement en équiper 8.
A la ligne 17 vous pouvez changer le Maximum. (MAX_SKILLS = 8 )

Vous aller avoir besoin des SP pour équiper les Skills.
Pour choisir combien de SP vous voulez recevoir par Level aller a la ligne 35.
(CP_CALC_EXP = "level * 0.3")

A la ligne 29 et 31 vous pouvez choisir le SP Maximum et Minimum.

Si vous voulez choisir le SP qu'une skill coute vous devez placez pour que la skill coute 2 dans Notes.
Les skills coute 1 par défaut. Voila un Screen pour vous aider.


[VX] KGC_Skill CP System Skill_10

Vous devez placez le sript en haut de Main ...
Voici un Screen pour vous donner une idée a quoi ca resemble.

[VX] KGC_Skill CP System Skills10

Enjoy !! hehe
Revenir en haut Aller en bas
fabY
dYeu retraité prématurément
dYeu retraité prématurément
fabY


Masculin Age : 28
Inscrit le : 09/02/2008
Messages : 5357

[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 9:47

Merci encore =D
Une démo avec tout tes scripts ne serait pas de refu =D
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com/
Invité
Invité
avatar



[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 14:14

Je pourrai faire un demo c jsute que j'ai jamais fait ca j'ignore comment le poster.
Aussi c en anglais et c'est mon jeu que je travaille dessus. (5 heure de gameplay a peu pres)
Ya plusieur inside joke pour mes amis et il y a des languages Mature un peu haha.
Revenir en haut Aller en bas
fabY
dYeu retraité prématurément
dYeu retraité prématurément
fabY


Masculin Age : 28
Inscrit le : 09/02/2008
Messages : 5357

[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 14:22

Eh bien, je te demande pas grand chose en faite ^^.
Tu crée un nouveau projet, tu y mets tous les scripts que tu utilise et tu mets des exemples de ceux-ci (en anglais si tu veux, on comprend à peu-près...).
Ensuite tu fait fichier > crée un installateur et tu l'héberge sur Megaupload ou autre.

Enfin, tu nous met le liens ^^.
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com/
Raitosan
† Fondateur du forum †
† Fondateur du forum †
Raitosan


Masculin Age : 31
Inscrit le : 09/02/2008
Messages : 1974

[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitimeVen 18 Avr 2008 - 14:27

Merci à toi Smile
Revenir en haut Aller en bas
http://www.zeforiu.fr
Contenu sponsorisé




[VX] KGC_Skill CP System Empty
MessageSujet: Re: [VX] KGC_Skill CP System   [VX] KGC_Skill CP System Icon_minitime

Revenir en haut Aller en bas
 

[VX] KGC_Skill CP System

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» System de vol de PNJ
» Djinn System
» [VX] Weapon Level System
» [VX] Neo-Face System
» [VX] Neo Save System V

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker VX :: Entraide :: Scripts :: Scripts VX - RGSS2 :: Objets et compétences-
Créer un forum | ©phpBB | Forum gratuit d'entraide | Signaler un abus | Forum gratuit