Update #03 - Merry Christmas! Feliz Natal! An add-on for SAS IV!
December 24, 2013
English
Hello Everybody!
Since @zellron and many of you guys wanted an kind of Shield/Block add-on to Sapphire Action System, I decided to make it! I made it yesterday, and recorded me while I was scripting. However, youtube messed up the whole video after I uploaded it to my channel. I recorded it with a superb quality on 1366x768 (the resolution of my monitor), and youtube ruined it. Anyway, the code is below the Portuguese version of this post, be sure to paste it after the SAS script! I hope you like it :D
Merry Christmas to you guys, and stay awesome! Português
Olá pessoal!
Como o @zellron e muitos de vocês pediram um add-on de bloquear ataques pro Sapphire Action System, eu decidi fazê-lo! Eu o escrevi ontem, e gravei tudo enquanto fazia o código. Porém, o youtube deixou a qualidade do vídeo toda zuada. Eu gravei com uma qualidade ótima em 1366x768, mas depois de upar pro youtube ficou horrível! Todavia, o código está logo abaixo, cole-o depois do script do SAS! Eu espero que gostem :D
Feliz natal para todos vocês, fiquem bem!
#-------------------------------------------------------------------------------
# * [ACE] SAS IV Block
#-------------------------------------------------------------------------------
# * By Khas
# * Version: 4.2 EN
# * Released on: 24/12/2013
#
#-------------------------------------------------------------------------------
# * Terms of Use
#-------------------------------------------------------------------------------
# Check the terms of use at my blog! Visit the FAQ page.
#
# Blog: arcthunder.blogspot.com
# Twitter: twitter.com/arcthunder
# Youtube: youtube.com/darkkhas
#
#-------------------------------------------------------------------------------
# * Configuration
#-------------------------------------------------------------------------------
module Block_Core
# Key used to block (default is R, which means W on your keyboard)
Block_Key = Input::R
# Sprite name
# If the current character sprite is "Adam", when the hero is blocking
# it's sprite will be "Adam_block"
Block_Character_Name = "_block"
# Sprite index
Block_Character_Index = 0
# Block duration (in frames)
Block_Duration = 20
# Block cooldown (in frames)
Block_Cooldown = 120
end
#-------------------------------------------------------------------------------
# * Register
#-------------------------------------------------------------------------------
if $khas_awesome.nil?
$khas_awesome = []
end
scripts = []
$khas_awesome.each { |script| scripts << script[0] }
unless scripts.include?("Sapphire Action System")
error = Sprite.new
error.bitmap = Bitmap.new(544,416)
error.bitmap.draw_text(0,208,544,32,"Please install the Sapphire Action System IV",1)
continue = Sprite.new
continue.bitmap = Bitmap.new(544,416)
continue.bitmap.font.color = Color.new(0,255,0)
continue.bitmap.font.size = error.bitmap.font.size - 3
continue.bitmap.draw_text(0,384,544,32,"Press ENTER to exit.",1)
add = Math::PI/80; max = 2*Math::PI; angle = 0
loop do
Graphics.update; Input.update
angle += add; angle %= max
continue.opacity = 185 + 70* Math.cos(angle)
break if Input.trigger?(Input::C)
end
error.bitmap.dispose; continue.bitmap.dispose
error.bitmap = nil; continue.bitmap = nil
error.dispose; continue.dispose
error = nil; continue = nil
exit
end
$khas_awesome << ["SAS BLOCK",4.2]
#-------------------------------------------------------------------------------
# * Script
#-------------------------------------------------------------------------------
class Game_Map
def update_action_system
if Input.trigger?(Input::X)
$game_player.attack
elsif Input.trigger?(Block_Core::Block_Key)
$game_player.block
elsif Input.trigger?(Input::Y)
$game_player.cast_skill
elsif Input.trigger?(Input::Z)
$game_player.next_skill
end
end
end
class Game_Player < Game_Character
alias sasblk_moveto moveto
alias sasblk_update update
alias sasblk_initialize initialize
alias sasblk_damage_hero damage_hero
alias sasblk_skill_damage_hero skill_damage_hero
def initialize
sasblk_initialize
@blocking = false
@block_counter = 0
@block_cooldown = 0
end
def update
sasblk_update
update_block
end
def block
return if @block_cooldown > 0
@block_counter = Block_Core::Block_Duration
@block_cooldown = Block_Core::Block_Cooldown
@blocking = true
@sprite_before_block = @character_name
@index_before_block = @character_index
@character_name = @character_name + Block_Core::Block_Character_Name
@character_index = Block_Core::Block_Character_Index
end
def update_block
if @blocking
if @block_counter > 0
@block_counter -= 1
else
@blocking = false
@character_name = @sprite_before_block
@character_index = @index_before_block
end
end
@block_cooldown -= 1 if @block_cooldown > 0
end
def reset_block
if @blocking
@character_name = @sprite_before_block
@character_index = @index_before_block
end
@block_counter = 0
@block_cooldown = 0
@blocking = false
end
def moveto(x,y)
reset_block
sasblk_moveto(x,y)
end
def damage_hero(d)
@blocking ? $game_map.show_text(self,"Block!") : sasblk_damage_hero(d)
end
def skill_damage_hero(d)
@blocking ? $game_map.show_text(self,"Block!") : sasblk_skill_damage_hero(d)
end
end