AP SYSTEM
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


requested by Kaitos
HERE IT GO

FIRST MAKE A NEW SCRIPT ABOVE THE MAIN
Code:
class Game_System

attr_accessor :actor_ap
attr_accessor :gain_ap
attr_accessor :gain_skill
attr_accessor :wep_id
attr_accessor :use_ap
alias new_setup initialize

def initialize
   new_setup
   @actor_ap =   [[], [], [], []]
   @gain_skill = [[], [], [], []]
   @wep_id =     [[], [], [], []]
   @gain_ap =    [[], [], [], []]
   @use_ap =     [0, 0, 0, 0]
   for i in 0...4
     @gain_ap[i].fill(0, 0...150)
   end
end
end


class AP_SYSTEM
  
   def get_ap_skill
     for i in 1...$data_weapons.size
        for j in 0...$game_party.actors.size
           @actor = $game_party.actors[j]
             wepon = $data_weapons[i]
           if @actor.equippable?(wepon)
              wepon_name = wepon.name
              if wepon_name.include?("{")
               delete_chr = wepon_name.index("{")
                 str = wepon_name.slice!(delete_chr + 1, wepon_name.size - 1)
                 str.slice!(",")
                 value = str.split('')
                 wepon_name.slice!("{")
                 $game_system.wep_id[j].push(i)
                 $game_system.actor_ap[j].push(value[0].to_i)
                 $game_system.gain_skill[j].push(value[1].to_i)
               end
             end
           end
         end
       end
          
          def check_and_learn
           for i in 0...$game_party.actors.size
             @actor = $game_party.actors[i]
              if $game_system.wep_id[i] != nil
                for k in 0...$game_system.wep_id[i].size
                 wp =  $game_system.wep_id[i][k]
                 ap =  $game_system.actor_ap[i][k]
                 aval_ap = $game_system.gain_ap[i][k]
                  wepon = $data_weapons[wp]
                  skill = $game_system.gain_skill[i][k]
                      unless aval_ap >= ap
                       if @actor.weapon_id == wepon.id
                          @actor.learn_skill(skill)
                        elsif @actor.weapon_id != wepon.id
                          @actor.forget_skill(skill)
                        end
                      else
                         @actor.learn_skill(skill)
                    end
                  end
                end
              end
            end
            
        end#end of class



THEN GO TO WINDOW_EQUIPLEFT AND ADD THIS
Code:
self.contents.draw_text(80, 0, 250, 32, "AP:   " + String($game_system.use_ap[@actor.id - 1]))


IN THE DEF REFRESH


THEN GO TO THE WINDOW_EQUIPRIGHT AND REPLACE

Code:
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)


with

Code:
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon + " Ap = " + String($game_system.gain_ap[@actor.id - 1][@data[0].id]))

now replace you entire scene_equip with this one, if you have custom equip system, then just copy the part that i put edit to your script

Code:
#==============================================================================
# â–�  Scene_Equip
#------------------------------------------------------------------------------
#  装備画��処� を行� クラス��。
#==============================================================================

class Scene_Equip
#--------------------------------------------------------------------------
# � オブジェクト�期化
#     actor_index : アクターインデックス
#     equip_index : 装備インデックス
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
   @actor_index = actor_index
   @equip_index = equip_index
end
#--------------------------------------------------------------------------
# � メイン処�
#--------------------------------------------------------------------------
def main
   # アクターをå?–å¾—
#  if $actor
  # @actor = $game_party.actors[$actor]
#else
   @actor = $game_party.actors[@actor_index]
#end
#EDIT
   @equip_ap = Window_Command.new(150, ["Equip AP"])
   @equip_ap.x = 150
   @equip_ap.y = 180
   @equip_ap.z = 99999
   @equip_ap.back_opacity = 180
   @equip_ap.visible = false
   @equip_ap.active = false
   #EDIT
   # ウィンドウを作æˆ?
   @help_window = Window_Help.new
   @left_window = Window_EquipLeft.new(@actor)
   @right_window = Window_EquipRight.new(@actor)
   @item_window1 = Window_EquipItem.new(@actor, 0)
   @item_window2 = Window_EquipItem.new(@actor, 1)
   @item_window3 = Window_EquipItem.new(@actor, 2)
   @item_window4 = Window_EquipItem.new(@actor, 3)
   @item_window5 = Window_EquipItem.new(@actor, 4)
   # ヘルプウィンドウを関連ä»� ã?‘
   @right_window.help_window = @help_window
   @item_window1.help_window = @help_window
   @item_window2.help_window = @help_window
   @item_window3.help_window = @help_window
   @item_window4.help_window = @help_window
   @item_window5.help_window = @help_window
   # カーソルä½?置を設定
   @right_window.index = @equip_index
   refresh
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーãƒ� ç”»é?¢ã‚’æ›´æ–°
     Graphics.update
     # å…¥å� ›æƒ…å� ±ã‚’æ›´æ–°
     Input.update
     # フレーãƒ� æ›´æ–°
     update
     # ç”»é?¢ã?Œåˆ‡ã‚� 替ã‚?ã?£ã?Ÿã‚‰ãƒ«ãƒ¼ãƒ—を中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @help_window.dispose
   @left_window.dispose
   @right_window.dispose
   @item_window1.dispose
   @item_window2.dispose
   @item_window3.dispose
   @item_window4.dispose
   @item_window5.dispose
   @equip_ap.dispose
