Description:
This script serves to create a ABS very simple to use, although with
options very limited. It will not serve to you as serious ABS (animations and others need)
unless you want a simple appearance.
Demo
http://files.filefront.com/Vlad+ABS+11/;9625579;/fileinfo.html (http://files.filefront.com/Vlad+ABS+11/;9625579;/fileinfo.html)
[spoiler]#===================================
# Vlad ABS
#===================================
#--------------------------------------------------------------
# Créditos a Vlad y Fernando
#--------------------------------------------------------------
# Para Crear un Enemigo, coloca las siguientes anotaciones:
# Enemy ID - donde ID es la ID del enemigo en la base de datos.
# Die X - donde X = 1 o 2 (1 borra el evento de enemigo, 2 pasa al interruptor local 'A')
# Follow - Para que el evento siga al personaje automáticamente.
#--------------------------------------------------------------
# Configuración General
#--------------------------------------------------------------
#--------------------------------------------------------------
# Tecla de Ataque, cambia X por la letra que quieras:
Attack_Button = Input::X
#--------------------------------------------------------------
# Tecla de Habilidad, cambia Y por la letra que quieras:
Skill_Button = {Input::Y => 0}
#--------------------------------------------------------------
# Animación cuando el Héroe sube de Nivel:
LevelUp_Ani = 40
#--------------------------------------------------------------
# Animación de ataque del enemigo, copia Enemy_atk_ani[2] = 13
# y cambia el 2 por la ID del enemigo, y el 13 por la ID de animación.
Enemy_atk_ani = {}
Enemy_atk_ani[2] = 13
#--------------------------------------------------------------
#--------------------------------------------------------------
# Game Character
#--------------------------------------------------------------
class Game_Character
attr_accessor :hp
attr_accessor :mp
attr_accessor :damage
attr_accessor :critical
attr_accessor :wait_ataque
attr_accessor :die
alias vlad_abs_gchar_initialize initialize
def initialize
@hp = 0
@mp = 0
@die = 0
$skill_for_use = 0
@wait_ataque = 0
@damage = nil
@critical = false
vlad_abs_gchar_initialize
end
def recebe_atk(attacker)
attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
self.damage = attacker_status.atk - receptor_status.def
self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
self.damage /= 100
self.damage = 0 if self.damage < 0
self.critical = (rand(100) < 4)
self.damage *= 2 if self.critical
if self.is_a?(Game_Player)
$game_actors[1].hp -= self.damage
if $game_actors[1].hp <= 0
$scene = Scene_Gameover.new
end
elsif self.is_a?(Game_Event)
self.hp -= self.damage
if self.hp <= 0
self.animation_id = 88
$game_actors[1].gain_exp(enemy_status.exp, 1)
if @die == 1
self.erase
elsif @die == 2
key = [$game_map.map_id, self.id, "A"]
$game_self_switches[key] = true
end
refresh
end
end
end
def recebe_skl(attacker)
for key in Skill_Button.keys
sklid = Skill_Button[key]
attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
self.damage = $data_skills[sklid].atk_f - receptor_status.def
self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
self.damage /= 100
self.damage = 0 if self.damage < 0
self.critical = (rand(100) < 4)
self.damage *= 2 if self.critical
attacker_status.mp -= $data_skills[sklid].mp_cost
if self.is_a?(Game_Player)
$game_actors[1].hp -= self.damage
$scene = Scene_Gameover.new if $game_actors[1].hp <= 0
elsif self.is_a?(Game_Event)
self.hp -= self.damage
if self.hp <= 0
$game_actors[1].gain_exp(enemy_status.exp, 1)
if @die == 1
self.erase
elsif @die == 2
key = [$game_map.map_id, self.id, "A"]
$game_self_switches[key] = true
end
refresh
end
end
end
end
def follow_hero(dx, dy)
sx = @x - dx
sy = @y - dy
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == 0
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
return
elsif abs_sy == 0
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
return
end
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
def raio(dx, dy)
ax = (@x - dx) ** 2
ay = (@y - dy) ** 2
return Math.sqrt(ax + ay)
end
end
#--------------------------------------------------------------
# Game Event
#--------------------------------------------------------------
class Game_Event < Game_Character
attr_reader :inimigo
attr_reader :enemy_status
alias vlad_abs_gevent_initialize initialize
alias vlad_abs_gevent_update update
alias vlad_abs_gevent_refresh refresh
def initialize(map_id, event)
@inimigo = false
@automove = false
vlad_abs_gevent_initialize(map_id, event)
end
def check_com(comentario)
return false if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase.include?(comentario.downcase)
return true
end
end
end
end
def check_comment(comentario)
com = comentario.downcase
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
return $1.to_i
end
end
end
return 0
end
def update
vlad_abs_gevent_update
if @inimigo
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
if self.wait_ataque > 0
self.wait_ataque -= 1
elsif $game_player.x == new_x and $game_player.y == new_y
$game_player.recebe_atk(self)
$game_player.animation_id = self.enemy_atk_animation_id
$game_player.jump(0,0)
self.wait_ataque = 60
end
end
if @automove
unless moving?
self.follow_hero($game_player.x, $game_player.y)
end
end
end
def refresh
vlad_abs_gevent_refresh
@inimigo = false
@enemy_id = check_comment("Enemy")
@automove = true if check_com("Follow") == true
@die = check_comment("Die")
if @enemy_id > 0
@inimigo = true
@enemy_status = Game_Enemy.new(@enemy_id, @enemy_id)
self.hp = @enemy_status.maxhp
self.mp = @enemy_status.maxmp
end
end
def enemy_atk_animation_id
if Enemy_atk_ani[@enemy_id]
return (@enemy_status.nil? ? 0 : Enemy_atk_ani[@enemy_id])
else
return (@enemy_status.nil? ? 0 : 1)
end
end
def Enemy_atk_ani
return Enemy_atk_ani
end
end
#--------------------------------------------------------------
# Game Player
#--------------------------------------------------------------
class Game_Player < Game_Character
alias vlad_abs_gplayer_update update
alias vlad_abs_gplayer_refresh refresh
def update
vlad_abs_gplayer_update
if self.wait_ataque > 0
self.wait_ataque -= 1
end
def refresh
vlad_abs_gplayer_refresh
self.hp = $game_actors[1].hp
self.mp = $game_actors[1].mp
end
if Input.trigger?(Attack_Button) and self.wait_ataque <= 0
new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
for event in $game_map.events.values
if event.inimigo
if event.x == new_x and event.y == new_y
event.recebe_atk(self)
event.animation_id = self.player_atk_animation_id
event.jump(0,0)
self.wait_ataque = 30
break
end
end
end
end
for key in Skill_Button.keys
if Input.trigger?(key) and Skill_Button[key] != nil and Skill_Button[key] != 0 and $game_actors[1].mp >= $data_skills[Skill_Button[key]].mp_cost and self.wait_ataque <= 0
new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
for event in $game_map.events.values
if event.inimigo
if event.x == new_x and event.y == new_y
event.recebe_skl(self)
event.animation_id = self.player_skl_animation_id
event.jump(0,0)
self.wait_ataque = 60
break
end
end
end
end
end
def player_atk_animation_id
return ($game_actors[1].nil? ? 0 : $game_actors[1].atk_animation_id)
end
def player_skl_animation_id
for key in Skill_Button.keys
sklid = Skill_Button[key]
return ($game_actors[1].nil? ? 0 : $data_skills[sklid].animation_id)
end
end
def Attack_Button
return Attack_Button
end
def Skill_Button
return Skill_Button
end
end
end
#--------------------------------------------------------------
# Game Actor
#--------------------------------------------------------------
class Game_Actor
alias vlad_abs_change_exp change_exp
def change_exp(exp, show)
last_level = @level
last_skills = skills
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show and @level > last_level
show_level_up
end
vlad_abs_change_exp(exp,show)
end
def show_level_up
$game_player.animation_id = LevelUp_Ani
$game_actors[1].hp = $game_actors[1].maxhp
$game_actors[1].mp = $game_actors[1].maxmp
end
def LevelUp_Ani
return LevelUp_Ani
end
end
#--------------------------------------------------------------
# Sprite Base
#--------------------------------------------------------------
class Sprite_Base
alias animation animation_set_sprites
def animation_set_sprites(frame)
cell_data = frame.cell_data
for i in 0..15
sprite = @animation_sprites[i]
next if sprite == nil
pattern = cell_data[i, 0]
if pattern == nil or pattern == -1
sprite.visible = false
next
end
if pattern < 100
sprite.bitmap = @animation_bitmap1
else
sprite.bitmap = @animation_bitmap2
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
if @animation_mirror
sprite.x = @animation_ox - cell_data[i, 1] / 2
sprite.y = @animation_oy - cell_data[i, 2] / 2
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.x = @animation_ox + cell_data[i, 1] / 2
sprite.y = @animation_oy + cell_data[i, 2] / 2
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
sprite.z = self.z + 300
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 200.0
sprite.zoom_y = cell_data[i, 3] / 200.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
#--------------------------------------------------------------
# Sprite Character
#--------------------------------------------------------------
class Sprite_Character < Sprite_Base
alias vlad_abs_spchar_update update
def initialize(viewport, character = nil)
super(viewport)
@character = character
@balloon_duration = 0
@_damage_duration = 0
update
end
def update
super
if @_damage_duration > 0
@_damage_duration -=1
@_damage_sprite.x = self.x
if @_damage_duration <= 0
dispose_damage
end
end
if @character != nil and @character.damage != nil
damage(@character.damage, @character.critical)
@character.damage = nil
@character.critical = false
end
vlad_abs_spchar_update
end
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Georgia"
bitmap.font.size = 22
bitmap.font.italic = true
if value.is_a?(Numeric) and value <= 0
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 13, 160, 36, "Fallo", 1)
bitmap.font.color.set(255, 245, 155)
bitmap.draw_text(0, 12, 160, 36, "Fallo", 1)
else
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
end
if critical
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 6, 160, 20, "Crítico", 1)
bitmap.font.color.set(255, 245, 155)
bitmap.draw_text(0, 5, 160, 20, "Crítico", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2 - 40
@_damage_sprite.z += 99999
@_damage_duration = 30
end
def show_text(string, size=16, color=0)
dispose_damage
damage_string = string
if string.is_a?(Array)
array = true
else
array = false
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Georgia"
bitmap.font.size = size
bitmap.font.italic = true
if array
for i in 0..string.size
next if damage_string[i] == nil
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 0
bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.font.color.set(255, 245, 155) if color == 0
bitmap.font.color.set(144, 199, 150) if color == 1
bitmap.font.color.set(197, 147, 190)if color == 2
bitmap.font.color.set(138, 204, 198)if color == 3
bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1)
end
else
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 0
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
bitmap.font.color.set(255, 245, 155) if color == 0
bitmap.font.color.set(144, 199, 150) if color == 1
bitmap.font.color.set(197, 147, 190)if color == 2
bitmap.font.color.set(138, 204, 198)if color == 3
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 30
end
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.dispose
@_damage_sprite = nil
end
end
end
#--------------------------------------------------------------
# Window Skill
#--------------------------------------------------------------
class Scene_Skill
alias vlad_abs_sskill_initialize initialize
alias vlad_abs_sskill_update update
def initialize(actor_index = 0, equip_index = 0)
@memory = Window_Command.new(150, ["¡Memorizada!"])
@memory.active = false
@memory.visible = false
@memory.x = (544 - @memory.width) / 2
@memory.y = (416 - @memory.height) / 2
@memory.z = 1500
vlad_abs_sskill_initialize
end
def update
update_skill
@memory.update if @memory.active
return update_memory if @memory.active
vlad_abs_sskill_update
end
def update_skill
for key in Skill_Button.keys
if Input.trigger?(key)
Sound.play_decision
Skill_Button[key] = @skill_window.skill.id
@memory.active = @memory.visible = true
@skill_window.active = false
end
end
end
def update_memory
if Input.trigger?(Input::C)
Sound.play_decision
@memory.active = @memory.visible = false
@skill_window.active = true
end
end
def Skill_Button
return Skill_Button
end
end
#--------------------------------------------------------------
# Fin del ABS
#--------------------------------------------------------------[/spoiler]
CREDITS
Vlad
Nothing here is made by me the website is
http://www.vz4.net/index.php?site/ver-5043 (http://www.vz4.net/index.php?site/ver-5043)
This is for rmvx
For people who dont under stand this abs.
Start an event and call it whatever you want
Add a comment
Comment:enemy (enemy id goes here)
Comment:die (a number goes here i havent figured it out yet)
comment:you can put some like Follow(makes the enemy chase you)or random(you have to set
the event to random for this to work) or leave it blank if u want it to stay still.
An ABS for VX already? That was quick. :o I might check this out. ;D
It works im using it :)
You should have placed [code]Your code[/code] tags around your code.
Since you have not done and some of the code matches BBCode tags some of the code has disappear.
This basically means that if someone copy-pastes the script from your post they will almost certainly get errors.
i edited from the main site i found it from this time with
This is a good simple ABS. Nice find Becky1111! +rep
This looks complicated and I want to know if there are any errors in it I should know about it bfore I start using it.
Please disregard my last post! I didn't read all of the instructions or really anything in here before I posted that.
The only problem I saw was that it's in SPANISH! lol
:nono:
1. Do not double post. (Posting twice in a row)
2. You can delete your own posts. You could have just deleted the post.
3. If you don't want to delete it, then just use the edit button. You don't need second post.
isn't Google awesome? :D
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg230.imageshack.us%2Fimg230%2F4337%2Fgooqi5.gif&hash=1fbd464a13a3388f83e9b9f863b2a13a5efee58c)
Yes, well I hope Vlad makes the ABS better in time.
Most of the topics i made are dead =p i hope this wasnt turn up like the rest
(theres two dead ones in my sig)
Ive made a rmxp section in my forums check it out
click this >>>>Macanseed-orpg (http://www.macanseed.tk)
its missing rgss200.dll or something. thats what it said when i tried to play the demo.
Edit: I translation would help too
im not translating last time i tried i messed up the code
Alright, Vlad's ABS was made using the non translated DLL file. We are using the English version, but I have been searching for RGSS200E.dll and I have found it. Simply extract the DLL into your System32 file and Vlad's ABS test game should work. Now, the game is all in spanish, but I have provided an attached Translation Document that translates his words. I hope this helps. Btw, no it does NOT translate the SCRIPT, only the Demo.
RGSS200E.DLL DOWNLOAD: http://www.sendspace.com/file/4d1qcg
Here's the translated script. I just translated the top to tell you how to configurate the ABS. Hope it helps.
#===================================
# Vlad ABS
#===================================
#--------------------------------------------------------------
# Credits to Vlad
#--------------------------------------------------------------
# To create an enemy, make an event with these annotations:
# Enemy ID - Where ID is the ID number of the enemy in the Database.
# Die X - where X = 1 or 2 (1, erases the event of the enemy,
# 2, passes to the local interrupter A)
# Follow - Makes the event automatically follow the hero.
#--------------------------------------------------------------
# General Configuration
#--------------------------------------------------------------
#--------------------------------------------------------------
# Attack Button, Don't Change: [DEFAULT= A]
Attack_Button = Input::X
#--------------------------------------------------------------
# Ability Button, Don't Change: [DEFAULT= S]
Skill_Button = {Input::Y => 0}
#--------------------------------------------------------------
# LevelUP Animation:
LevelUp_Ani = 40
#--------------------------------------------------------------
# Attack Animation, copy Enemy_atk_ani[2] = 13
# change the 2 to the ID of the enemy, and the 13 to the ID of the animation.
# Example: Enemy_atk_ani[25] = 24
Enemy_atk_ani = {}
Enemy_atk_ani[2] = 13
#--------------------------------------------------------------
#--------------------------------------------------------------
# Game Character
#--------------------------------------------------------------
class Game_Character
attr_accessor :hp
attr_accessor :mp
attr_accessor :damage
attr_accessor :critical
attr_accessor :wait_ataque
attr_accessor :die
alias vlad_abs_gchar_initialize initialize
def initialize
@hp = 0
@mp = 0
@die = 0
$skill_for_use = 0
@wait_ataque = 0
@damage = nil
@critical = false
vlad_abs_gchar_initialize
end
def recebe_atk(attacker)
attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
self.damage = attacker_status.atk - receptor_status.def
self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
self.damage /= 100
self.damage = 0 if self.damage < 0
self.critical = (rand(100) < 4)
self.damage *= 2 if self.critical
if self.is_a?(Game_Player)
$game_actors[1].hp -= self.damage
if $game_actors[1].hp <= 0
$scene = Scene_Gameover.new
end
elsif self.is_a?(Game_Event)
self.hp -= self.damage
if self.hp <= 0
self.animation_id = 88
$game_actors[1].gain_exp(enemy_status.exp, 1)
if @die == 1
self.erase
elsif @die == 2
key = [$game_map.map_id, self.id, "A"]
$game_self_switches[key] = true
end
refresh
end
end
end
def recebe_skl(attacker)
for key in Skill_Button.keys
sklid = Skill_Button[key]
attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
self.damage = $data_skills[sklid].atk_f - receptor_status.def
self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
self.damage /= 100
self.damage = 0 if self.damage < 0
self.critical = (rand(100) < 4)
self.damage *= 2 if self.critical
attacker_status.mp -= $data_skills[sklid].mp_cost
if self.is_a?(Game_Player)
$game_actors[1].hp -= self.damage
$scene = Scene_Gameover.new if $game_actors[1].hp <= 0
elsif self.is_a?(Game_Event)
self.hp -= self.damage
if self.hp <= 0
$game_actors[1].gain_exp(enemy_status.exp, 1)
if @die == 1
self.erase
elsif @die == 2
key = [$game_map.map_id, self.id, "A"]
$game_self_switches[key] = true
end
refresh
end
end
end
end
def follow_hero(dx, dy)
sx = @x - dx
sy = @y - dy
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == 0
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
return
elsif abs_sy == 0
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
return
end
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
def raio(dx, dy)
ax = (@x - dx) ** 2
ay = (@y - dy) ** 2
return Math.sqrt(ax + ay)
end
end
#--------------------------------------------------------------
# Game Event
#--------------------------------------------------------------
class Game_Event < Game_Character
attr_reader :inimigo
attr_reader :enemy_status
alias vlad_abs_gevent_initialize initialize
alias vlad_abs_gevent_update update
alias vlad_abs_gevent_refresh refresh
def initialize(map_id, event)
@inimigo = false
@automove = false
vlad_abs_gevent_initialize(map_id, event)
end
def check_com(comentario)
return false if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase.include?(comentario.downcase)
return true
end
end
end
end
def check_comment(comentario)
com = comentario.downcase
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
return $1.to_i
end
end
end
return 0
end
def update
vlad_abs_gevent_update
if @inimigo
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
if self.wait_ataque > 0
self.wait_ataque -= 1
elsif $game_player.x == new_x and $game_player.y == new_y
$game_player.recebe_atk(self)
$game_player.animation_id = self.enemy_atk_animation_id
$game_player.jump(0,0)
self.wait_ataque = 60
end
end
if @automove
unless moving?
self.follow_hero($game_player.x, $game_player.y)
end
end
end
def refresh
vlad_abs_gevent_refresh
@inimigo = false
@enemy_id = check_comment("Enemy")
@automove = true if check_com("Follow") == true
@die = check_comment("Die")
if @enemy_id > 0
@inimigo = true
@enemy_status = Game_Enemy.new(@enemy_id, @enemy_id)
self.hp = @enemy_status.maxhp
self.mp = @enemy_status.maxmp
end
end
def enemy_atk_animation_id
if Enemy_atk_ani[@enemy_id]
return (@enemy_status.nil? ? 0 : Enemy_atk_ani[@enemy_id])
else
return (@enemy_status.nil? ? 0 : 1)
end
end
def Enemy_atk_ani
return Enemy_atk_ani
end
end
#--------------------------------------------------------------
# Game Player
#--------------------------------------------------------------
class Game_Player < Game_Character
alias vlad_abs_gplayer_update update
alias vlad_abs_gplayer_refresh refresh
def update
vlad_abs_gplayer_update
if self.wait_ataque > 0
self.wait_ataque -= 1
end
def refresh
vlad_abs_gplayer_refresh
self.hp = $game_actors[1].hp
self.mp = $game_actors[1].mp
end
if Input.trigger?(Attack_Button) and self.wait_ataque <= 0
new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
for event in $game_map.events.values
if event.inimigo
if event.x == new_x and event.y == new_y
event.recebe_atk(self)
event.animation_id = self.player_atk_animation_id
event.jump(0,0)
self.wait_ataque = 30
break
end
end
end
end
for key in Skill_Button.keys
if Input.trigger?(key) and Skill_Button[key] != nil and Skill_Button[key] != 0 and $game_actors[1].mp >= $data_skills[Skill_Button[key]].mp_cost and self.wait_ataque <= 0
new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
for event in $game_map.events.values
if event.inimigo
if event.x == new_x and event.y == new_y
event.recebe_skl(self)
event.animation_id = self.player_skl_animation_id
event.jump(0,0)
self.wait_ataque = 60
break
end
end
end
end
end
def player_atk_animation_id
return ($game_actors[1].nil? ? 0 : $game_actors[1].atk_animation_id)
end
def player_skl_animation_id
for key in Skill_Button.keys
sklid = Skill_Button[key]
return ($game_actors[1].nil? ? 0 : $data_skills[sklid].animation_id)
end
end
def Attack_Button
return Attack_Button
end
def Skill_Button
return Skill_Button
end
end
end
#--------------------------------------------------------------
# Game Actor
#--------------------------------------------------------------
class Game_Actor
alias vlad_abs_change_exp change_exp
def change_exp(exp, show)
last_level = @level
last_skills = skills
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show and @level > last_level
show_level_up
end
vlad_abs_change_exp(exp,show)
end
def show_level_up
$game_player.animation_id = LevelUp_Ani
$game_actors[1].hp = $game_actors[1].maxhp
$game_actors[1].mp = $game_actors[1].maxmp
end
def LevelUp_Ani
return LevelUp_Ani
end
end
#--------------------------------------------------------------
# Sprite Base
#--------------------------------------------------------------
class Sprite_Base
alias animation animation_set_sprites
def animation_set_sprites(frame)
cell_data = frame.cell_data
for i in 0..15
sprite = @animation_sprites[i]
next if sprite == nil
pattern = cell_data[i, 0]
if pattern == nil or pattern == -1
sprite.visible = false
next
end
if pattern < 100
sprite.bitmap = @animation_bitmap1
else
sprite.bitmap = @animation_bitmap2
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
if @animation_mirror
sprite.x = @animation_ox - cell_data[i, 1] / 2
sprite.y = @animation_oy - cell_data[i, 2] / 2
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.x = @animation_ox + cell_data[i, 1] / 2
sprite.y = @animation_oy + cell_data[i, 2] / 2
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
sprite.z = self.z + 300
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 200.0
sprite.zoom_y = cell_data[i, 3] / 200.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
#--------------------------------------------------------------
# Sprite Character
#--------------------------------------------------------------
class Sprite_Character < Sprite_Base
alias vlad_abs_spchar_update update
def initialize(viewport, character = nil)
super(viewport)
@character = character
@balloon_duration = 0
@_damage_duration = 0
update
end
def update
super
if @_damage_duration > 0
@_damage_duration -=1
@_damage_sprite.x = self.x
if @_damage_duration <= 0
dispose_damage
end
end
if @character != nil and @character.damage != nil
damage(@character.damage, @character.critical)
@character.damage = nil
@character.critical = false
end
vlad_abs_spchar_update
end
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Georgia"
bitmap.font.size = 22
bitmap.font.italic = true
if value.is_a?(Numeric) and value <= 0
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 13, 160, 36, "Fallo", 1)
bitmap.font.color.set(255, 245, 155)
bitmap.draw_text(0, 12, 160, 36, "Fallo", 1)
else
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
end
if critical
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(1, 6, 160, 20, "Crítico", 1)
bitmap.font.color.set(255, 245, 155)
bitmap.draw_text(0, 5, 160, 20, "Crítico", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2 - 40
@_damage_sprite.z += 99999
@_damage_duration = 30
end
def show_text(string, size=16, color=0)
dispose_damage
damage_string = string
if string.is_a?(Array)
array = true
else
array = false
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Georgia"
bitmap.font.size = size
bitmap.font.italic = true
if array
for i in 0..string.size
next if damage_string[i] == nil
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 0
bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.font.color.set(255, 245, 155) if color == 0
bitmap.font.color.set(144, 199, 150) if color == 1
bitmap.font.color.set(197, 147, 190)if color == 2
bitmap.font.color.set(138, 204, 198)if color == 3
bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1)
end
else
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 0
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
bitmap.font.color.set(255, 245, 155) if color == 0
bitmap.font.color.set(144, 199, 150) if color == 1
bitmap.font.color.set(197, 147, 190)if color == 2
bitmap.font.color.set(138, 204, 198)if color == 3
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 30
end
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.dispose
@_damage_sprite = nil
end
end
end
#--------------------------------------------------------------
# Window Skill
#--------------------------------------------------------------
class Scene_Skill
alias vlad_abs_sskill_initialize initialize
alias vlad_abs_sskill_update update
def initialize(actor_index = 0, equip_index = 0)
@memory = Window_Command.new(150, ["Memorize"])
@memory.active = false
@memory.visible = false
@memory.x = (544 - @memory.width) / 2
@memory.y = (416 - @memory.height) / 2
@memory.z = 1500
vlad_abs_sskill_initialize
end
def update
update_skill
@memory.update if @memory.active
return update_memory if @memory.active
vlad_abs_sskill_update
end
def update_skill
for key in Skill_Button.keys
if Input.trigger?(key)
Sound.play_decision
Skill_Button[key] = @skill_window.skill.id
@memory.active = @memory.visible = true
@skill_window.active = false
end
end
end
def update_memory
if Input.trigger?(Input::C)
Sound.play_decision
@memory.active = @memory.visible = false
@skill_window.active = true
end
end
def Skill_Button
return Skill_Button
end
end
#--------------------------------------------------------------
# FINISH
#--------------------------------------------------------------
Additionally, you need to input this script above the ABS script in order to see the HUD
#=============================================================================
# Window Hud
#=============================================================================
class Window_Hud < Window_Base
def initialize
super(0,0,128,96)
self.opacity = 0
# self.visible = false
refresh
end
def refresh
self.contents.clear
actor = $game_actors[1]
draw_actor_hp(actor, 0, 0, 96)
draw_actor_mp(actor, 0, 32, 96)
end
def update
# self.visible = true if $game_switches[1] == true # 1=interruptor que activa y desactiva el HUD
refresh
end
end
class Scene_Map
alias hud_main main
alias hud_update update
alias hud_terminate terminate
def main
@hud = Window_Hud.new
hud_main
end
def update
@hud.update
hud_update
end
def terminate
@hud.dispose
end
end
So this is how you use the ABS:
Create an Event. You don't have to name it. Now create a graphic for that monster.
Next create THREE comment boxes. In the first one type Enemy ID and replace the ID with the number your enemy is, in the Database
The second comment box should be Die with either 1 or 2, put 1 if you just want the enemy to get killed and disappear.
For the final comment box it should be either Follow or not. If you do not want the enemy following the hero, then don't put this comment box.
So it should look like this:
EXAMPLE:
Comment: Enemy 27
Comment: Die 1
Comment: Follow [OPTIONAL]
wow its english ? i didnt notice i just posted here =p
wooooot FINALLY I MADE IT SO ITS LESS LIMITED and when you attack you hit more then one thing Not Like 1,1,1,1,1,1 I made It like 1,2 ,15,29ETC.:))))))) Time to add guarding. :O Then jumping
Quote from: BECKY1111 on March 24, 2008, 07:26:31 PM
wow its english ? i didnt notice i just posted here =p
No it was originally Spanish, I just translated it.
oh thanks i posted this topic on my forums =)
www.macanseed.co.nr/Forum.php?forumID=2015576&page=1 (http://www.macanseed.co.nr/Forum.php?forumID=2015576&page=1)
No problem ;D
can i post the translated version in my post? (so its quicker)
THIS ROCKS! XEPH, YOU ROCK! AND YOU ROCK AS WELL, LOREHUNTER! No, seriously, this looks pretty cool. Just look at the stuff after the "EDIT:" and answer, me and I'd be happy!
[offtopic] But I rock even more! [/offtopic]
EDIT: But how do you turn off the HUD or the complete ABS? For like cutscenenes and intros...
the code is just a basic abs. The hud might not be able to turn off/on.
but maybe with just a little coding experiance u can make a switch turn it on/off.
It's okay, I found out it seems (not sure how, but I think I did. It doesn't show in the intro at least...)
I think I used a switch for it, I'll try to find out in a sec...
EDIT: Okay, here's what to do: On the line
self.visible = true if $game_switches[id] == true # 1=interruptor que activa y desactiva el HUD
change the id of $game_Switches to whatever switch you wish to use to turn it on/off.
To activate do this:
Control Switches: [[0001]:Disable Hud] = ON
to turn off, do this:
Control Switches: [[0001]:Disable Hud] = OFF
EDIT: Okay, it isn't working... I will have to take an extra look at it...
EDIT: Okay, I changed everything, now it works!
There's a new version of the ABS, v 1.3.
http://crissaegrim-maker.spaces.live.com/default.aspx (http://crissaegrim-maker.spaces.live.com/default.aspx)
Download at the bottom of the page.
For scripters out there, I need to know how to hide the HUD when doing scenes, dialogs, and such.
Looks like all you do is go to the HUD.
Notice this line:
OnOff_Hud_Switch = 0
Change 0 to some positive integer
Then all you need to do is turn the in-game switch that corresponds to that ID to ON or OFF
So, if you set it to 7, then control switch on 7 controls it's visibility.
Oh, now c'mon! I just said that! (Of course, that was with the first version, but still :( )
EDIT: I have a question: How do you change the attack and skill buttons (it says "Don't change" in the comments :'( )
And by the way, the newest version seems to be 1.4, not 1.3!
Ummm I have a small question:
Whats the call code to take the script on and off?
Sorry if you've already answered this, I'm new to scripting
Hm, how do I make the enemy drop random items as it dies, or drop a chest with random items?
Also, is it possible to give the enemies lifebars?^^
I'm sorry if this is a necro post, but does anyone have the latest version of this script? The link to the maker's site doesn't work.
http://www.hbgames.org/forums/index.php?topic=50811.0 (http://www.hbgames.org/forums/index.php?topic=50811.0) New version 2.0.5
Thank you. :)
For some reason all my enemies do always miss me in my game, and when I do it in the example game, they are overpowered and keep hitting me non-stop. How do I solve this?
change the enemy's stats or your evasion....................................duh
Well, in the enemy's event I added this comment: Enemy 1
In the database I set the enemy with database ID #1's agility AND evasion (just to test out) to 100. And it still doesn't work ???.
Please help me out.
100 agility is way high for an enemy O_O
Turn your -player's- stats DOWN