=begin
FMBS CUSTOM Battle Enhancement ver 1.0 By B@!LWORLD A.K.A Iqbal_0k
Request by
- revee in rmxp.org
credit and thanks : XRXS for this great battle system
FEATURE (June 10 2008) : - Change meteor boulder to escape ... completed
You can escape by running to the left side
- delete escape command in battle menu ... completed
- Show enemy name pop up when battle is starting
then vanish (no i didn't make a window it will
reduce your fps trust me) ... completed
- Replace Escape timer with escape probability ... completed
(i think it's too easy when you face higher level of enemy
then you decide to escape so easyly)
- Customizeable
FEATURE 1.0(June 11 2008)- Show enemy location when battle is starting
(make camera move to enemy after press a key go to
hero you controlled) ... completed
- Change distance position of enemy and hero ... Completed
- Improved custom escape ... Completed
- Paused Battler before battle begin ... completed
- Fixed Self.Bitmap bugs
FEATURE 1.1(June 13 2008)- Cleaning code
- Making all feature customizeable
- Enable/Disable Animated Faces
NOTE :
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- FROM NOW on I wont take any request anymore, if you want to request script go to script request
section (I had a girl friend, school work and project to finish, so i dont have much time for that)
- i might take your request if i'm interested on your idea
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HOW TO USE : - put this script below other default fmbs and above fix script
- For besr result disable fmbs action message by deleting them or
switch $fmbs_bm to false (it will reduce some lag)
how to use animated face feature?
- make faces in faces2\ directory
add following word in your faces filenames (ACTOR ONLY)
- " Hurt" (without quotes)
- " Attack" (without quotes)
- " Dead" (without quotes)
- " Skill" (without quotes)
- " Guard" (without quotes)
=end
#==============================================================================
# CONFIGURATION
#==============================================================================
module SETUP_ENHANCEMENT
Use_custom_escape = true
Show_name_pop_up = false
Camera_Zooming = 1.30 # Use any Desired Value you want (default = 1.00)
Cant_Escape_word = "Can\'t Escape"
Success_Escape = "Run Run Run"
Enable_Animated_Faces = false
end
# END CONFIGURATION
if SETUP_ENHANCEMENT::Enable_Animated_Faces == true
#==============================================================================
# ¦ Window Base
#==============================================================================
class Window_Base < Window
def draw_actor_face2(actor, x, y)
$motions = "" if $motions == nil
face = RPG::Cache.character("Faces2/" + actor.character_name + $motions, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
end
end
#==============================================================================
# ¦ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
alias enhancement_initialize initialize
def initialize(troop_id, member_index)
enhancement_initialize(troop_id, member_index)
@actor_in_battlefield = false
@x_pos = $data_troops[troop_id].members[member_index].x - 90
@y_pos = -($data_troops[troop_id].members[member_index].y - 304)
@z_pos = 0
@field_x_offset = -192
@field_y_offset = -144
@zoom = SETUP_ENHANCEMENT::Camera_Zooming
xrxs_bp8_initialize(troop_id, member_index)
end
end
#==============================================================================
# ¦ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
def set_position
case self.index
when 0 # Hero 1 from database
self.x_pos = -200
self.y_pos = 0
self.z_pos = 0
when 1 # Hero 2 from database
self.x_pos = -296
self.y_pos = 0
self.z_pos = 0
when 2 # Hero 3 from database
self.x_pos = -232
self.y_pos = 0
self.z_pos = 0
when 3 # Hero 4 from database
self.x_pos = -168
self.y_pos = 0
self.z_pos = 0
end
end
end
#==============================================================================
# ? Window_ActiveMenu
#==============================================================================
class Window_ActiveMenu < Window_Selectable
alias delete_escape_index initialize
def initialize
delete_escape_index
#MAXIMUM OF MENU COMMAND
if SETUP_ENHANCEMENT::Use_custom_escape == true
@item_max = 3
@column_max = 3
end
end
#Remove escape icons
alias escape_refresh_enhance refresh
def refresh
if SETUP_ENHANCEMENT::Use_custom_escape == true
@window_screenback.visible = true
self.contents.clear
# this one for item icons
bitmap = RPG::Cache.icon("021-Potion01")
self.contents.blt( 0, 4, bitmap, Rect.new(0, 0, 24, 24))
# for skill icons
bitmap = RPG::Cache.icon("044-Skill01")
self.contents.blt( 32, 4, bitmap, Rect.new(0, 0, 24, 24))
#for equip icons
bitmap = RPG::Cache.icon("001-Weapon01")
self.contents.blt( 64, 4, bitmap, Rect.new(0, 0, 24, 24))
else
escape_refresh_enhance
end
end
end
class Scene_Battle
alias iqbal_custom_start_phase1 start_phase1
def start_phase1
iqbal_custom_start_phase1
for battler in $game_party.actors + $game_troop.enemies
battler.motion.knock_back_duration = 100
end
@duration = 0
if @duration < 50
for enemy in $game_troop.enemies
@xcam_watch_battler = enemy if @duration <= 40
if SETUP_ENHANCEMENT::Show_name_pop_up == true
enemy.damage = enemy.name
enemy.damage_pop = true
end
@duration + 10
end
end
end
alias custom_fmbs_camera update_handling
def update_handling
custom_fmbs_camera
if SETUP_ENHANCEMENT::Enable_Animated_Faces == true
if @handle_battler.motion.guarding?
$motions = " Guard"
@status_window_needed_to_refresh = true
elsif Input.trigger?(KEY_ATTACK)
$motions = " Attack"
@status_window_needed_to_refresh = true
elsif Input.trigger?(KEY_SKILL)
$motions = " Skill"
@status_window_needed_to_refresh = true
elsif @handle_battler.motion.downing == true
$motions = " Hurt"
@status_window_needed_to_refresh = true
elsif @handle_battler.dead?
$motions = " Dead"
@status_window_needed_to_refresh = true
else
$motions = ""
end
end
if @xcam_watch_battler != @handle_battler
if Input.trigger?(Input::DOWN)
@xcam_watch_battler = @handle_battler
elsif Input.press?(Input::RIGHT)
@xcam_watch_battler = @handle_battler
elsif Input.press?(Input::LEFT)
@xcam_watch_battler = @handle_battler
elsif Input.trigger?(KEY_ATTACK)
@xcam_watch_battler = @handle_battler
elsif Input.trigger?(KEY_SKILL)
@xcam_watch_battler = @handle_battler
elsif Input.trigger?(KEY_JUMP) or Input.trigger?(Input::UP)
@xcam_watch_battler = @handle_battler
elsif Input.press?(KEY_GUARD) and !@handle_battler.motion.blowning
@xcam_watch_battler = @handle_battler
end
end
end
alias remove_select_escape_enhance update_phase3_activemenu
def update_phase3_activemenu
if SETUP_ENHANCEMENT::Use_custom_escape == true
@window_activemenu.visible = true
@window_activemenu.update
if Input.trigger?(Input::B)
# play cancel se
$game_system.se_play($data_system.cancel_se)
@xcam_z_destination = 185
@window_activemenu.active = false
@window_activemenu.visible = false
@phase = 1
end
if Input.trigger?(Input::C)
case @window_activemenu.index
when 0 # ITEM WINDOWS
# Play OK SE
$game_system.se_play($data_system.decision_se)
@window_activemenu.visible = false
@window_activemenu.active = false
@active_battler = @handle_battler
@actor_index = 0
start_item_select
@item_window.z = 303
when 1 # SKILL WINDOWS
# PLAY OK SE
$game_system.se_play($data_system.decision_se)
@window_activemenu.visible = false
call_menu_skill(0)
when 2 # EQUIP WINDOWS
# PLAY OK SE
$game_system.se_play($data_system.decision_se)
@window_activemenu.visible = false
call_menu_equip(0)
end
end
else
remove_select_escape_enhance
end
end
def update_coordinates
battlers_x_min = 111#512
battlers_x_max = -111#-512
battlers_y_min = 111#1024
battlers_y_max = -111#-512
for battler in $game_party.actors + $game_troop.enemies + @battle_bullets
next if battler.nil?
next if battler.motion.downing
# ??
if battler.dead? or
(battler.is_a?(Game_BattleBullet) and !battler.is_a?(Game_ShootingTarget))
else
battlers_x_min = [battler.x_pos - battler.body_rect.x, battlers_x_min].min
battlers_x_max = [battler.x_pos - battler.body_rect.x + battler.body_rect.width, battlers_x_max].max
battlers_y_min = [battler.y_pos, battlers_y_min].min
battlers_y_max = [battler.y_pos - battler.body_rect.y, battlers_y_max].max
end
next if battler.motion.hit_stop_duration > 0
if battler.is_a?(Game_BattleBullet)
battler_rect = Rect.new(0,0,1,1)
else
battler_rect = battler.body_rect.dup
battler_rect.x += battler.x_pos
battler_rect.y -= battler.y_pos
end
if battler.motion.now_jumps == 0
if battler.now_x_speed > 0
battler.now_x_speed = [battler.now_x_speed - battler.frict_x_break, 0].max
elsif battler.now_x_speed < 0
battler.now_x_speed = [battler.now_x_speed + battler.frict_x_break, 0].min
end
elsif battler.motion.now_jumps > 0 and battler.motion.controllable?
if battler.now_x_speed > 0
battler.now_x_speed = [battler.now_x_speed - battler.air_x_resistance, 0].max
elsif battler.now_x_speed < 0
battler.now_x_speed = [battler.now_x_speed + battler.air_x_resistance, 0].min
end
end
variation = battler.relative_x_destination + battler.now_x_speed.floor
side = XRXS_BS1::BF_SIDE + (BURST_SMASH_ENABLE ? 256 : 0)
max = side
min = @phase == 6 ? -640 : -1 * side
for block in @field_blocks
if rects_over_y?(battler_rect, block)
x = block.x + block.width + battler_rect.width/2
if x <= battler.x_pos+1 and x > min
min = x
end
x = block.x - battler_rect.width/2
if battler.x_pos-1 <= x and x < max
max = x
end
end
end
battler.x_pos += variation
if battler.x_pos < min
battler.x_pos = min
if battler.motion.blowning
battler.now_x_speed *= -1/2
do_crashing_shake
end
elsif battler.x_pos > max
battler.x_pos = max
if battler.motion.blowning
battler.now_x_speed *= -1/2
do_crashing_shake
end
end
max = XRXS_BS1::BF_TOP + (METEOR_SMASH_ENABLE ? 256 : 0)
min = XRXS_BS1::BF_BOTTOM
for block in @field_blocks
if rects_over_x?(battler_rect, block)
if battler.y_pos >= -block.y and -block.y > min
min = -block.y
end
y = -(block.y + block.height)
if battler.y_pos < y and y < max
max = y
end
end
end
if battler.motion.boardthrough_duration <= 0
for board in @field_boards
if rects_over_x?(battler_rect, board)
if battler.previous_y_pos >= -board.y and -board.y > min
min = -board.y
end
end
end
end
max -= battler_rect.height
if battler.y_pos != min
if battler.motion.now_jumps == 0
battler.motion.now_jumps = 1
end
if battler.now_y_speed >= -battler.air_y_maximum
battler.now_y_speed = [battler.now_y_speed - battler.air_y_velocity, -battler.air_y_maximum].max
if battler.now_y_speed <= 0 and
battler.motion.handling_priority == 0 and
!battler.dead? and !battler.motion.blowning and
battler.now_form_id/10 != 5
battler.motion.do_jumping_fall
end
end
end
variation = battler.relative_y_destination + battler.now_y_speed.floor
battler.y_pos = [[battler.y_pos + variation, min].max, max].min
battler.y_min = min
if battler.y_pos == min
battler.now_y_speed = 0
end
next if battler.is_a?(Game_BattleBullet)
if battler.y_pos == min and battler.motion.now_jumps > 0
if battler.motion.downing
battler.now_x_speed = 0
battler.now_y_speed = 9
battler.motion.now_jumps = 0
battler.motion.downing = true
battler.motion.blowning = false
elsif battler.motion.blowning
battler.now_y_speed = 9
battler.motion.do_down
else
battler.now_x_speed = 0
battler.now_y_speed = 0
battler.motion.now_jumps = 0
battler.motion.do_landing_step if !battler.dead?
end
elsif battler.y_pos == max and
battler.now_y_speed > battler.now_x_speed.abs
if battler.motion.blowning
battler.now_y_speed *= -1/2
do_crashing_shake
else
battler.now_y_speed = 0
end
end
battler.previous_x_pos = battler.x_pos
battler.previous_y_pos = battler.y_pos
next if @phase == 5 or @phase == 6
if BURST_SMASH_ENABLE and battler.x_pos <= XRXS_BS1::BF_SIDE * -1
if SETUP_ENHANCEMENT::Use_custom_escape == true
# MAKE ESCAPE
@Probability = rand(100)
if $game_temp.battle_can_escape == true
if @Probability >= 69
for battler in $game_party.actors
if battler != @handle_battler
battler.damage = SETUP_ENHANCEMENT::Success_Escape
battler.damage_pop = true
end
end
for bullet in @battle_bullets.dup
bullet = nil
end
@battle_bullets.clear
@spriteset.battle_bullet_update(@battle_bullets)
@spriteset.stop_update_animation
@phase = 6
@xcam_x_destination = $xcam_x
@xcam_y_destination = $xcam_y
@xcam_z_destination = $xcam_z
@xcam_watch_battler = nil
for battler in $game_party.actors + $game_troop.enemies
battler.motion.do_straighten if battler.motion.directable?
battler.motion.knock_back_duration = 40
end
@handle_battler.motion.do_escape
# Play escape SE
$game_system.se_play($data_system.escape_se)
@windows.visible = false if $fmbs_bm == true
@phase6_wait_count = 80
return
else#probability
battler.motion.do_straighten if battler.motion.directable?
battler.motion.do_backstep
for battler in $game_party.actors
if battler != @handle_battler
battler.damage = SETUP_ENHANCEMENT::Cant_Escape_word
battler.damage_pop = true
end
end
end
else #can escape?
battler.motion.do_straighten if battler.motion.directable?
battler.motion.do_backstep
for battler in $game_party.actors
if battler != @handle_battler
battler.damage = SETUP_ENHANCEMENT::Cant_Escape_word
battler.damage_pop = true
end
end
end
else #not use custom escape
battler.motion.do_straighten if battler.motion.directable?
battler.motion.do_backstep
end
elsif BURST_SMASH_ENABLE and battler.x_pos >= XRXS_BS1::BF_SIDE
battler.motion.do_straighten if battler.motion.directable?
battler.motion.knock_back_duration = 5
battler.motion.do_backstep
elsif METEOR_SMASH_ENABLE and battler.y_pos >= XRXS_BS1::BF_TOP
battler.motion.do_straighten if battler.motion.directable?
battler.motion.knock_back_duration = 5
battler.motion.do_crouch_to_jump
elsif METEOR_SMASH_ENABLE and battler.y_pos <= XRXS_BS1::BF_BOTTOM
#MAKE METEOR SMASH and hurt battler
battler.hp -= battler.maxhp * METEOR_SMASH_DAMAGE / 100
battler.motion.do_meteor
battler.dp = 0
end
if battler.is_a?(Game_Actor)
allies = $game_party.actors
else
allies = $game_troop.enemies
end
for target in allies
break if battler.motion.now_jumps > 0
next if target.motion.now_jumps > 0
next if target == battler
if battler.motion.handling_priority == 0 and
target.motion.handling_priority == 0 and
!battler.motion.dashing and
!target.motion.dashing
next
end
target_rect = target.body_rect.dup
target_rect.x += target.x_pos
target_rect.y -= target.y_pos
if rects_over?(battler_rect.dup, target_rect.dup)
if battler.z_pos <= target.z_pos
battler.z_pos = [battler.z_pos - 4,-8].max
target.z_pos = [target.z_pos + 4, 8].min
else
battler.z_pos = [battler.z_pos + 4, 8].min
target.z_pos = [target.z_pos - 4, -8].max #4
end
end
end
if battler.z_pos != 0
battler.z_pos /= 10
end
next if battler.dead?
battler_rect = battler.body_rect.dup
battler_rect.x += battler.x_pos
battler_rect.y -= battler.y_pos
; for target in $game_party.actors + $game_troop.enemies
break if battler.motion.now_jumps > 0
next if target.motion.now_jumps > 0
next if target == battler
next if target.dead?
next if (battler.z_pos - target.z_pos).abs >= 8
next if target.motion.handling_priority > 0 or target.motion.unfrictbreak_duration > 0
target_rect = target.body_rect.dup
target_rect.x += target.x_pos
target_rect.y -= target.y_pos
if rects_over?(battler_rect.dup, target_rect.dup)
if battler.x_pos < target.x_pos
battler.x_pos -= 2
target.x_pos += 2
else
battler.x_pos += 2
target.x_pos -= 2
end
end
end
side = XRXS_BS1::BF_SIDE + (BURST_SMASH_ENABLE ? 256 : 0)
x_min = -1 * side - battler.body_rect.x
x_max = side - battler.body_rect.x - battler.body_rect.width
battler.x_pos = [[battler.x_pos, x_min].max, x_max].min
end
return if @phase == 5 or @phase == 6
@xcam_x_destination = (battlers_x_max + battlers_x_min)/2
@xcam_y_destination = (battlers_y_max/2 + battlers_y_min)/2
max_distance = [(battlers_x_min - battlers_x_max).abs,(battlers_y_min - battlers_y_max).abs].max
@xcam_z_destination = [[(max_distance * 185.0 / 480).floor, XCAM_DISTANCE_MIN].max, XCAM_DISTANCE_MAX].min
end
end