end
#--------------------------------------------------------------------------
# � リフレッシュ
#--------------------------------------------------------------------------
def refresh
   # アイãƒ� ãƒ� ウィンドウã?®å?¯è¦–ç� ¶æ…‹è¨­å®š
   @item_window1.visible = (@right_window.index == 0)
   @item_window2.visible = (@right_window.index == 1)
   @item_window3.visible = (@right_window.index == 2)
   @item_window4.visible = (@right_window.index == 3)
   @item_window5.visible = (@right_window.index == 4)
   # ç?¾åœ¨è£…備中ã?®ã‚¢ã‚¤ãƒ� ãƒ� ã‚’å?–å¾—
   item1 = @right_window.item
   # ç?¾åœ¨ã?®ã‚¢ã‚¤ãƒ� ãƒ� ウィンドウを @item_window ã?«è¨­å®š
   case @right_window.index
   when 0
     @item_window = @item_window1
   when 1
     @item_window = @item_window2
   when 2
     @item_window = @item_window3
   when 3
     @item_window = @item_window4
   when 4
     @item_window = @item_window5
   end
   # ライトウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ
   if @right_window.active
     # 装備変更後ã?®ãƒ‘ラメータを消去
     @left_window.set_new_parameters(nil, nil, nil)
   end
   # アイãƒ� ãƒ� ウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ
   if @item_window.active
     # ç?¾åœ¨é?¸æ� žä¸­ã?®ã‚¢ã‚¤ãƒ� ãƒ� ã‚’å?–å¾—
     item2 = @item_window.item
     # 装備を変更
     last_hp = @actor.hp
     last_sp = @actor.sp
     @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
     # 装備変更後ã?®ãƒ‘ラメータをå?–å¾—
     new_atk = @actor.atk
     new_pdef = @actor.pdef
     new_mdef = @actor.mdef
     # 装備を戻ã?™
     @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
     @actor.hp = last_hp
     @actor.sp = last_sp
     # レフトウィンドウã?«æ??ç”»
     @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
   end
end
#--------------------------------------------------------------------------
# � フレー� 更新
#--------------------------------------------------------------------------
def update
   # ウィンドウを更新
   @left_window.update
   @right_window.update
   @item_window.update
   refresh
   # ライトウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ: update_right を呼ã?¶
   if @right_window.active
     update_right
     return
   end
   # アイãƒ� ãƒ� ウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ: update_item を呼ã?¶
   if @item_window.active
     update_item
     return
   end
  
   if @equip_ap.active
     update_ap
     return
   end
end
#--------------------------------------------------------------------------
# â—? フレーãƒ� æ›´æ–° (ライトウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ)
#--------------------------------------------------------------------------
def update_right
   # B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::B)
     # キャンセル SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.cancel_se)
     # メニュー画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
     $scene = Scene_Menu.new(2)
     return
   end
   #EDIT
   if Input.trigger?(Input::X)
         case @right_window.index
           when 0
             if @right_window.item != nil
             @right_window.active = false
             @equip_ap.visible = true
             @equip_ap.active = true
             $game_system.se_play($data_system.decision_se)
           else
             $game_system.se_play($data_system.buzzer_se)
            # return
           end
             return
           end
         end
         #EDIT
   # C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::C)
     # 装備固定ã?®å� ´å?ˆ
     if @actor.equip_fix?(@right_window.index)
       # ブザー SE ã‚’æ¼”å¥?
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 決定 SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.decision_se)
     # アイãƒ� ãƒ� ウィンドウをアクãƒ� ィブ化
     @right_window.active = false
     @item_window.active = true
     @item_window.index = 0
     return
   end
   # R ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::R)
     # カーソル SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.cursor_se)
     # 次ã?®ã‚¢ã‚¯ã‚¿ãƒ¼ã?¸
     @actor_index += 1
     @actor_index %= $game_party.actors.size
     # 別ã?®è£…備画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
     $scene = Scene_Equip.new(@actor_index, @right_window.index)
     return
   end
   # L ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::L)
     # カーソル SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.cursor_se)
     # å‰?ã?®ã‚¢ã‚¯ã‚¿ãƒ¼ã?¸
     @actor_index += $game_party.actors.size - 1
     @actor_index %= $game_party.actors.size
     # 別ã?®è£…備画é?¢ã?«åˆ‡ã‚� 替ã?ˆ
     $scene = Scene_Equip.new(@actor_index, @right_window.index)
     return
   end
