Just a question, its possible to delay the damage hit itself, like when you have a long attack animation, you don't want the damage hit to happen at the start of the animation, but rather the end. Its possible to somehow add a delay to this?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
module BlizzABS
#===============================================================================
# ** Controller
#===============================================================================
class Controller
CX = ((SCREEN_RESOLUTION[0]) - 16) * 4
CY = ((SCREEN_RESOLUTION[1]) - 16) * 4
def center(x, y, flag = false)
pix = flag ? $BlizzABS.pixel : 1
x, y = x * 128 / pix, y * 128 / pix
m_x = ($game_map.width - $game_map.tile_size[0]) * 128
m_y = ($game_map.height - $game_map.tile_size[1]) * 128
ox, oy = x - CX, y - CY
if ox > m_x
$game_map.display_x = m_x
elsif ox < 0
$game_map.display_x = 0
else
$game_map.display_x = ox
end
if oy > m_y
$game_map.display_y = m_y
elsif oy < 0
$game_map.display_y = 0
else
$game_map.display_y = oy
end
end
end
#===============================================================================
# ** Utility
#===============================================================================
class Utility
def get_fullscreen_area
return Rect.new($game_map.display_x / 4, $game_map.display_y / 4,
SCREEN_RESOLUTION[0], SCREEN_RESOLUTION[1])
end
def get_player_radius
if $game_player.screen_x > (SCREEN_RESOLUTION[0] / 2)
x_max = $game_player.screen_x
else
x_max = SCREEN_RESOLUTION[0] - $game_player.screen_x
end
if $game_player.screen_y > (SCREEN_RESOLUTION[1] / 2)
y_max = $game_player.screen_y
else
y_max = SCREEN_RESOLUTION[1] - $game_player.screen_y
end
return Math.hypot(x_max, y_max) / 32
end
end
end
#===============================================================================
# ** Sprite
#===============================================================================
class Sprite
def in_screen?
return (self.x.between?(0, SCREEN_RESOLUTION[0]-1) && (self.y-16).between?(0, SCREEN_RESOLUTION[1]-1))
end
end
#===============================================================================
# ** Game_Character
#===============================================================================
class Game_Character
def in_abseal_range?
factor = BlizzABS::Config::ABSEAL_FACTOR < 1 ? 1 :
BlizzABS::Config::ABSEAL_FACTOR.to_i
return false if @real_x < $game_map.display_x - factor * 128
return false if @real_y < $game_map.display_y - factor * 128
return false if @real_x >= $game_map.display_x + (SCREEN_RESOLUTION[0]*4) + factor * 128
return false if @real_y >= $game_map.display_y + (SCREEN_RESOLUTION[1]*4)+ factor * 128
return true
end
end
#===============================================================================
# ** Map_Battler < Game_Character
#===============================================================================
class Map_Battler < Game_Character
def in_screen?
return (((@real_x - $game_map.display_x - 64) / 4).between?(0, SCREEN_RESOLUTION[0]) &&
((@real_y - $game_map.display_y - 64) / 4).between?(0, SCREEN_RESOLUTION[1]))
end
end
#===============================================================================
# ** Map_Remote < Map_Battler
#===============================================================================
class Map_Remote < Map_Battler
def out_of_screen?(add = 0)
return (self.real_x - $game_map.display_x + add < 0 ||
self.real_x - $game_map.display_x + add > (SCREEN_RESOLUTION[0]*4) ||
self.real_y - $game_map.display_y + add < 0 ||
self.real_y - $game_map.display_y + add > (SCREEN_RESOLUTION[1]*4))
end
end
#===============================================================================
# ** HUD < Sprite
#===============================================================================
class HUD < Sprite
alias zer0_resolution_hud_position_init initialize
def initialize(viewport = nil)
zer0_resolution_hud_position_init(viewport)
case BlizzABS::Config::HUD_POSITION
when 0 then self.x, self.y = 4, 4
when 1 then self.x, self.y = SCREEN_RESOLUTION[0] - self.bitmap.width - 4, 4
when 2 then self.x, self.y = 4, (SCREEN_RESOLUTION[1] - 116)
end
end
end
#===============================================================================
# ** Minimap < Sprite
#===============================================================================
class Minimap < Sprite
def initialize
width, height = SCREEN_RESOLUTION[0] / 4, SCREEN_RESOLUTION[1] / 4
super(Viewport.new(SCREEN_RESOLUTION[0]-width-4, SCREEN_RESOLUTION[1]-height-4, width, height))
@autotile = $BlizzABS.cache.image('minimap_autotile')
create_passable_floor
self.x = self.y = 0
viewport.z = 5000
@events, @names = check_events
create_sevents
self.visible = true
update
end
def update(override = false)
create_passable_floor if @map_id != $game_map.map_id
ev = check_events
if @events != ev[0] || @names != ev[1]
@events, @names = ev
destroy_sevents
create_sevents
end
if $game_system.minimap < 2
self.ox, self.oy = $game_map.display_x / 16, $game_map.display_y / 16
elsif !($game_system.turn_button && Input.press?(Input::Turn)) || override
if self.bitmap.width > SCREEN_RESOLUTION[0]
border = $game_player.real_x/16 - (SCREEN_RESOLUTION[0] / 2)
border_x = self.bitmap.width - SCREEN_RESOLUTION[0]
if border < 0
self.ox = 0
elsif border > border_x
self.ox = border_x
else
self.ox = border
end
else
self.ox = self.bitmap.width/2 - (SCREEN_RESOLUTION[0] / 2)
end
if self.bitmap.height > SCREEN_RESOLUTION[1]
border = $game_player.real_y/16 - (SCREEN_RESOLUTION[1] / 2)
border_y = self.bitmap.height - SCREEN_RESOLUTION[1]
if border < 0
self.oy = 0
elsif border > border_y
self.oy = border_y
else
self.oy = border
end
else
self.oy = self.bitmap.height/2 - (SCREEN_RESOLUTION[1] / 2)
end
end
@sevents.each_index {|i|
if $game_system.minimap == 2 || @events[i].update?
@sevents[i].x = self.x + @events[i].real_x / 16
@sevents[i].y = self.y + @events[i].real_y / 16
@sevents[i].ox, @sevents[i].oy = self.ox, self.oy
if @names[i] != '' && !@events[i].dropped? &&
(@events[i].is_a?(Map_Actor) ||
!@events[i].name.clone.gsub!('\box') {''})
@sevents[i].src_rect.set((@events[i].direction - 2) * 7, 0, 14, 14)
@sevents[i].ox += 3
@sevents[i].oy += 3
end
end}
end
end
#===============================================================================
# ** Scene_Map
#===============================================================================
class Scene_Map
def update_minimap
return if @minimap == nil
if $game_system.minimap < 2
@minimap.update
return
end
unless @minimap.viewport.rect.width == SCREEN_RESOLUTION[0] &&
@minimap.map_id == $game_map.map_id
@minimap.viewport.rect.set(0, 0, SCREEN_RESOLUTION[0], SCREEN_RESOLUTION[1])
@minimap.update(true)
else
@minimap.update
end
if $game_system.turn_button && Input.press?(Input::Turn) &&
!$game_system.map_interpreter.running? && !@move_route_forcing &&
!$game_temp.message_window_showing
if @minimap.bitmap.width > SCREEN_RESOLUTION[0]
if Input.repeat?(Input::RIGHT)
if @minimap.ox + SCREEN_RESOLUTION[0] < @minimap.bitmap.width
$game_system.se_play($data_system.cursor_se)
@minimap.ox += 32
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.repeat?(Input::LEFT)
if @minimap.ox > 0
$game_system.se_play($data_system.cursor_se)
@minimap.ox -= 32
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
if @minimap.bitmap.height > SCREEN_RESOLUTION[1]
if Input.repeat?(Input::DOWN)
if @minimap.oy + SCREEN_RESOLUTION[1] < @minimap.bitmap.height
$game_system.se_play($data_system.cursor_se)
@minimap.oy += 32
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.repeat?(Input::UP)
if @minimap.oy > 0
$game_system.se_play($data_system.cursor_se)
@minimap.oy -= 32
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
end
def initialize_selection
object, r, type, sprites = $game_temp.select_data
enemy, dead, all = $BlizzABS.util.get_scope_data(object.scope)
if $tons_version != nil && object.is_a?(RPG::Skill) &&
($tons_version >= 6.02 && $game_system.TARGET_EM_ALL &&
FULL_TARGET_IDS.include?(object.id))
target_all = all = true
end
sprites.each {|sprite| sprite.z += 1000000}
@index = 0
Graphics.freeze
tone = $game_screen.tone
@spriteset.viewport1.tone = Tone.new(tone.red - 32, tone.green - 32,
tone.blue - 32, tone.gray)
$game_system.se_play($data_system.decision_se)
@win = Window_Help.new
@win.z, @win.opacity = 10000, 192
@ranges = [Sprite.new(@spriteset.viewport1),
Sprite.new(@spriteset.viewport1)]
@ranges[0].z = @ranges[1].z = 950000
color = (target_all ? Color.new(255, 255, 255, 96) : enemy ?
Color.new(255, 0, 0, 96) : Color.new(0, 128, 255, 96))
if type == BlizzABS::BEAM && all
@ranges[0].bitmap = Bitmap.new(SCREEN_RESOLUTION[0], SCREEN_RESOLUTION[1])
@ranges[1].bitmap = Bitmap.new(SCREEN_RESOLUTION[0]-2, SCREEN_RESOLUTION[1]-2)
@ranges[0].bitmap.fill_rect(0, 0, SCREEN_RESOLUTION[0], SCREEN_RESOLUTION[1],
Color.new(255, 255, 0, 160))
@ranges[0].bitmap.fill_rect(1, 1, SCREEN_RESOLUTION[0]-2, SCREEN_RESOLUTION[1]-2,
Color.new(0, 0, 0, 0))
@ranges[1].x = @ranges[1].y = 1
@ranges[1].bitmap.fill_rect(0, 0, SCREEN_RESOLUTION[0]-2, SCREEN_RESOLUTION[1]-2, color)
else
@ranges[0].bitmap = Bitmap.new(r * 2 + 32, r * 2 + 32)
@ranges[1].bitmap = Bitmap.new(r * 2 + 32, r * 2 + 32)
@ranges[0].x, @ranges[0].y = $game_player.screen_x, $game_player.screen_y
@ranges[1].x, @ranges[1].y = $game_player.screen_x, $game_player.screen_y
@ranges[0].ox, @ranges[0].oy = r + 16, r + 32
@ranges[1].ox, @ranges[1].oy = r + 16, r + 32
@ranges[0].bitmap.draw_circle(0, 0, r.to_i + 16, Color.new(255, 255, 0, 160))
@ranges[0].bitmap.draw_circle(1, 1, r.to_i + 15, Color.new(0, 0, 0, 0))
@ranges[1].bitmap.draw_circle(1, 1, r.to_i + 15, color)
end
if all
sprites.each {|sprite| sprite.select = 1}
@win.set_text(BlizzABS::Cache::WORDAll, 1)
else
sprites[0].select = 1
@win.set_text(sprites[0].character.battler.name, 1)
end
@ranges[1].color.set(255, 255, 0, (16 - Graphics.frame_count % 32).abs * 8 )
Graphics.transition
end
#=== GAME_MAP PART ADDED =============================
class Game_Map
attr_reader :tile_size
alias initiate_tile_size_for_babs initialize
def initialize
@tile_size = [SCREEN_RESOLUTION[0], SCREEN_RESOLUTION[1]].collect {|n| (n / 32.0).ceil }
initiate_tile_size_for_babs
end
end
#=====================================================
end
[\code]
#==============================================================================
# Extra Frames
# por COGHWELL
# Edit by KK20
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# KK20's Note: The following instructions are no longer relevant to this script.
# The number of frames a character sprite uses is determined by the amount
# configured in the configuration below.
#==============================================================================
# O script permite que a imagem do character tenha mais que 4 frames.
#
# Para definir a quantidade de frames basta definir o nome adicione [X]
# ao seu nome, onde X é o numero de frames.
#
# Ex.:
# 001-Fighter01[7].png
#
# Isto significa que o 001-Fighter01 terá 7 frames
#==============================================================================
module ExtraFramesConfig
def self.char_frames(name)
case name
#--------------------------------------------------------------------------
# Begin Configuration
# Format:
# when 'filename' then return FRAMES
#
# Any names not configured will be assumed to have 4 frames (RMXP default)
#--------------------------------------------------------------------------
when 'Char - Rohan' then return 8
when 'Char - Rohan2' then return 8
when 'Char - Rohan Ladder' then return 8
when 'Char - Rohan2 Ladder' then return 8
when 'Char - Rohan_quarter' then return 8
when 'Char - Elenwen' then return 8
when 'Char - Elenwen Ladder' then return 8
when 'Char - Elenwen2' then return 8
when 'Char - Elenwen2 Ladder' then return 8
when 'Char - Lucain' then return 8
when 'Char - Lucain2' then return 8
when 'Char - Lucain Ladder' then return 8
when 'Char - Lucain2 Ladder' then return 8
when 'Char - Ramza' then return 8
when 'Char - Ramza Ladder' then return 8
when 'Char - Artanis' then return 8
when 'Char - Artanis Ladder' then return 8
when 'Char - Judeau' then return 8
when 'Char - Judeau Ladder' then return 8
when 'Char - Agrias' then return 8
when 'Char - Agrias Ladder' then return 8
#---------------------------------------------------------------
when 'Rag - Goo' then return 8
when 'Measure - Portals 01' then return 15
when 'Measure - Spawn' then return 5
when 'Measure - Mana Crystal 01' then return 9
when 'Poring' then return 8
when 'Rag - Myconid' then return 8
when 'Rag - Mossy Myconid' then return 8
when 'Rag - Willow' then return 5
when 'Rag - Willow 2' then return 5
when 'Rag - Boa' then return 6
when 'Rag - Bat' then return 8
when 'Rag - Knight M-1' then return 8
when 'Rag - Swordsman M-1' then return 8
when 'Rag - Swordsman M-2' then return 8
when 'Rag - Archer M-1' then return 8
when 'Rag - Botaring' then return 6
when 'Rag - Corruption' then return 6
when 'Rag - Schist' then return 5
when 'Rag - Ochu' then return 7
when 'Rag - Banshee' then return 6
when 'Rag - Wraith' then return 6
when 'Rag - Hopper' then return 7
when 'Rag - Dolomedes' then return 6
when 'Rag - Raydric' then return 6
when 'Rag - Raydric Archer' then return 6
when 'Rag - Abyss Knight' then return 8
when 'Rag - Parasite' then return 6
when 'Rag - Thief M1' then return 8
#--------------------------------------------------------------------------
# End of Configuration
#--------------------------------------------------------------------------
else
return 4
end
end
end
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
def update
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
frames = ExtraFramesConfig.char_frames(@character_name)
if frames != 4
@anime_count = 20 if @anime_count > 0 and @pattern == @original_pattern
if @anime_count * (frames - 1) / 4 > 18 - @move_speed * 3
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = @pattern % (frames - 1) + 1
end
@anime_count = 0
end
else
if @anime_count > 18 - @move_speed * 2
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % 4
end
@anime_count = 0
end
end
if @wait_count > 0
@wait_count -= 1
return
end
if @move_route_forcing
move_type_custom
return
end
if @starting or lock?
return
end
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 1
move_type_random
when 2
move_type_toward_player
when 3
move_type_custom
end
end
end
end
#================================================= =============================
# ■ Sprite_Character
#================================================= =============================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
frames = ExtraFramesConfig.char_frames(@character.character_name)
if frames != 4
@cw = bitmap.width / frames
@ch = bitmap.height / 4
else
@cw = bitmap.width / 4
@ch = bitmap.height / 4
end
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
#================================================= =============================
# ■ Window_Base
#================================================= =============================
class Window_Base < Window
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
frames = ExtraFramesConfig.char_frames(actor.character_name)
if frames != 4
cw = bitmap.width / frames
ch = bitmap.height / 4
else
cw = bitmap.width / 4
ch = bitmap.height / 4
end
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
#================================================= =============================
# ■ Window_SaveFile
#================================================= =============================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
name = "File #{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
if @file_exist
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
frames = ExtraFramesConfig.char_frames(@characters[i][0])
if @characters[i][0][/\[(\d+)\]/]
cw = bitmap.width / frames
ch = bitmap.height / 4
else
cw = bitmap.width / 4
ch = bitmap.height / 4
end
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 40, 600, 32, time_string, 2)
end
end
end
#================================================= =============================
# ■ Game_Player
#================================================= =============================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
def anime_update
frames = ExtraFramesConfig.char_frames(@character_name)
if frames != 4
@anime_count = 20 if @anime_count > 0 and @pattern == @original_pattern
if @anime_count * (frames - 1) / 4 > 18 - @move_speed * 2
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = @pattern % ($1.to_i - 1) + 1
end
@anime_count = 0
end
else
if @anime_count > 18 - @move_speed * 2
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % 4
end
@anime_count = 0
end
end
end
end