Add-on to ABS
#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.

you need to have near abs
look in class Action_Battle_System and look for the function called event_non_dead?(enemy)
replace it with the one below

Code:
def event_non_dead?(enemy)
    if enemy.dead?
      if enemy.engaged[1] == 0
        @player_engaged = false
      else
        $game_allies[enemy.engaged[1]].under_attack = false
      end
      treasure(enemy)
      id = enemy.event_id
      $game_system.death_enemy.push(id) #NEW
      @enemies.delete(id)
      event = $game_map.events[enemy.event_id]
      event.character_name = ""
      case enemy.trigger[0]
      when 0
        event.erase
      when 1
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
        $game_switches[enemy.trigger[1]] = true
        $game_map.need_refresh = true
      when 2
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
         if enemy.trigger[2] == 0
           $game_variables[enemy.trigger[1]] += 1
          $game_map.need_refresh = true
        else
          $game_variables[enemy.trigger[1]] = enemy.trigger[2]
          $game_map.need_refresh = true
        end
      when 3
        value = "A" if enemy.trigger[1] == 1
        value = "B" if enemy.trigger[1] == 2
        value = "C" if enemy.trigger[1] == 3
        value = "D" if enemy.trigger[1] == 4
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
        key = [$game_map.map_id, event.id, value]
        $game_self_switches[key] = true
        $game_map.need_refresh = true
      end
      return false
    end
    return true
  end








THE SCRIPT IS UPDATED
make a new script above the main and add this
Code:
class Scene_Map
alias main_main main
def main
$hpbar = Bar.new(0)
main_main
end
alias new_update update
def update
$hpbar.update
new_update
end
end

class Scene_Menu
alias menu_int initialize
def initialize
if !$hpbar.circle.nil? && !$hpbar.circle.disposed?
$hpbar.circle.bitmap.dispose
$hpbar.circle.dispose
end
$hpbar.dispose if !$hpbar.nil? && !$hpbar.disposed?
for i in 1...$game_system.circles.size
if !$game_system.circles[i].bitmap.nil? && !$game_system.circles[i].nil? && !$game_system.circles[i].disposed?
$game_system.circles[i].bitmap.dispose
end
end
menu_int
end
end

class Game_System
attr_accessor :enemy
attr_accessor :death_enemy
attr_accessor :enemy_hp
attr_accessor :enemy_sp
attr_accessor :circles
alias update_int initialize
def initialize
@enemy = []
@death_enemy = []
@enemy_hp = []
@enemy_sp = []
@circles = []
for i in 1...$data_enemies.size
@enemy_hp[i] = $data_enemies[i].maxhp
end
for i in 1...$data_enemies.size
@enemy_sp[i] = $data_enemies[i].maxsp
end
for i in 1...$data_enemies.size
@circles[i] = Sprite.new
end
update_int
end
end



class Bar < Window_Base
attr_reader :circle
def initialize(id)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 14
@id = id
self.opacity = 0
@circle = Sprite.new
@circle.bitmap = RPG::Cache.picture("circle")
refresh
end
def draw_bar(actor, x , y)
  v1, v2 = 0,0
self.contents.fill_rect(x, y - 10, calculateHP(actor.hp, actor.maxhp), 5, Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, calculateHP(actor.sp, actor.maxsp), 5, Color.new(0, 250, 0, 250))
self.contents.font.color = Color.new(0,0,0,180)
if $game_system.enemy.size > 0
$game_system.enemy.uniq!
for i in 0...$game_system.enemy.size
v1, v2 = $game_system.enemy[i][0], $game_system.enemy[i][1]
if $game_system.death_enemy.include?(v2)
$game_system.circles[v1].bitmap.dispose
$game_system.circles[v1].dispose
$game_system.enemy.delete_at(i)
$game_system.circles.delete_at(i)
$game_system.death_enemy.delete(v2)
next
end
begin
tempx = $game_map.events[v2].screen_x - 25
tempy = $game_map.events[v2].screen_y - 73
cx = $game_map.events[v2].screen_x - 14
cy = $game_map.events[v2].screen_y - 27
rescue NoMethodError
print "EVENT OR ENEMY ID DOES NOT EXIT"
exit
end
$game_system.circles[v1].bitmap = RPG::Cache.picture("circlee")
$game_system.circles[v1].x = cx
$game_system.circles[v1].y = cy - 5
$game_system.circles[v1].z = 1000
hp, sp, name =
$data_enemies[v1].maxhp, $data_enemies[v1].maxsp, $data_enemies[v1].name;
maxhp, maxsp = $game_system.enemy_hp[v1], $game_system.enemy_sp[v1]
self.contents.fill_rect(tempx, tempy - 10, calculateHP(hp, maxhp), 5, Color.new(255, 0, 0, 255))
self.contents.fill_rect(tempx, tempy, calculateHP(sp, maxsp), 5, Color.new(0, 250, 0, 250))
self.contents.font.color = Color.new(0,0,0,180)
self.contents.draw_text(tempx - 9 , tempy+48, 120, 32, name)
end
end
self.contents.draw_text(x - 9 , y+48, 120, 32, actor.name)
end
def refresh
self.contents.clear
actor = $game_party.actors[@id]
draw_bar(actor, $game_player.screen_x - 25, $game_player.screen_y - 73)
x = $game_player.screen_x - 14
y = $game_player.screen_y - 27
@circle.x = x
@circle.y = y
@circle.z = 9
end

def calculateHP(currentHP, maxHP)
return (currentHP / maxHP.to_f) * 30
end





def update
refresh
@circle.update if !@circle.nil?
for i in 1...$game_system.circles.size
sprite = $game_system.circles[i]
if !sprite.nil? && !sprite.bitmap.nil? && !sprite.disposed?
sprite.update
end
end
end
end

add this image file to your picture folder
[Image: circle.PNG]
[Image: circlee.PNG]


INSTRUCTION

to add enemy stats for display do this

$game_system.enemy.push([enemyid, eventusingenemyid])
remember all id start from 1
example,
if enemy event is event 001 and the enemy id is 1
you will do this
$game_system.enemy.push([1,1])

#note: the reason i used this method, is because i have not checked near abs. so i am not sure how he setup his battle system. But enjoy
}




Users browsing this thread: 1 Guest(s)