hướng dẫn mấy bạn code tạo battle system sử dụng thanh thời gian ATB (giống dòng FF)

Thảo luận trong 'Game Development' bắt đầu bởi >VoDich<, 18/4/05.

  1. >VoDich<

    >VoDich< Legend of Zelda

    Tham gia ngày:
    26/1/05
    Bài viết:
    919
    Nơi ở:
    Can Tho
    thấy mọi người ko thích kiểu battle system của RPGXP nên tui mạo mụi
    hướng dẫn mấy bạn code tạo battle system sử dụng thanh thời gian ATB (giống dòng FF)
    ai biết rùi thì thui, ai chưa biết cứ nhào dzô mà vọc thử cho biết.
    bắt đầu thui:
    mở Script Editor lên
    tạo 1 script mới tên là Animated_BattleSprite script này tạo sprite chuyển động cho monster và hero khi đánh trận, chứ ko chỉ là hình đứng yên như RPGXP.
    trong script này các bạn copy đọan mã sau paste vào:
    Mã:
     #begin
    class Animated_Sprite < RPG::Sprite
    #--------------------------------------------------------------------------
    # tạo variable mới
    #--------------------------------------------------------------------------
    attr_accessor :frames # số frames của sprite
    attr_accessor :delay # tốc độ hiển thị giữa 2 khung hình
    attr_accessor :frame_width # chiều rộng của mỗi frame 
    attr_accessor :frame_height # chiều cao của mỗi frame
    attr_accessor : offset_x # x
    attr_accessor : offset_y # y
    attr_accessor :current_frame # frame chuyển động hiện tại
    attr_accessor :moving # tạo sự di chuyển khi move = 1 giá trị nào đó
     
    #--------------------------------------------------------------------------
    # 
    # 
    #--------------------------------------------------------------------------
    def initialize(viewport = nil)
    super(viewport)
    @frame_width, @frame_height = 0, 0
    change 
    @old = Graphics.frame_count 
    @goingup = true 
    @once = false 
    @animated = true 
    end
     
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    def change(frames = 0, delay = 10, offx = 0, offy = 0,
    startf = 0, once = false)
    @frames = frames
    @delay = delay
    @offset_x, @offset_y = offx, offy
    @current_frame = startf
    @once = once
    x = @current_frame * @frame_width + @offset_x
    self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
    @goingup = true
    @animated = true
    end
     
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    def update
    super
    if self.bitmap != nil and delay(@delay) and @animated
    x = @current_frame * @frame_width + @offset_x
    self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
    @current_frame = (@current_frame + 1) unless @frames == 0
    @animated = false if @current_frame == @frames and @once
    @current_frame %= @frames
    end
    end
     
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    def move(x, y, speed = 1, delay = 5)
    @destx = x
    @desty = y
    @move_speed = speed
    @move_delay = delay
    @move_old = Graphics.frame_count
    @moving = true
    end
     
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    def update_move
    return unless @moving
    movinc = @move_speed == 0 ? 1 : @move_speed
    if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
    self.x += movinc if self.x < @destx
    self.x -= movinc if self.x > @destx
    self.y += movinc if self.y < @desty
    self.y -= movinc if self.y > @desty
    @move_old = Graphics.frame_count
    end
    if @move_speed > 1 
    self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
    (@destx - self.x).abs <= @move_speed
    self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
    (@desty - self.y).abs <= @move_speed
    end
    if self.x == @destx and self.y == @desty
    @moving = false
    end
    end
     
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    def delay(frames)
    update_move
    if (Graphics.frame_count - @old >= frames)
    @old = Graphics.frame_count
    return true
    end
    return false
    end
    end
    #end
    [b]sau đó tạo script mới thứ 2 đặt tên là Battle_Animation script làm cho monster và hero di chuyển khi óanh nhau chứ ko đứng yên nữa. (script này có hướng dẫn khá kĩ = english các bạn chịu khó tìm hiểu)[/b]
    #begin
    #=============================================================================
    #
    # here we go...
    # this makes the script very easy to implement
    # just add a new script above the "Main" script
    # and insert this whole thing in there
    #
    # as you can see the sprite changing code is from the japanese script
    # so the credits for the sprite changin goes to them....
    # i edit it a little so it can show more sprites and sprite animations
    # and added some other stuff... the next things are player movement...
    #
    #
    #
    # i got the battler changing script in this script...
    # the credits for this goes to the guy who made this...
    #
    # ▼▲▼ XRXS11. 戦闘・バトラーモーション ver.0 ▼▲▼
    #
    # since this isnt used anymore... it isnt need for credit anymore...
    # but i'll let it here since it helped me a lot...
    #
    #
    # as for the ideas... missy provided me with realy good ideas 
    # that helped me alot when i didnt find a way to some of these features...
    #
    # here one more Credit to place...
    # its RPG's script...
    # not the whole thing here... 
    # but some snipplet you'll know witch one when read the comments
    # 
    #
    # if you want some more explaines about this script...
    # the most stuff are commented... but if you still have questions or
    # sugestions then you can contact me
    #
    # how or where you can contact me...
    # at the [url="http://www.rmxp.net/"]http://www.rmxp.net[/url] forum via pm, email: [email="[email protected]"][email protected][/email]
    # or via AIM: cych4n or ICQ: 73130840
    #
    # remember this is still in testing phase...
    # and i'm trying to work on some other additions... like character movements...
    # but that wont be added now... couse i need to figure it out first...
    #
    #
    #
    # oh hehe.... before i forget...
    # sorry for the bad english... ^-^''''
    #
    #
    #==============================================================================
    #
    # here i'm going to tell you what names you need to give for your chara 
    # battle sprites....
    #
    # ok... here... since i'm using RPG's movement script...
    # there are a lot of changes... 
    # 
    # when you look at the script you'll find line with "pose(n)" or "enemy_pose(n)"
    # since i want my sprites have different sprites... i added one more option
    # to these...
    # so now if you add a number after the n (the n stands for witch sprite is used)
    # fo example 8... ("pose(4, 8)") this will tell the script that the 4th animation
    # have 8 frames...
    # pose is used for the player... and enemy_pose for the enemy...
    # there is nothing more to this...
    # i used my old sprite numbers... (this time in only one sprite...)
    #
    # explains about the animation sprites... (the digits)
    #
    #
    # 0 = move (during battle)
    # 1 = standby
    # 2 = defend
    # 3 = hit (being attacked)
    # 4 = attack
    # 5 = skill use
    # 6 = dead
    # 7 = winning pose... this idea is from RPG....
    # 
    #
    # of course this is just the begining of the code... 
    # so more animations can be implemented...
    # but for now this should be enough...
    # 
    # alot has changed here... and now it looks like it is done...
    # of course the fine edit needs to be done so it looks and works great with your
    # game too...
    #
    #
    #
    # 1st character movement... done
    # 2nd character movement during attack... done
    # 3rd character apears at the enemy while attacking... done
    # 
    # 4th enemies movement... done
    # 5th enemy movement during attack... done
    # 6th enemy apears at the enemy while attacking... done
    #
    # 7th each weapon has its own animation... done
    # 8th each skill has its own animation... done
    #
    #
    #
    # for the ones interisted... my nex project is an Movie player 
    # (that actualy plays avi, mpgs and such... 
    # but dont think this will be done soon... ^-^''
    #
    # but i'll may be try something else before i begin to code that one...
    #==============================================================================
     
     
     
    class Game_Actor < Game_Battler
     
    # you dont have to change your game actor to let the characters schows
    # from the side...
    # this will do it for you... ^-^
     
    def screen_x
    if self.index != nil
    return self.index * 40 + 460
    else
    return 0
    end
    end
     
    def screen_y
    return self.index * 20 + 220
    end
     
    def screen_z
    if self.index != nil
    return self.index
    else
    return 0
    end
    end
    end
     
     
    # RPG's snipplet... 
    class Spriteset_Battle
    attr_accessor :actor_sprites
    attr_accessor :enemy_sprites
     
     
    alias original_initialize initialize
    def initialize
    #@start_party_number = $game_party.actors.size
    # ビューポートを作成
    @viewport0 = Viewport.new(0, 0, 640, 320)
    @viewport1 = Viewport.new(0, 0, 640, 320)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport4 = Viewport.new(0, 0, 640, 480)
    @viewport1.z = 50
    @viewport2.z = 50
    @viewport3.z = 200
    @viewport4.z = 5000
     
    @battleback_sprite = Sprite.new(@viewport0)
     
    @enemy_sprites = []
    for enemy in $game_troop.enemies#.reverse
    @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
     
    @actor_sprites = []
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
     
    @weather = RPG::Weather.new(@viewport1)
    @picture_sprites = []
    for i in 51..100
    @picture_sprites.push(Sprite_Picture.new(@viewport3,
    $game_screen.pictures[i]))
    end
    @timer_sprite = Sprite_Timer.new
    update
    end
     
     
     
    alias original_update update
    def update
    @viewport1.z = 50 and @viewport2.z = 51 if $actor_on_top == true
    @viewport1.z = 51 and @viewport2.z = 50 if $actor_on_top == false
    original_update
    end
     
    end
    # end
     
    #==============================================================================
    # Sprite Battler for the Costum Battle System
    #==============================================================================
    # here we are making some animations and stuff...
    # i know its not the best way...
    # but this is the first working way that i found....
    # this needs propper understanding how the animation works...
    # if you want to change some stuff...
    # in this i'll not explain much couse its realy easy if you know what you do
    # otherwise it will take you time to understand it, but i think the one who 
    # is trying to edit this will know what he/she do... ^-^
    #
    #
    # 
    # here i'll completely replace the "Sprite_Battler" class...
    # so if you've changed something in there you need to change it here as well
    # (i think... i didnt tested it... so its up to you)
    # i'll mark the stuff i added just with --> #
    # something that need to be explained have a comment...
    # but its not all commented...
    # so if you dont know what it means or you just want to know why it is there and 
    # what it does then you need to contact me or anyone who understand this... ^-^
    # how you can contact me see above... at the top of this script...
     
     
    class Sprite_Battler < Animated_Sprite
     
    attr_accessor :battler
    attr_reader :index
    attr_accessor :target_index
    attr_accessor :frame_width
     
     
    def initialize(viewport, battler = nil)
    super(viewport)
    @battler = battler
    @pattern_b = 0 #
    @counter_b = 0 #
    @index = 0 #
    @frame_width, @frame_height = 116, 100
    # start sprite
    @battler.is_a?(Game_Enemy) ? enemy_pose(1) : pose(1)
     
    @battler_visible = false
    if $target_index == nil
    $target_index = 0
    end
    end
     
    def index=(index) #
    @index = index # 
    update # 
    end # 
     
    def dispose
    if self.bitmap != nil
    self.bitmap.dispose
    end
    super
    end
     
    def enemy #
    $target_index += $game_troop.enemies.size
    $target_index %= $game_troop.enemies.size
    return $game_troop.enemies[$target_index] #
    end #
     
    def actor #
    $target_index += $game_party.actors.size
    $target_index %= $game_party.actors.size
    return $game_party.actors[$target_index] #
    end 
     
    #==============================================================================
    # here is a snipplet from RPG's script...
    # i changed only to lines from this...
    #
    # here you can add more sprite poses... if you have more... ^-^
    #==============================================================================
    def pose(number, frames = 10)
    case number
    when 0 # run
    change(frames, 5, 0, 0, 0)
    when 1 # standby
    change(frames, 5, 0, @frame_height)
    when 2 # defend
    change(frames, 5, 0, @frame_height * 2)
    when 3 # Hurt, loops
    change(frames, 5, 0, @frame_height * 3)
    when 4 # attack no loop
    change(frames, 5, 0, @frame_height * 4, 0, true)
    when 5 # skill
    change(frames, 5, 0, @frame_height * 5)
    when 6 # death
    change(frames, 5, 0, @frame_height * 6)
    when 7 # no sprite
    change(frames, 5, 0, @frame_height * 7)
    #when 8
    # change(frames, 5, 0, @frame_height * 9)
    # ...etc.
    else
    change(frames, 5, 0, 0, 0)
    end
    end
     
    #--------------------------------------------------------------------------
    # - Change the battle pose for an enemy
    # number : pose' number
    #--------------------------------------------------------------------------
    def enemy_pose(number ,enemy_frames = 10)
    case number
    when 0 # run
    change(enemy_frames, 5, 0, 0, 0)
    when 1 # standby
    change(enemy_frames, 5, 0, @frame_height)
    when 2 # defend
    change(enemy_frames, 5, 0, @frame_height * 2)
    when 3 # Hurt, loops
    change(enemy_frames, 5, 0, @frame_height * 3)
    when 4 # attack
    change(enemy_frames, 5, 0, @frame_height * 4, 0, true)
    when 5 # skill
    change(enemy_frames, 5, 0, @frame_height * 5)
    when 6 # death
    change(enemy_frames, 5, 0, @frame_height * 6)
    when 7 # no sprite
    change(enemy_frames, 5, 0, @frame_height * 7)
    # ...etc.
    else
    change(enemy_frames, 5, 0, 0, 0)
    end
    end
    #==============================================================================
    # sniplet end...
    #============================================================================== 
     
     
    def update
    super
     
    if @battler == nil 
    self.bitmap = nil 
    loop_animation(nil) 
    return 
    end 
    if @battler.battler_name != @battler_name or
    @battler.battler_hue != @battler_hue
     
    @battler_name = @battler.battler_name
    @battler_hue = @battler.battler_hue
    self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
    @width = bitmap.width
    @height = bitmap.height
    self.ox = @frame_width / 2
    self.oy = @frame_height
     
    if @battler.dead? or @battler.hidden
    self.opacity = 0
    end
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
    end
     
    if @battler.damage == nil and
    @battler.state_animation_id != @state_animation_id
    @state_animation_id = @battler.state_animation_id
    loop_animation($data_animations[@state_animation_id])
    end
     
    if @battler.is_a?(Game_Actor) and @battler_visible
    if $game_temp.battle_main_phase
    self.opacity += 3 if self.opacity < 255
    else
    self.opacity -= 3 if self.opacity > 207
    end
    end
     
    if @battler.blink
    blink_on
    else
    blink_off
    end
     
    unless @battler_visible
    if not @battler.hidden and not @battler.dead? and
    (@battler.damage == nil or @battler.damage_pop)
    appear
    @battler_visible = true
    end
    if not @battler.hidden and
    (@battler.damage == nil or @battler.damage_pop) and
    @battler.is_a?(Game_Actor)
    appear
    @battler_visible = true
    end
    end
    if @battler_visible
    if @battler.hidden
    $game_system.se_play($data_system.escape_se)
    escape
    @battler_visible = false
    end
    if @battler.white_flash
    whiten
    @battler.white_flash = false
    end
    if @battler.animation_id != 0
    animation = $data_animations[@battler.animation_id]
    animation(animation, @battler.animation_hit)
    @battler.animation_id = 0
    end
    if @battler.damage_pop
    damage(@battler.damage, @battler.critical)
    @battler.damage = nil
    @battler.critical = false
    @battler.damage_pop = false
    end
    if @battler.damage == nil and @battler.dead?
    if @battler.is_a?(Game_Enemy)
    $game_system.se_play($data_system.enemy_collapse_se)
    collapse
    @battler_visible = false
    else
    $game_system.se_play($data_system.actor_collapse_se) unless @dead
    @dead = true
    pose(6)
    end
    else
    @dead = false
    end
    end #
    end
    end
     
     
    #==============================================================================
    # Scene_Battle Costum Battle System
    #==============================================================================
     
    class Scene_Battle
     
     
    def update_phase4
    case @phase4_step
    when 1
    update_phase4_step1
    when 2
    update_phase4_step2
    when 3
    update_phase4_step3
    when 4
    update_phase4_step4
    when 5
    update_phase4_step5
    when 6
    update_phase4_step6
    when 7
    update_phase4_step7
    end
    end
     
     
    def make_basic_action_result
     
    if @active_battler.is_a?(Game_Actor)
    $actor_on_top = true
    elsif @active_battler.is_a?(Game_Enemy)
    $actor_on_top = false
    end
     
    if @active_battler.current_action.basic == 0
    #============================================================================
    # WEAPONS START...
    #============================================================================
    # 
    #================================= Different Weapons with different animations
    #
    # this is quite simple as you can see...
    # if you want to add a weapon to the animation list then look at the script below...
    # and i hope you'll find out how this works...
    #
    #
    # if not...
    # here is the way...
    # first thing... 
    # just copy and paste "elseif @active_battler_enemy.weapon_id == ID..." 
    # just after the last @weapon_sprite....
    # 
    # here the ID is you need to look in you game databse the number that stands before 
    # your weapon name is the ID you need to input here...
    #
    # same thing goes for the monster party... ^-^
    # monster normaly dont need more sprites for weapons....
    #
    # if you want to use more... then replace the "@weapon_sprite_enemy = 4"
    # with these lines... (but you need to edit them)
    #
    # if @active_battler.weapon_id == 1 # <-- weapon ID number
    # @weapon_sprite_enemy = 4 # <-- battle animation
    # elsif @active_battler.weapon_id == 5 # <-- weapon ID number
    # @weapon_sprite_enemy = 2 # <-- battle animation
    # elsif @active_battler.weapon_id == 9 # <-- weapon ID number
    # @weapon_sprite_enemy = 0 # <-- battle animation
    # elsif @active_battler.weapon_id == 13 # <-- weapon ID number
    # @weapon_sprite_enemy = 6 # <-- battle animation
    # else
    # @weapon_sprite_enemy = 4
    # end
    # 
    #================================= END
     
    if @active_battler.is_a?(Game_Actor)
    if @active_battler.weapon_id == 1 # <-- weapon ID number
    @weapon_sprite = 4 # <-- battle animation
    elsif @active_battler.weapon_id == 5 # <-- weapon ID number
    @weapon_sprite = 2 # <-- battle animation
    elsif @active_battler.weapon_id == 9 # <-- weapon ID number
    @weapon_sprite = 0 # <-- battle animation
    elsif @active_battler.weapon_id == 13 # <-- weapon ID number
    @weapon_sprite = 6 # <-- battle animation
    else
    @weapon_sprite = 4
    end
     
    # monster section is here... ^-^
     
    else# @active_battler.is_a?(Game_Enemy)
    @weapon_sprite_enemy = 4
    end
     
    #
    #=============================================================================
    # WEAPONS END....
    #=============================================================================
     
     
    @animation1_id = @active_battler.animation1_id
    @animation2_id = @active_battler.animation2_id
    if @active_battler.is_a?(Game_Enemy)
    if @active_battler.restriction == 3
    target = $game_troop.random_target_enemy
    elsif @active_battler.restriction == 2
    target = $game_party.random_target_actor
    else
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    end
    #======== here is the setting for the movement & animation...
    x = target.screen_x - 32
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
    @spriteset.enemy_sprites[@active_battler.index]\
    .move(x, target.screen_y, 10)
    #========= here if you look at the RPG's movement settings you'll see
    #========= that he takes the number 40 for the speed of the animation... 
    #========= i thing thats too fast so i settet it down to 10 so looks smoother...
    end
    if @active_battler.is_a?(Game_Actor)
    if @active_battler.restriction == 3
    target = $game_party.random_target_actor
    elsif @active_battler.restriction == 2
    target = $game_troop.random_target_enemy
    else
    index = @active_battler.current_action.target_index
    target = $game_troop.smooth_target_enemy(index)
    end
    #======= the same thing for the player... ^-^
    x = target.screen_x + 32
    @spriteset.actor_sprites[@active_battler.index].pose(0)
    @spriteset.actor_sprites[@active_battler.index]\
    .move(x, target.screen_y, 10)
    end
    @target_battlers = [target]
    for target in @target_battlers
    target.attack_effect(@active_battler)
    end
    return
    end
    if @active_battler.current_action.basic == 1
    if @active_battler.is_a?(Game_Actor)
    @spriteset.actor_sprites[@active_battler.index].pose(2) #defence
    else
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(2) #defence
    end
    @help_window.set_text($data_system.words.guard, 1)
    return
    end
    if @active_battler.is_a?(Game_Enemy) and
    @active_battler.current_action.basic == 2
    @help_window.set_text("Escape", 1)
    @active_battler.escape
    return
    end
    if @active_battler.current_action.basic == 3
    $game_temp.forcing_battler = nil
    @phase4_step = 1
    return
    end
     
    if @active_battler.current_action.basic == 4
    if $game_temp.battle_can_escape == false
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $game_system.se_play($data_system.decision_se)
    update_phase2_escape
    return
    end
    end
    #--------------------------------------------------------------------------
    # skill aktion...
    #--------------------------------------------------------------------------
    def make_skill_action_result
    @skill = $data_skills[@active_battler.current_action.skill_id]
    unless @active_battler.current_action.forcing
    unless @active_battler.skill_can_use?(@skill.id)
    $game_temp.forcing_battler = nil
    @phase4_step = 1
    return
    end
    end
    @active_battler.sp -= @skill.sp_cost
    @status_window.refresh
    @help_window.set_text(@skill.name, 1)
     
    #=============================================================================
    # SKILL SPRITES START
    #=============================================================================
    # this one is the same as the one for the weapons...
    # for the one who have this for the first time
    # look at the script i hope it is easy to understand...
    # 
    # the other one that have the earlier versions of this script they dont need explenation
    # ... i think....
    # the think that changed is the line where the animation ID is given to the sprite...
    # the number after the "pose" is the animation ID... it goes for every other animation as well..
    # if you have an animation for a skill that have more frames... 
    # then just insert the number of frames after the first number...
    # so it looks like this.... "pose(5, 8)" <-- 5 is the animation... 
    # 8 is the max frame (that means your animation have 8 frames...) ^-^
     
    if @active_battler.is_a?(Game_Actor)
    if @skill.name == "Heal" # <-- first skill name
    @spriteset.actor_sprites[@active_battler.index].pose(5) # <-- sprite number
    elsif @skill.name == "Cross Cut" # <-- secound skill name
    @spriteset.actor_sprites[@active_battler.index].pose(6) # <-- sprite number
    elsif @skill.name == "Fire" # <-- third skill name
    @spriteset.actor_sprites[@active_battler.index].pose(6) # <-- sprite number
    end
    else
    if @skill.name == "Heal" # <-- first skill name
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(5) # <-- sprite number
    elsif @skill.name == "Cross Cut" # <-- secound skill name
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(6) # <-- sprite number
    elsif @skill.name == "Fire" # <-- third skill name
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(6) # <-- sprite number
    end
    end
    #=============================================================================
    # SKILL SPRITES END
    #=============================================================================
     
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    @common_event_id = @skill.common_event_id
    set_target_battlers(@skill.scope)
    for target in @target_battlers
    target.skill_effect(@active_battler, @skill)
    end
    end
    #--------------------------------------------------------------------------
    # how here we make the item use aktions
    #--------------------------------------------------------------------------
    def make_item_action_result
    # sorry i didnt work on this...
    # couse i dont have a sprite that uses items....
    # so i just added the standby sprite here...
    # when i get more time for this i'll try what i can do for this one... ^-^
    # its the same as the ones above...
    if @active_battler.is_a?(Game_Actor)
    @spriteset.actor_sprites[@active_battler.index].pose(1)
    else
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
    end
     
    @item = $data_items[@active_battler.current_action.item_id]
    unless $game_party.item_can_use?(@item.id)
    @phase4_step = 1
    return
    end
    if @item.consumable
    $game_party.lose_item(@item.id, 1)
    end
    @help_window.set_text(@item.name, 1)
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    @common_event_id = @item.common_event_id
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    set_target_battlers(@item.scope)
    for target in @target_battlers
    target.item_effect(@item)
    end
    end
     
    #==============================================================================
    # here again.... snipplet from RPG's script
    #==============================================================================
     
     
    # this one here is for the winning pose...
    # if you happen to use my old costum level script then you need to add the 
    # marked line to you "def start_phase5" in "Scene_Battle 2" and delete this one...
    # the -> =*****= 
    # marks the end where you need to delete...
    # and -> {=====}
    # marks the line you need to copy and paste in the other one...
    # you need to add it at the same position...
     
    def start_phase5
    @phase = 5
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    exp = 0
    gold = 0
    treasures = []
    for enemy in $game_troop.enemies
    unless enemy.hidden
    exp += enemy.exp
    gold += enemy.gold
    if rand(100) < enemy.treasure_prob
    if enemy.item_id > 0
    treasures.push($data_items[enemy.item_id])
    end
    if enemy.weapon_id > 0
    treasures.push($data_weapons[enemy.weapon_id])
    end
    if enemy.armor_id > 0
    treasures.push($data_armors[enemy.armor_id])
    end
    end
    end
    end
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    @spriteset.actor_sprites[i].pose(7) unless actor.dead? # {=====}
    if actor.cant_get_exp? == false
    last_level = actor.level
    actor.exp += exp
    if actor.level > last_level
    @status_window.level_up(i)
    end
    end
    end
    $game_party.gain_gold(gold)
    for item in treasures
    case item
    when RPG::Item
    $game_party.gain_item(item.id, 1)
    when RPG::Weapon
    $game_party.gain_weapon(item.id, 1)
    when RPG::Armor
    $game_party.gain_armor(item.id, 1)
    end
    end
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    @phase5_wait_count = 100
    end
    # =*****= 
     
    #--------------------------------------------------------------------------
    # updating the movement
    # since RPG isnt used to comments... i'll comment it again...
    #--------------------------------------------------------------------------
    def update_phase4_step3
    if @active_battler.current_action.kind == 0 and
    @active_battler.current_action.basic == 0
    # in this one... we have our weapon animations... for player and monster
    if @active_battler.is_a?(Game_Actor)
    @spriteset.actor_sprites[@active_battler.index].pose(@weapon_sprite)
    elsif @active_battler.is_a?(Game_Enemy)
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(@weapon_sprite_enemy)
    end
    end
    if @animation1_id == 0
    @active_battler.white_flash = true
    else
    @active_battler.animation_id = @animation1_id
    @active_battler.animation_hit = true
    end
    @phase4_step = 4
    end
     
    def update_phase4_step4
    # this here is for the hit animation...
    for target in @target_battlers
    if target.is_a?(Game_Actor) and !@active_battler.is_a?(Game_Actor)
    if target.guarding?
    @spriteset.actor_sprites[target.index].pose(2)
    else
    @spriteset.actor_sprites[target.index].pose(3)
    end
    elsif target.is_a?(Game_Enemy) and !@active_battler.is_a?(Game_Enemy)
    if target.guarding?
    @spriteset.enemy_sprites[target.index].enemy_pose(2)
    else
    @spriteset.enemy_sprites[target.index].enemy_pose(3)
    end
    end
    target.animation_id = @animation2_id
    target.animation_hit = (target.damage != "Miss")
    end
    @wait_count = 8
    @phase4_step = 5
    end
     
    def update_phase4_step5
    if @active_battler.hp > 0 and @active_battler.slip_damage?
    @active_battler.slip_damage_effect
    @active_battler.damage_pop = true
    end
     
    @help_window.visible = false
    @status_window.refresh
    # here comes the guard animations....
    if @active_battler.is_a?(Game_Actor)
    @spriteset.actor_sprites[@active_battler.index].pose(1)
    else
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
    end
    for target in @target_battlers
    if target.damage != nil
    target.damage_pop = true
    if @active_battler.is_a?(Game_Actor)
    @spriteset.actor_sprites[@active_battler.index].pose(1)
    else
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
    end
    end
    end
    @phase4_step = 6
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
    #--------------------------------------------------------------------------
    def update_phase4_step6
     
    # here we are asking if the player is dead and is a player or an enemy...
    # these lines are for the running back and standby animation....
    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
    @spriteset.actor_sprites[@active_battler.index]\
    .move(@active_battler.screen_x, @active_battler.screen_y, 20)
    @spriteset.actor_sprites[@active_battler.index].pose(0)
    elsif !@active_battler.dead?
    @spriteset.enemy_sprites[@active_battler.index]\
    .move(@active_battler.screen_x, @active_battler.screen_y, 20)
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
    end
    for target in @target_battlers
    if target.is_a?(Game_Actor) and !target.dead?
    @spriteset.actor_sprites[target.index].pose(1)
    elsif !target.dead?
    @spriteset.enemy_sprites[target.index].enemy_pose(1)
    end
    end
    $game_temp.forcing_battler = nil
    if @common_event_id > 0
    common_event = $data_common_events[@common_event_id]
    $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    @phase4_step = 7
    end
     
    def update_phase4_step7
     
    # here we are asking if the player is dead and is a player or an enemy...
    # these lines are for the running back and standby animation....
    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
    @spriteset.actor_sprites[@active_battler.index].pose(1)
    elsif !@active_battler.dead?
    @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
    end
     
    $game_temp.forcing_battler = nil
    if @common_event_id > 0
    common_event = $data_common_events[@common_event_id]
    $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    @phase4_step = 1
    end
     
    # this one is an extra... without this the animation whill not work correctly...
     
    def update
    if $game_system.battle_interpreter.running?
    $game_system.battle_interpreter.update
    if $game_temp.forcing_battler == nil
    unless $game_system.battle_interpreter.running?
    unless judge
    setup_battle_event
    end
    end
    if @phase != 5
    @status_window.refresh
    end
    end
    end
    $game_system.update
    $game_screen.update
    if $game_system.timer_working and $game_system.timer == 0
    $game_temp.battle_abort = true
    end
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    @spriteset.update
    if $game_temp.transition_processing
    $game_temp.transition_processing = false
    if $game_temp.transition_name == ""
    Graphics.transition(20)
    else
    Graphics.transition(40, "Graphics/Transitions/" +
    $game_temp.transition_name)
    end
    end
    if $game_temp.message_window_showing
    return
    end
    if @spriteset.effect?
    return
    end
    if $game_temp.gameover
    $scene = Scene_Gameover.new
    return
    end
    if $game_temp.to_title
    $scene = Scene_Title.new
    return
    end
    if $game_temp.battle_abort
    $game_system.bgm_play($game_temp.map_bgm)
    battle_end(1)
    return
    end
    if @wait_count > 0
    @wait_count -= 1
    return
    end
     
    # this one holds the battle while the player moves
    for actor in @spriteset.actor_sprites
    if actor.moving
    return
    end
    end
    # and this one is for the enemy... 
    for enemy in @spriteset.enemy_sprites
    if enemy.moving# and $game_system.animated_enemy
    return
    end
    end
     
    if $game_temp.forcing_battler == nil and
    $game_system.battle_interpreter.running?
    return
    end
    case @phase
    when 1
    update_phase1
    when 2
    update_phase2
    when 3
    update_phase3
    when 4
    update_phase4
    when 5
    update_phase5
    end
    end
     
    #==============================================================================
    # end of the snipplet
    # if you want the comments that where here just look at the scene_battle 4... 
    # i added some comments since RPG hasnt add any....
    #==============================================================================
    end
    #end
    
    [b]tạo 1 script mới thứ 3 đặt tên là Hp_Bar script ko quan trọng lắm, nó tạo mấy thanh máu với mp mới đẹp hơn(xem pic), paste đọan code này vào( script này tiếc là phần hướng dẫn tiếng miên :D, mấy bạn cứ cố tìm hiểu dzậy)[/b]
    #begin
    #==============================================================================
    # â– Window_BattleStatus
    #==============================================================================
    class Window_BattleStatus < Window_Base
    #--------------------------------------------------------------------------
    # ● リフレッシュ
    #--------------------------------------------------------------------------
    alias xrxs_bp7_refresh refresh
    def refresh
    if @update_cp_only
    xrxs_bp7_refresh
    return
    end
    # 描写を禁æ&shy;¢ã—ながら戻す
    @draw_ban = true
    xrxs_bp7_refresh
    # 描写の禁æ&shy;¢ã‚’解除
    @draw_ban = false
    # 描写を開始
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    actor_x = i * 160 + 21
    # æ&shy;©è¡Œã‚&shy;ャラグラフィックの描写
    draw_actor_graphic(actor, actor_x - 9, 116)
    # HP/SPメーターの描写
    draw_actor_hp_meter_line(actor, actor_x, 72, 96, 12)
    draw_actor_sp_meter_line(actor, actor_x, 104, 96, 12)
    # HP数値の描写
    self.contents.font.size = 24 # 
    #HP/SP数値の文å&shy;—の大きさ
    self.contents.font.color = actor.hp == 0 ? knockout_color :
    actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    draw_shadow_text(actor_x-2, 58, 96, 24, actor.hp.to_s, 2)
    # SP数値の描写
    self.contents.font.color = actor.sp == 0 ? knockout_color :
    actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    draw_shadow_text(actor_x-2, 90, 96, 24, actor.sp.to_s, 2)
    # 用語「HP」と用語「SP」の描写
    self.contents.font.size = 12 # 
    #用語「HP/SP」の文å&shy;—の大きさ
    self.contents.font.color = system_color # 
    #用語「HP/SP」の文å&shy;—の色
    draw_shadow_text(actor_x, 60, 96, 12, $data_system.words.hp)
    draw_shadow_text(actor_x, 92, 96, 12, $data_system.words.sp)
     
    draw_actor_state(actor, actor_x, 100)
    end
    end
    end
    #==============================================================================
    # â– Window_Base
    #==============================================================================
    class Window_Base < Window
    #--------------------------------------------------------------------------
    # ● HPメーター の描画
    #--------------------------------------------------------------------------
    def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.hp / actor.maxhp
    hp_color_1 = Color.new(255, 0, 0, 192)
    hp_color_2 = Color.new(255, 255, 0, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    end
    #--------------------------------------------------------------------------
    # ● SPメーター の描画
    #--------------------------------------------------------------------------
    def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.sp / actor.maxsp
    hp_color_1 = Color.new( 0, 0, 255, 192)
    hp_color_2 = Color.new( 0, 255, 255, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, 
    Color.new(0, 
    0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    end
    #--------------------------------------------------------------------------
    # ● 名前の描画
    #--------------------------------------------------------------------------
    alias xrxs_bp7_draw_actor_name draw_actor_name
    def draw_actor_name(actor, x, y)
    xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
    end
    #--------------------------------------------------------------------------
    # ● ステートの描画
    #--------------------------------------------------------------------------
    alias xrxs_bp7_draw_actor_state draw_actor_state
    def draw_actor_state(actor, x, y, width = 120)
    xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
    end
    #--------------------------------------------------------------------------
    # ● HP の描画
    #--------------------------------------------------------------------------
    alias xrxs_bp7_draw_actor_hp draw_actor_hp
    def draw_actor_hp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
    end
    #--------------------------------------------------------------------------
    # ● SP の描画
    #--------------------------------------------------------------------------
    alias xrxs_bp7_draw_actor_sp draw_actor_sp
    def draw_actor_sp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
    end
    end
    #==============================================================================
    # ◇ 外部ライブラリ
    #==============================================================================
    class Window_Base
    #--------------------------------------------------------------------------
    # ● ライン描画 by 桜雅 在土
    #--------------------------------------------------------------------------
    def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, 
    end_color = start_color)
    # 描写距離の計算。大きめに直角時の長さ。
    distance = (start_x - end_x).abs + (start_y - end_y).abs
    # 描写開始
    if end_color == start_color
    for i in 1..distance
    x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
    y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
    self.contents.fill_rect(x, y, width, width, start_color)
    end
    else
    for i in 1..distance
    x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
    y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
    r = start_color.red * (distance-i)/distance + end_color.red * 
    i/distance
    g = start_color.green * (distance-i)/distance + end_color.green * 
    i/distance
    b = start_color.blue * (distance-i)/distance + end_color.blue * 
    i/distance
    a = start_color.alpha * (distance-i)/distance + end_color.alpha * 
    i/distance
    self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, 
    a))
    end
    end
    end
     
    #--------------------------------------------------------------------------
    # ● 影文å&shy;—描画 by TOMY
    #--------------------------------------------------------------------------
    def draw_shadow_text(x, y, width, height, string, align = 0)
    # 元の色を保å&shy;˜ã—ておく
    color = self.contents.font.color.dup
    # é»’å&shy;—で影描画
    self.contents.font.color = Color.new(0, 0, 0)
    self.contents.draw_text(x + 2, y + 2, width, height, string, align)
    # 元の色に戻して描画
    self.contents.font.color = color
    self.contents.draw_text(x, y, width, height, string, align)
    end
    end
    #end
    [b]tạo 1 script mới thứ 4 đặt tên là Atp_Bar, script này tạo 1 thanh ATP ( thanh thời gian) như mấy dòng FF dzậy đó. (hướng dẫn cũng vẫn tiếng miên, thông cảm :D)[/b]
    #begin
    # ▼▲▼ XRXS_BP 1. CP制導入 ver..16 ▼▲▼
    # by 桜雅 在土, 和希
     
    #==============================================================================
    # □ カスタマイズポイント
    #==============================================================================
    class Scene_Battle
    # ここに効果音を設定すると、アクターコマンドがポップしたときに効果音を再生
    DATA_SYSTEM_COMMAND_UP_SE = ""
    # 消費CP
    CP_COST_BASIC_ACTIONS = 0 # 攻撃・防御・逃げる・何もしない時の共通消費値
    CP_COST_SKILL_ACTION = 65535 # スキル
    CP_COST_ITEM_ACTION = 65535 # アイテム
    CP_COST_BASIC_ATTACK = 65535 # 攻撃
    CP_COST_BASIC_GUARD = 32768 # 防御
    CP_COST_BASIC_NOTHING = 65535 # なにもしない
    CP_COST_BASIC_ESCAPE = 65535 # 「逃げる」時
    end
    class Scene_Battle_CP
    # ここの 1.0を変えることで↓スピードを変更可能。(数値が高いほど早い)
    # ただし小数点は使用すること。(1の場合も1.0とすること)#Thx - Jack-R
    # 「バトルスピード」
    BATTLE_SPEED = 1.0
    # 「戦闘開始時初期CPの占有率に対する%」
    START_CP_PERCENT = 100
    end
    #==============================================================================
    # ■ Scene_Battle_CP
    #==============================================================================
    class Scene_Battle_CP
    #--------------------------------------------------------------------------
    # ● 公開インスタンス変数
    #--------------------------------------------------------------------------
    attr_accessor :stop # CP加算ストップ
    #----------------------------------------------------------------------------
    # ● オブジェクトの初期化
    #----------------------------------------------------------------------------
    def initialize
    @battlers = []
    @cancel = false
    @stop = false
    @agi_total = 0
    # 配列 count_battlers を初期化
    count_battlers = []
    # エネミーを配列 count_battlers に追加
    for enemy in $game_troop.enemies
    count_battlers.push(enemy)
    end
    # アクターを配列 count_battlers に追加
    for actor in $game_party.actors
    count_battlers.push(actor)
    end
    for battler in count_battlers
    @agi_total += battler.agi
    end
    for battler in count_battlers
    battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
    end
    end
    #----------------------------------------------------------------------------
    # ● CPカウントアップ
    #----------------------------------------------------------------------------
    def update
    # ストップされているならリターン
    return if @stop
    # 
    for battler in $game_party.actors + $game_troop.enemies
    # 行動出来なければ無視
    if battler.dead? == true
    battler.cp = 0
    next
    end
    battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
    end
    end
    #----------------------------------------------------------------------------
    # ● CPカウントの開始
    #----------------------------------------------------------------------------
    def stop
    @cancel = true
    if @cp_thread != nil then
    @cp_thread.join
    @cp_thread = nil
    end
    end
    end
    #==============================================================================
    # ■ Game_Battler
    #==============================================================================
    class Game_Battler
    attr_accessor :now_guarding # 現在防御中フラグ
    attr_accessor :cp # 現在CP
    attr_accessor :slip_state_update_ban # スリップ・ステート自動処理の禁止
    #--------------------------------------------------------------------------
    # ● コマンド入力可能判定
    #--------------------------------------------------------------------------
    alias xrxs_bp1_inputable? inputable?
    def inputable?
    bool = xrxs_bp1_inputable?
    return (bool and (@cp >= 65535))
    end
    #--------------------------------------------------------------------------
    # ● ステート [スリップダメージ] 判定
    #--------------------------------------------------------------------------
    alias xrxs_bp1_slip_damage? slip_damage?
    def slip_damage?
    return false if @slip_state_update_ban
    return xrxs_bp1_slip_damage?
    end
    #--------------------------------------------------------------------------
    # ● ステート自然解除 (ターンごとに呼び出し)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_remove_states_auto remove_states_auto
    def remove_states_auto
    return if @slip_state_update_ban
    xrxs_bp1_remove_states_auto
    end
    end
    #==============================================================================
    # ■ Game_Actor
    #==============================================================================
    class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # ● セットアップ
    #--------------------------------------------------------------------------
    alias xrxs_bp1_setup setup
    def setup(actor_id)
    xrxs_bp1_setup(actor_id)
    @hate = 100 # init-value is 100
    @cp = 0
    @now_guarding = false
    @slip_state_update_ban = false
    end
    end
    #==============================================================================
    # ■ Game_Enemy
    #==============================================================================
    class Game_Enemy < Game_Battler
    #--------------------------------------------------------------------------
    # ● オブジェクト初期化
    #--------------------------------------------------------------------------
    alias xrxs_bp1_initialize initialize
    def initialize(troop_id, member_index)
    xrxs_bp1_initialize(troop_id, member_index)
    @hate = 100 # init-value is 100
    @cp = 0
    @now_guarding = false
    @slip_state_update_ban = false
    end
    end
    #==============================================================================
    # ■ Window_BattleStatus
    #==============================================================================
    class Window_BattleStatus < Window_Base
    #--------------------------------------------------------------------------
    # ● 公開インスタンス変数
    #--------------------------------------------------------------------------
    attr_accessor :update_cp_only # CPメーターのみの更新
    #--------------------------------------------------------------------------
    # ● オブジェクト初期化
    #--------------------------------------------------------------------------
    alias xrxs_bp1_initialize initialize
    def initialize
    @update_cp_only = false
    xrxs_bp1_initialize
    end
    #--------------------------------------------------------------------------
    # ● リフレッシュ
    #--------------------------------------------------------------------------
    alias xrxs_bp1_refresh refresh
    def refresh
    unless @update_cp_only
    xrxs_bp1_refresh
    end
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    actors_size = [$game_party.actors.size, 4].max
    max_width = [600 / (actors_size + 1), 80].max
    x_shift = max_width + (600 - max_width*actors_size)/(actors_size - 1)
    actor_x = i * x_shift + 4
    draw_actor_cp_meter(actor, actor_x, 96, max_width, 0)
    end
    end
    #--------------------------------------------------------------------------
    # ● CPメーター の描画
    #--------------------------------------------------------------------------
    def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
    self.contents.font.color = system_color
    self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
    if actor.cp == nil
    actor.cp = 0
    end
    w = width * [actor.cp,65535].min / 65535
    self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))
    self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))
    self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))
    self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))
    end
    end
    #==============================================================================
    # ■ Scene_Battle
    #==============================================================================
    class Scene_Battle
    #--------------------------------------------------------------------------
    # ● フレーム更新
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update update
    def update
    xrxs_bp1_update
    # CP更新
    @cp_thread.update
    end
    #--------------------------------------------------------------------------
    # ● バトル終了
    # result : 結果 (0:勝利 1:敗北 2:逃走)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_battle_end battle_end
    def battle_end(result)
    # CPカウント停止
    @cp_thread.stop
    xrxs_bp1_battle_end(result)
    end
    #--------------------------------------------------------------------------
    # ● プレバトルフェーズ開始
    #--------------------------------------------------------------------------
    alias xrxs_bp1_start_phase1 start_phase1
    def start_phase1
    @agi_total = 0
    # CP加算を開始する
    @cp_thread = Scene_Battle_CP.new
    # アクターコマンドウィンドウを再作成
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, "逃げる"])
    @actor_command_window.y = 128
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @actor_command_window.draw_item(4, $game_temp.battle_can_escape ? @actor_command_window.normal_color : @actor_command_window.disabled_color)
    # 呼び戻す
    xrxs_bp1_start_phase1
    end
    #--------------------------------------------------------------------------
    # ● パーティコマンドフェーズ開始
    #--------------------------------------------------------------------------
    alias xrxs_bp1_start_phase2 start_phase2
    def start_phase2
    xrxs_bp1_start_phase2
    @party_command_window.active = false
    @party_command_window.visible = false
    # 次へ
    start_phase3
    end
    #--------------------------------------------------------------------------
    # ● アクターコマンドウィンドウのセットアップ
    #--------------------------------------------------------------------------
    alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
    def phase3_setup_command_window
    # CPスレッドを一時停止
    @cp_thread.stop = true
    # @active_battlerの防御を解除
    @active_battler.now_guarding = false
    # 効果音の再生
    Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
    # 呼び戻す
    xrxs_bp1_phase3_setup_command_window
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
    #--------------------------------------------------------------------------
    alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
    def update_phase3_basic_command
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
    # アクターコマンドウィンドウのカーソル位置で分岐
    case @actor_command_window.index
    when 4 # 逃げる
    if $game_temp.battle_can_escape
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # アクションを設定
    @active_battler.current_action.kind = 0
    @active_battler.current_action.basic = 4
    # 次のアクターのコマンド入力へ
    phase3_next_actor
    else
    # ブザー SE を演奏
    $game_system.se_play($data_system.buzzer_se)
    end
    return
    end
    end
    xrxs_bsp1_update_phase3_basic_command
    end
    #--------------------------------------------------------------------------
    # ● メインフェーズ開始
    #--------------------------------------------------------------------------
    alias xrxs_bp1_start_phase4 start_phase4
    def start_phase4
    # 呼び戻す
    xrxs_bp1_start_phase4
    # CP加算を再開する
    @cp_thread.stop = false
    end
    #--------------------------------------------------------------------------
    # ● 行動順序作成
    #--------------------------------------------------------------------------
    alias xrxs_bp1_make_action_orders make_action_orders
    def make_action_orders
    xrxs_bp1_make_action_orders
    # 全員のCPを確認
    exclude_battler = []
    for battler in @action_battlers
    # CPが不足している場合は @action_battlers から除外する
    if battler.cp < 65535
    exclude_battler.push(battler)
    end
    end
    @action_battlers -= exclude_battler
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update_phase4_step1 update_phase4_step1
    def update_phase4_step1
    # 初期化
    @phase4_act_continuation = 0
    # 勝敗判定
    if judge
    @cp_thread.stop
    # 勝利または敗北の場合 : メソッド終了
    return
    end
    # 未行動バトラー配列の先頭から取得
    @active_battler = @action_battlers[0]
    # ステータス更新をCPだけに限定。
    @status_window.update_cp_only = true
    # ステート更新を禁止。
    @active_battler.slip_state_update_ban = true if @active_battler != nil
    # 戻す
    xrxs_bp1_update_phase4_step1
    # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
    if @phase4_step != 2
    # リフレッシュ
    @status_window.refresh
    # 軽量化:たったコレだけΣ(・w・
    Graphics.frame_reset
    end
    # 禁止を解除
    @status_window.update_cp_only = false
    @active_battler.slip_state_update_ban = false if @active_battler != nil 
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update_phase4_step2 update_phase4_step2
    def update_phase4_step2
    # 強制アクションでなければ
    unless @active_battler.current_action.forcing
    # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
    if @active_battler.restriction == 2 or @active_battler.restriction == 3
    # アクションに攻撃を設定
    @active_battler.current_action.kind = 0
    @active_battler.current_action.basic = 0
    end
    # 制約が [行動できない] の場合
    if @active_battler.restriction == 4
    # アクション強制対象のバトラーをクリア
    $game_temp.forcing_battler = nil
    if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
    # ステート自然解除
    @active_battler.remove_states_auto
    # CP消費
    @active_battler.cp = [(@active_battler.cp - 65535),0].max
    # ステータスウィンドウをリフレッシュ
    @status_window.refresh
    end
    # ステップ 1 に移行
    @phase4_step = 1
    return
    end
    end
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0
    # 攻撃・防御・逃げる・何もしない時の共通消費CP
    @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
    when 1
    # スキル使用時の消費CP
    @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
    when 2
    # アイテム使用時の消費CP
    @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
    end
    # CP加算を一時停止する
    @cp_thread.stop = true
    # ステート自然解除
    @active_battler.remove_states_auto
    # 呼び戻す
    xrxs_bp1_update_phase4_step2
    end
    #--------------------------------------------------------------------------
    # ● 基本アクション 結果作成
    #--------------------------------------------------------------------------
    alias xrxs_bp1_make_basic_action_result make_basic_action_result
    def make_basic_action_result
    # 攻撃の場合
    if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
    @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
    end
    # 防御の場合
    if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
    @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
    end
    # 敵の逃げるの場合
    if @active_battler.is_a?(Game_Enemy) and
    @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
    @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
    end
    # 何もしないの場合
    if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
    @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
    end
    # 逃げるの場合
    if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
    @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
    # 逃走可能ではない場合
    if $game_temp.battle_can_escape == false
    # ブザー SE を演奏
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # 逃走処理
    update_phase2_escape
    return
    end
    xrxs_bp1_make_basic_action_result
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update_phase4_step3 update_phase4_step3
    def update_phase4_step3
    # 呼び戻す
    xrxs_bp1_update_phase4_step3
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update_phase4_step5 update_phase4_step5
    def update_phase4_step5
    # スリップダメージ
    if @active_battler.hp > 0 and @active_battler.slip_damage?
    @active_battler.slip_damage_effect
    @active_battler.damage_pop = true
    end
    xrxs_bp1_update_phase4_step5
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
    #--------------------------------------------------------------------------
    alias xrxs_bp1_update_phase4_step7 update_phase4_step7
    def update_phase4_step7
    # CP加算を再開する
    @cp_thread.stop = false
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    xrxs_bp1_update_phase4_step7
    end
    end
    #end
    [b]còn sprite của hero với monster thì set theo hình sau, nếu muốn sữa đổi thì làm như sau:[/b]
    [b]nếu muốn thay số frame của hero thì sửa đọan này trong script Battle_Animation , xài search mà tìm:[/b]
    [b]	def pose(number, frames = 10) # thay số 10 thành số frame bạn muốn, mặc định là 10[/b]
    [b]còn của monster là ở line 306:[/b]
    [b]	def enemy_pose(number ,enemy_frames = 10) # thay số 10 thành số frame bạn muốn, mặc định là 10[/b]
    [b]còn muốn đổi chiều rộng chiều cao của mỗi frame thì cũng trong Battle_Animation[/b]
    [b]@frame_width, @frame_height = 116, 100 #116 là chiều rộng, 100 là chiều cao (đây là số mặc định)[/b]
    [b]sprite hero, monster được mặc định gồm 7 hàng ứng với 7 actions và mỗi action có 10 frame[/b]
    [b]vậy sprite có kích thước 116*10 và 100*7 (xem hình, hình ko đúng kích thước đâu nhé, ví dụ thui)[/b]
    [b]7 hàng gồm 7 sprite miêu tả 7 action khác nhau như stand, run, attack, magic, defense, be attack, victory.[/b]
    [b]nếu muốn thêm action cho hero thì sửa ở đây[/b]
    def pose(number, frames = 10)
    case number
    when 0 # run
    change(frames, 5, 0, 0, 0)
    when 1 # standby
    change(frames, 5, 0, @frame_height)
    when 2 # defend
    change(frames, 5, 0, @frame_height * 2)
    when 3 # Hurt, loops
    change(frames, 5, 0, @frame_height * 3)
    when 4 # attack no loop
    change(frames, 5, 0, @frame_height * 4, 0, true)
    when 5 # skill
    change(frames, 5, 0, @frame_height * 5)
    when 6 # death
    change(frames, 5, 0, @frame_height * 6)
    when 7 # no sprite
    change(frames, 5, 0, @frame_height * 7)
    #when 8
    # change(frames, 5, 0, @frame_height * 9)
    # ...etc.
     
    [b]nếu muốn thêm thì thêm vào chỗ when 8 gì gì đó, cụ thể thì mình ko rõ lắm, ai ở ko thì thử vậy[/b]
    [b]còn monster đây[/b]
    def enemy_pose(number ,enemy_frames = 10)
    case number
    when 0 # run
    change(enemy_frames, 5, 0, 0, 0)
    when 1 # standby
    change(enemy_frames, 5, 0, @frame_height)
    when 2 # defend
    change(enemy_frames, 5, 0, @frame_height * 2)
    when 3 # Hurt, loops
    change(enemy_frames, 5, 0, @frame_height * 3)
    when 4 # attack
    change(enemy_frames, 5, 0, @frame_height * 4, 0, true)
    when 5 # skill
    change(enemy_frames, 5, 0, @frame_height * 5)
    when 6 # death
    change(enemy_frames, 5, 0, @frame_height * 6)
    when 7 # no sprite
    change(enemy_frames, 5, 0, @frame_height * 7)
    # ...etc.
    nếu mún thêm cũng làm y vậy
    như đã nói ở trên sprite miêu tả action sẽ là như sau:
    hàng 1: run
    hàng 2: stand
    hàng 3: defend
    hàng 4: be attack, nói chung là trúng đòn từ magic đến normal
    hàng 5: attack
    hàng 6: skill
    hàng 7: death
    (xem hình)
    trước tiên bạn phải Import sprite mới vào đã. chọn resource manager, chọn Battlers rùi import sprite dzô
    kích thước thì như đã nói ở trên tùy số action cũng như chiều cao và chiều rộng của mỗi frame. sau đó vô Database chỉnh Battle Graphic lại thành sprite mới Import vào là xong
    sprite của hero và monster đều như nhau, nhưng của hero thì phải quay wa trái, còn monster thì quay mặt wa phải vậy thui.
    ai làm được thì thui, ko được thì xem kĩ lại các bước, rùi cũng thành công thui. Chúc dzui dzẻ,
    à mà wên nói rõ cái nì lụm từ nhìu nguồn rùi ghép chung lại ( ko rõ ràng thì lão ken10 nói chôm của người khác mà ko nói rùi chém tui mấy nhát à :D ).
    [​IMG]
    [​IMG]
     
  2. zubachi

    zubachi Donkey Kong

    Tham gia ngày:
    5/11/04
    Bài viết:
    301
    Nơi ở:
    Tây phương
    :)) Chú em khá quá nhỉ. Nhưng đáng tiếc là lúc này đây, VM không cần cái script của chú nữa.

    Chú đừng trông mong mấy bà trong VM chi... :)) Anh dám đảm bảo cho chú là... gái Úc đẹp hơn.
     
  3. finalfantasy9

    finalfantasy9 Mr & Ms Pac-Man

    Tham gia ngày:
    25/1/05
    Bài viết:
    205
    _VM có 2 đứa đẹp lắm .Thằng Ken nó dấu không đưa ra thôi.Đi họp lần trước thấy mà.Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........Ken là đồ xấu xa.........đồ keo kiệt.........

    Xin tý EXP nha , nể mặt chút đê , sắp wa kiếp lính mới rồi :hug: :hug:
     
  4. zubachi

    zubachi Donkey Kong

    Tham gia ngày:
    5/11/04
    Bài viết:
    301
    Nơi ở:
    Tây phương
    Đẹp lắm à bác ff9? Nghe thèng ken nó chê mà. Chậc. Đồ xỏ lá.
     
  5. SVS

    SVS Mario & Luigi

    Tham gia ngày:
    27/6/03
    Bài viết:
    899
    Nơi ở:
    Graveyard of rusted uses
    Sao lại chat ở đây! Ken ui! Triệt hạ đê!
    Hô hô ... ông VoDich lấy cái scrips ở đâu thế? Để tui chui dzô tìm thêm! Đang thèm scrips để nghiên cứu! Mau lên nha!
     
  6. finalfantasy9

    finalfantasy9 Mr & Ms Pac-Man

    Tham gia ngày:
    25/1/05
    Bài viết:
    205
    _Dừa lắm ăn cái thẹo , vì cái tội giả bộ hiền lảnh rồi xía vô nhiều chuyện ^_^ <-- Người ta gọi là chó (Thông cảm, tui là con người thực tế nên lời nói cũng thực tế).
    _Ăn nói thiếu tôn trọng ra ngoài đường bán râu đi.Thà cãi với thằng ken còn tốt hơn.



    kEN CHIỀU NAY CÃI LỘN TIẾP KO
     
  7. >VoDich<

    >VoDich< Legend of Zelda

    Tham gia ngày:
    26/1/05
    Bài viết:
    919
    Nơi ở:
    Can Tho
    em đâu làm cho riêng VM, em làm cho ai cần thui, tại thấy nhìu người than quá nên giúp 1 tay vậy mà
    sao ken ko + EXP nhỉ :D
    oh FF cũng đi họp à, kể tui nghe dzới, lần sau có đi nhớ đem máy chụp hình hay di động chụp lén cho tui vài tấm dzới nghe
    script này có được do công lao tui đi hỏi của 1 anh người nước nào ko biết :D, trong phần battle_animation có địa chỉ mail đó, theo đó mà liên lạc.
     
  8. Holy_Healing

    Holy_Healing Youtube Master Race

    Tham gia ngày:
    4/4/05
    Bài viết:
    53
    Vậy ông làm hay kiếm đâu ra 1 cái script để cho tôi chạy được movie trong RPGmaker xp đi , vụ này 2k3 xài ngon quá mà xp lại không được T__T
     
  9. >VoDich<

    >VoDich< Legend of Zelda

    Tham gia ngày:
    26/1/05
    Bài viết:
    919
    Nơi ở:
    Can Tho
    sao mấy người trong forum ko chỉ ông, tui đâu chuyên RPGXP đâu, ken10 với mấy ông kia kìa, sao ko hỏi nhỉ.
     
  10. zubachi

    zubachi Donkey Kong

    Tham gia ngày:
    5/11/04
    Bài viết:
    301
    Nơi ở:
    Tây phương
    =)) Hiền hay không phụ thuộc vào mục đích khi post bài.

    Ông ff9 post bài với mục đích xấu xa. Đòi cộng XP trắng trợn => Ai tồi hơn ai? Chó khen mèo lắm lông. ;))
     
  11. zubachi

    zubachi Donkey Kong

    Tham gia ngày:
    5/11/04
    Bài viết:
    301
    Nơi ở:
    Tây phương
    Biết thì cũng chỉ rồi. Nhưng đáng tiếc là làm rất khó bạn ạ.

    @ff9:
    ;)) Ăn nói thiếu tôn trọng? Muốn người ta tôn trọng mình thì mình cũng phải tôn trọng người ta chứ? Khi không nguyền rủa thiên hạ bậy bạ.

    Người ta đã có lòng khuyên giải còn không biết cảm ơn. Chờ smod dzô thấy thì ông được "hóa kiếp" chứ đừng nói là "thoát kiếp"
     
  12. Alone Beast

    Alone Beast C O N T R A

    Tham gia ngày:
    14/1/04
    Bài viết:
    1,607
    Nơi ở:
    ...
  13. finalfantasy9

    finalfantasy9 Mr & Ms Pac-Man

    Tham gia ngày:
    25/1/05
    Bài viết:
    205
    vậy à.Đề ff9 vào xem thử xem.Cảm ơn Alone nhé (chơi cú chót trước khi đi làm :D)bb
     
  14. SVS

    SVS Mario & Luigi

    Tham gia ngày:
    27/6/03
    Bài viết:
    899
    Nơi ở:
    Graveyard of rusted uses
    Scrips của ông vô địch hình như bị lỗi! Ông kiểm tra lại hộ cái! Để tui tìm hiểu lại!
     
  15. >VoDich<

    >VoDich< Legend of Zelda

    Tham gia ngày:
    26/1/05
    Bài viết:
    919
    Nơi ở:
    Can Tho
    lỗi đâu, tui chạy ngon lành mà, để chiều up cho bản example.
     
  16. >VoDich<

    >VoDich< Legend of Zelda

    Tham gia ngày:
    26/1/05
    Bài viết:
    919
    Nơi ở:
    Can Tho
    à mà lão ken mới edit lại hay sao ấy, coi chừng lão xoá mất vài chỗ đó he he :D :D :D
    viec play movie chắc lão ken với nhóm VM biết mà họ giấu thui, có phải ko nhỉ. #>:) #>:) #>:) :whew:
     
  17. Alone Beast

    Alone Beast C O N T R A

    Tham gia ngày:
    14/1/04
    Bài viết:
    1,607
    Nơi ở:
    ...
    Bí mật quân sự , ai lại để lộ ra ngoài :D
    Chắc ko phải ken chỉnh bậy đâu , ai cần làm thế chứ , ken nhẩy ?!
     
  18. vitdun

    vitdun Youtube Master Race

    Tham gia ngày:
    18/1/05
    Bài viết:
    74
    Hic hic, tui vẫn muốn để thanh ATB và HP/Sp kiểu xịn kia nhưng mà không muốn cho các nhân vật chuyên động và không quay vào nhau mà như cũ thì làm sao zậy???
     
  19. khoaiRPG

    khoaiRPG T.E.T.Я.I.S

    Tham gia ngày:
    24/3/05
    Bài viết:
    652
    và đây là cái bạn cần, có kèm file đó, dìa mà ngâm cứu
     

    Các file đính kèm:

  20. Super thám tử

    Super thám tử C O N T R A

    Tham gia ngày:
    11/7/04
    Bài viết:
    1,911
    Nơi ở:
    Chả nhớ nữa??
    Cái Project1.rar này lúc mình đang đầy ATB mà mình không đánh thì đối phương cũng không đánh được à??
     

Chia sẻ trang này