ABS Add-On
#1
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.


I am worked on this script:

Code:
#--------------------------------------------------------------------------
#HP bars for all ABS enemies
#By Takanuva Hagah
#--------------------------------------------------------------------------
class Window_Enemy < Window_Base
def initialize
super(-16, -16, 672, 640)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
self.contents.font.size = 14
@old_x = []
@old_y = []
@old_hp = []
@old_enemy = $ABS.enemies.size
for i in 0...$ABS.enemies.size
@old_x.push($game_map.events[$ABS.enemies.values[i].event_id].real_x)
@old_y.push($game_map.events[$ABS.enemies.values[i].event_id].real_y)
@old_hp.push($ABS.enemies.values[i].hp)
end
@player_x = $game_player.real_x
@player_y = $game_player.real_y
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(6, 28, 32, 14, "")
self.contents.font.color = normal_color
for i in 0...$ABS.enemies.size
event_z = $ABS.enemies.values[i].event_id
x = ($game_map.events[event_z].real_x - $game_map.display_x) / 4
y = ($game_map.events[event_z].real_y - $game_map.display_y) / 4
data_id = $ABS.enemies.values[i].id
e2 = $data_enemies[data_id].maxhp
e1 = $ABS.enemies.values[i].hp
self.contents.draw_text(x+3, y+30, 73, 14, $ABS.enemies.values[i].name)
draw_enemy_bar("", x+3, y+50, 30, 5, Color.new(255, 0, 0), Color.new(155, 0, 0), e1, e2)
end
end
def update
super
if @old_enemy != $ABS.enemies.size
refresh
@old_enemy = $ABS.enemies.size
end
if @player_x != $game_player.real_x or
@player_y != $game_player.real_y
refresh
@player_x = $game_player.real_x
@player_y = $game_player.real_y
end
for i in 0...$ABS.enemies.size
if @old_x[i] != $game_map.events[$ABS.enemies.values[i].event_id].real_x or
@old_y[i] != $game_map.events[$ABS.enemies.values[i].event_id].real_y or
@old_hp[i] != $ABS.enemies.values[i].hp
refresh
@old_x[i] = $game_map.events[$ABS.enemies.values[i].event_id].real_x
@old_y[i] = $game_map.events[$ABS.enemies.values[i].event_id].real_y
@old_hp[i] = $ABS.enemies.values[i].hp
end
end
end
def draw_enemy_bar(actor, x, y, length, thick, c1, c2, e1, e2)
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
end
class Scene_Map
alias enemy_scene_map_main main
alias enemy_scene_map_update update
def main
@enemy = Window_Enemy.new
enemy_scene_map_main
@enemy.dispose
end
def update
@enemy.update
enemy_scene_map_update
end
end


No need setup... :P
Include this script above Main and launch (this need ABS 4)
}




Users browsing this thread: 2 Guest(s)