Samo's CASS (Custom Ability and Skill System)
v1.0 by Samo, the thief
Feb 9 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
CODE:
-----
here it is:
CODE
Code:
#==============================================================================
#Samo's CASS (Custom Ability and Skill System)
#v1.0 by Samo, the thief
#
#
#
#-Just place this script Above Main
#-NEED THE ICONS "Passive", "Offensive", "Others" in the icon folder.
#FEAUTURES:
#----------
#Gives a classification of skills depending on passive, offensive, or others.
#Have an info window. Have map bakcground. Animations.
# Nicer colors, etc.
#
#Enjoy and give me the credit if you use it!
#------------------------------------------------------------------------------
class Scene_Skill
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@help_window.y = 480
@help_window.z = 10000
@help_window.opacity = 225
@information_window = Window_Samo_Information.new (nil)
@information_window.visible = true
@information_window.z = 10000
@information_window.x = 640
@information_window.opacity = 200
@command_window = Window_Samo_SkillCommand.new
@command_window.active = true
@command_window.z = 10000
@command_window.y = -64
@command_window.opacity = 225
@status_window = Window_Samo_SkillStatus.new(@actor)
@status_window.y = 480
@status_window.opacity = 215
@skill_window = Window_Samo_Skill.new(@actor)
@skill_window.active = false
@skill_window.z = 10000
@skill_window.x = -320
@skill_window.help_window = @help_window
@skill_window.opacity = 200
@target_window = Window_Samo_Target.new
@target_window.visible = false
@target_window.active = false
@target_window.z = 20000
@target_window.x = 640
@target_window.opacity = 245
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
@command_window.dispose
@spriteset.dispose
@information_window.dispose
end
#--------------------------------------------------------------------------
def update
if @help_window.y != 416
@help_window.y -= 4
end
if @command_window.y != 0
@command_window.y += 4
end
if @skill_window.x != 0
@skill_window.x += 20
end
if @target_window.x != 320
@target_window.x -= 20
end
if @information_window.x != 320
@information_window.x -= 20
end
if @status_window.y != 352
@status_window.y -= 8
end
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
@command_window.update
@information_window.update
if @command_window.active
update_command
return
end
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end
def update_command
if Input.press?(Input::LEFT) or Input.press?(Input::RIGHT)
case @command_window.index
when 0
@skill_window.index = 0
@skill_window.refresh (0)
when 1
@skill_window.index = 0
@skill_window.refresh (1)
when 2
@skill_window.index = 0
@skill_window.refresh (2)
end
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
@information_window.refresh (@skill)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
def update_skill
if Input.press?(Input::UP) or Input.press?(Input::DOWN)
@skill = @skill_window.skill
@information_window.refresh (@skill)
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = false
@command_window.active = true
@skill = nil
@information_window.refresh (@skill)
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.x = 640
@target_window.visible = true
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh (@type)
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh(@command_window.index)
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# ■ Window_SkillStatus
#------------------------------------------------------------------------------
# Esta ventana muestra el estado de Magia del jugador en la
# Pantalla de Habilidades
#==============================================================================
class Window_Samo_SkillStatus < Window_Base
#--------------------------------------------------------------------------
# - Inicio de Objetos...
# actor : Personaje
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 352, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Times New Roman"
self.contents.font.size = 20
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Actualizacion
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 30, 46)
draw_actor_name(@actor, 50, 0)
draw_actor_state(@actor, 140, 0)
draw_actor_hp(@actor, 284, 0)
draw_actor_sp(@actor, 460, 0)
end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# Esta pantalla muestra las habilidades
#==============================================================================
class Window_Samo_Skill < Window_Selectable
#--------------------------------------------------------------------------
# - Inicio de Objetos...
# actor : Personaje
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 320, 290)
@actor = actor
@column_max = 1
refresh (0)
self.index = 0
# Si esta en batalla, mover ventana al centro y hacer translucidez
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# - Uso de Habilidades
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Actualizacion
# case skill.scope
#when 1
# "Un enemigo"
# when 2
# Todos los enemigos")
# when 3
# "Un aliado")
# when 4
# "Todos los aliados")
# when 5
# "Aliados debilitados")
# when 6
# "Usuario")
# end
#
#--------------------------------------------------------------------------
def refresh(type)
@type = type
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
case @type
when 0
if skill.scope == 3 or skill.scope == 4 or skill.scope == 5 or skill.scope == 6 or skill.scope == 7
@data.push(skill)
end
when 1
if skill.scope == 1 or skill.scope == 2
@data.push(skill)
end
when 2
if skill.scope == 0
@data.push(skill)
end
end
end
end
# Numero de objetos. Si no es 0, crear Bitmap y dibujarlos todos
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 20
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Dibujando objetos...
# index : Numero de objeto
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
@opacity = 255
else
@opacity = 128
end
case @type
when 0
@color = Color.new(160,255,170,@opacity)
when 1
@color = Color.new(255,105,81,@opacity)
when 2
@color = Color.new(255,255,170,@opacity)
end
self.contents.font.color = @color
x = 4 + index % 2
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), @opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# - Renovacion del archivo de ayuda
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# Window_Target
#------------------------------------------------------------------------------
#Es la ventana que aparece al usar un objeto o una tecnica para seleccionar al objetivo de estos
#==============================================================================
class Window_Samo_Target < Window_Selectable
#--------------------------------------------------------------------------
# - Inicializar objeto
#--------------------------------------------------------------------------
def initialize
super(320, 0, 320, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Times New Roman"
self.contents.font.size = 16
self.z += 10
@item_max = $game_party.actors.size
refresh
end
#--------------------------------------------------------------------------
# - Refrescar
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = Color.new(60,175,0,255)
for i in 0...$game_party.actors.size
x = 10
y = i * 116
actor = $game_party.actors[i]
draw_actor_graphic(actor, 12, y + 48)
draw_actor_name(actor, x + 12, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp(actor, x + 152, y + 64)
end
end
#--------------------------------------------------------------------------
# -La renovación del rectángulo de cursor
#--------------------------------------------------------------------------
def update_cursor_rect
# Se eleige la posicion actual -1
if @index < 0
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
self.contents.font.color = color
draw_skill_info
self.contents.blt(2, 32, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 32, 212, 32, @skill.name, 0)
end
end
def draw_skill_info
if @skill.sp_cost != 0
self.contents.draw_text(28, 56, 212, 32, "SP Cost:", 0)
self.contents.draw_text(128, 56, 212, 32, @skill.sp_cost.to_s, 0)
end
if @skill.power != 0
if @skill.power > 0
self.contents.draw_text(28, 80, 212, 32, "Power:", 0)
@value = @skill.power
elsif @skill.power < 0
self.contents.draw_text(28, 80, 212, 32, "Heal:", 0)
@value = @skill.power * -1
end
self.contents.draw_text(128, 80, 212, 32, @value.to_s, 0)
end
case @skill.scope
when 0
@range = "None"
when 1
@range = "One Enemy"
when 2
@range ="All Enemies"
when 3
@range ="One Ally"
when 4
@range ="All Allies"
when 5
@range = "Ko'ed Allies"
when 7
@range = "User"
end
if @skill.scope != 0
self.contents.draw_text(28, 128, 212, 32, "Range:", 0)
self.contents.draw_text(128, 128, 212, 32, @range, 0)
end
if @skill.element_set != []
self.contents.draw_text(200, 56, 212, 32, "Element:", 0)
element_data = []
for i in 1...$data_system.elements.size
if @skill.element_set.include?(i)
element_data.push($data_system.elements[i])
end
end
for i in 0...element_data.size
self.contents.font.size = 16
self.contents.draw_text(200 + ((i % 2) * 45), 76 + (i / 2 * 12), 120, 32, element_data[i])
end
end
if @skill.plus_state_set != []
self.contents.draw_text(200, 126, 212, 32, "Inflicts:", 0)
plus_status_data = []
for i in 1...$data_states.size
if @skill.plus_state_set.include?(i)
plus_status_data.push($data_states[i].name)
end
end
for i in 0...plus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(200 + ((i % 2) * 45), 146 + (i / 2 * 12), 120, 32, plus_status_data[i])
end
end
if @skill.minus_state_set != []
self.contents.draw_text(28, 152, 212, 32, "Remove:", 0)
minus_status_data = []
for i in 1...$data_states.size
if @skill.minus_state_set.include?(i)
minus_status_data.push($data_states[i].name)
end
end
for i in 0...minus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(28 + ((i % 2) * 45), 172 + (i / 2 * 12), 120, 32, minus_status_data[i])
end
end
end
end
INSTRUCTIONS:
-------------
Code:
#==============================================================================
#Samo's CASS (Custom Ability and Skill System)
#v1.0 by Samo, the thief
#
#
#
#-Just place this script Above Main
#-NEED THE ICONS "Passive", "Offensive", "Others" in the icon folder.
#FEAUTURES:
#----------
#Gives a classification of skills depending on passive, offensive, or others.
#Have an info window. Have map bakcground. Animations.
# Nicer colors, etc.
#------------------------------------------------------------------------------