end
#--------------------------------------------------------------------------
# â—? フレーãƒ� æ›´æ–° (アイãƒ� ãƒ� ウィンドウã?Œã‚¢ã‚¯ãƒ� ィブã?®å� ´å?ˆ)
#--------------------------------------------------------------------------
def update_item
   # B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::B)
     # キャンセル SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.cancel_se)
     # ライトウィンドウをアクãƒ� ィブ化
     @right_window.active = true
     @item_window.active = false
     @item_window.index = -1
     return
   end
   # C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
   if Input.trigger?(Input::C)
     # 装備 SE ã‚’æ¼”å¥?
     $game_system.se_play($data_system.equip_se)
     # アイãƒ� ãƒ� ウィンドウã?§ç?¾åœ¨é?¸æ� žã?•ã‚Œã?¦ã?„るデータをå?–å¾—
     item = @item_window.item
     # 装備を変更
     @actor.equip(@right_window.index, item == nil ? 0 : item.id)
     # ライトウィンドウをアクãƒ�� ィブ化
     @right_window.active = true
     @item_window.active = false
     @item_window.index = -1
     # ライトウィンドウã€?アイãƒ� ãƒ� ウィンドウã?®å� …容をå� ?作æˆ?
     @right_window.refresh
     @item_window.refresh
     return
   end
end

#EDIT
def update_ap
   if Input.trigger?(Input::B)
     @right_window.active = true
     @equip_ap.active = false
     @equip_ap.visible = false
     return
   end
  
   if Input.trigger?(Input::C)
     case @equip_ap.index
        when 0
          if $game_system.use_ap[@actor_index] < 1
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          weap_d = @right_window.item
          if @actor.weapon_id == weap_d.id
             $game_system.gain_ap[@actor.id - 1][weap_d.id] += 1
             $game_system.use_ap[@actor.id - 1] -= 1
              $game_system.se_play($data_system.decision_se)
              @right_window.refresh
              @left_window.refresh
           end
         end
         @right_window.active = true
         @equip_ap.active = false
         @equip_ap.visible = false
       end
     end#end of function
     #EDIT
   end



now go to the section in scene_battle 2 that say

Code:
@result_window = Window_BattleResult.new.......


add this below it

Code:
#EDIT
for i in 0...$game_party.actors.size
  $game_system.use_ap[i] += 5
end
#EDIT


then go to scene_map, go to the def update

right after the loop do, inside of the loop do , add this
Code:
@test = AP_SYSTEM.new
     @test.get_ap_skill
     @test.check_and_learn

now for the finally one
go to the scene_menu, add also add this to the def main for it; inside of the main.

Code:
@test = AP_SYSTEM.new
     @test.get_ap_skill
     @test.check_and_learn




INSTRUCTION:. when you go to the equip menu, if you press A, a window will pop up, that will allow you to add point to a weapon.


syntax, add this beside the name of your weapon

ex
Flamesword{9,6

that mean that
when you equip flamesword, you will learn the skill with the id of six. the nine is the number that you need to fill your ap to before you can master the skill

so, the first value is the required ap to master a skill, the second values is the skill id

note, when you add {#,# to a weapon name, do put space like this

firesword{9, 6 # you can see that there is a space right after the "," before the 6. doing that will read the information of the ap wrong, if you want to make this available for armors and items too, just change the part that says $data_weapons to $data_armors or items, not you have to know what you doing to do so. you will have to edit other place before you can add items and armor, hope you enjoy it.
}


Messages In This Thread
AP SYSTEM - by dragonslayer - 06-12-2005, 01:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Caldaron's Time System Caldaron 0 3,107 11-05-2006, 01:00 PM
Last Post: Caldaron
  Lives System Constance 0 2,565 08-10-2006, 01:00 PM
Last Post: Constance
  Level Up system Jimmie 0 2,634 07-24-2006, 01:00 PM
Last Post: Jimmie
  Equipment Scrolling System Legacy 0 2,487 05-12-2006, 01:00 PM
Last Post: Legacy
  Inn & Savepoint System SephirothSpawn 0 2,486 03-08-2006, 01:00 PM
Last Post: SephirothSpawn
  New Battle System V1.5 (Added Side View) Guedez 0 2,807 01-12-2006, 01:00 PM
Last Post: Guedez
  Slipknot Advance Message System Sheol 0 2,664 01-02-2006, 01:00 PM
Last Post: Sheol
  Guedez's Atrubutes Select System V2.1 Guedez 0 2,813 12-09-2005, 01:00 PM
Last Post: Guedez
  My own Message System Sheol 0 2,616 11-22-2005, 01:00 PM
Last Post: Sheol
  ToP food system Jimmie 0 2,428 10-04-2005, 01:00 PM
Last Post: Jimmie



Users browsing this thread: 1 Guest(s)