A New HUD (Prexus ABS)

[SIZE=6]New HUD for Prexus' ABS
[SIZE=2]Version 1.0

[/SIZE]
Introduction

[/SIZE][LEFT]This is a new HUD design for Prexus' ABS, based off the Zelda 64 games. It's a nice change on the default HUD that comes with the script. This script REQUIRES the SDK, as does Prexus' ABS itself.

[/LEFT]
Script

[LEFT]Paste this script below Prexus' ABS. Follow the instuctions of Prexus' ABS to use it.
#==============================================================================
# ** Prexus ABS HUD
#------------------------------------------------------------------------------
# MeisMe
# Version 1.0
# September 2006
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------

SDK.log('Prexus ABS HUD', 'MeisMe', 1, 'September 2006')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------

if (SDK.state('Prexus ABS') == true && SDK.state('Prexus ABS HUD') == true)
 
  class ABS
    class Window_Hud < Window_Base
      attr_accessor :action_text
      def initialize
        super(-16, -16, 672, 512)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = "Georgia"
        self.contents.font.bold = true
        self.contents.font.size = 14
        self.opacity = 0
        self.contents_opacity = $game_player.screen_y < 128 ? 90 : 255
        @hp = 0
        @maxhp = 0
        @sp = 0
        @maxsp = 0
        @action_text = ''
        refresh
      end
      def refresh
        self.contents.clear
        @hp = $game_party.actors[0].hp
        @maxhp = $game_party.actors[0].maxhp
        @sp = $game_party.actors[0].sp
        @maxsp = $game_party.actors[0].maxsp
        @weapon = $game_party.actors[0].weapon_id
        @text = @action_text
        @x = 32
        #---------------------------------------------------------------------
        # * Draw HUD Icons
        #---------------------------------------------------------------------
        bitmap = RPG::Cache.icon('Attack Icon')
        opacity = $ABS.player.weapon_id == 0 ? 160 : 255
        self.contents.blt(383, 15, bitmap, Rect.new(0, 0, 34, 34), opacity)
        if $ABS.player.weapon_id != 0
          bitmap = RPG::Cache.icon($data_weapons[$ABS.player.weapon_id].icon_name)
          self.contents.blt(383 + 5, 20, bitmap, Rect.new(0, 0, 24, 24))
        end
        bitmap = RPG::Cache.icon('Action Icon')
        self.contents.blt(438, 15, bitmap, Rect.new(0, 0, 34, 34))
        self.contents.font.color = Color.new(0,0,0)
        self.contents.draw_text(422, 24, 68, 12, @text, 1)
        self.contents.font.color = normal_color
        self.contents.draw_text(421, 25, 68, 12, @text, 1)
        bitmap = RPG::Cache.icon('Skill Icon')
        opacity = $ABS.player.abs.hot_key[0] ? 255 : 160
        self.contents.blt(493, 15, bitmap, Rect.new(0, 0, 34, 34), opacity)
        if $ABS.player.abs.hot_key[0]
          skill = $data_skills[$ABS.player.abs.hot_key[0]]
          bitmap = RPG::Cache.icon(skill.icon_name)
          self.contents.blt(493 + 5, 20, bitmap, Rect.new(0, 0, 24, 24))
          self.contents.font.color = Color.new(0,0,0)
          self.contents.draw_text(494, 44, 16, 12, "x")
          self.contents.draw_text(502, 44, 24, 12, skill.sp_cost.to_s, 2)
          self.contents.font.color = $ABS.player.sp >= skill.sp_cost ?
                                       normal_color : Color.new(255,0,0)
          self.contents.draw_text(493, 45, 16, 12, "x")
          self.contents.draw_text(501, 45, 24, 12, skill.sp_cost.to_s, 2)
        end
        bitmap = RPG::Cache.icon('Skill Icon')
        opacity = $ABS.player.abs.hot_key[1] ? 255 : 160
        self.contents.blt(527, 30, bitmap, Rect.new(0, 0, 34, 34), opacity)
        if $ABS.player.abs.hot_key[1]
          skill = $data_skills[$ABS.player.abs.hot_key[1]]
          bitmap = RPG::Cache.icon(skill.icon_name)
          self.contents.blt(527 + 5, 35, bitmap, Rect.new(0, 0, 24, 24))
          self.contents.font.color = Color.new(0,0,0)
          self.contents.draw_text(528, 59, 16, 12, "y")
          self.contents.draw_text(536, 59, 24, 12, skill.sp_cost.to_s, 2)
          self.contents.font.color = $ABS.player.sp >= skill.sp_cost ?
                                       normal_color : Color.new(255,0,0)
          self.contents.draw_text(527, 60, 16, 12, "y")
          self.contents.draw_text(535, 60, 24, 12, skill.sp_cost.to_s, 2)
        end
        bitmap = RPG::Cache.icon('Skill Icon')
        opacity = $ABS.player.abs.hot_key[2] ? 255 : 160
        self.contents.blt(561, 15, bitmap, Rect.new(0, 0, 34, 34), opacity)
        if $ABS.player.abs.hot_key[2]
          skill = $data_skills[$ABS.player.abs.hot_key[2]]
          bitmap = RPG::Cache.icon(skill.icon_name)
          self.contents.blt(561 + 5, 20, bitmap, Rect.new(0, 0, 24, 24))
          self.contents.font.color = Color.new(0,0,0)
          self.contents.draw_text(562, 44, 16, 12, "z")
          self.contents.draw_text(570, 44, 24, 12, skill.sp_cost.to_s, 2)
          self.contents.font.color = $ABS.player.sp >= skill.sp_cost ?
                                       normal_color : Color.new(255,0,0)
          self.contents.draw_text(561, 45, 16, 12, "z")
          self.contents.draw_text(569, 45, 24, 12, skill.sp_cost.to_s, 2)
        end
        #---------------------------------------------------------------------
        # * Draw HP and SP Bars and Text
        #---------------------------------------------------------------------
        #hpp = (@hp.to_f / @maxhp) * 100
        @y = 16
        hearts = @maxhp / 250
        for i in 1..hearts
          x = ((i - 1) % 20) * 16 + @x
          y = ((i - 1) / 20) * 16 + 4
          if @hp >= i * 250
            bitmap = RPG::Cache.icon('HeartF')
          elsif (@hp < i * 250) && (@hp > (i - 1) * 250)
            bitmap = RPG::Cache.icon('HeartH')
          else
            bitmap = RPG::Cache.icon('HeartE')
          end
          self.contents.blt(x, y + 8, bitmap, Rect.new(0, 0, 16, 16))
        end
        if @maxsp != 0
          length = @maxsp / 25
          spp = (@sp.to_f / @maxsp) * length
          self.contents.fill_rect(@x + 2, @y + 34, length + 2, 16, Color.new(255, 255, 255))
          self.contents.fill_rect(@x + 1, @y + 35, length + 4, 14, Color.new(255, 255, 255))
          self.contents.fill_rect(@x, @y + 36, length + 6, 12, Color.new(255, 255, 255))
          self.contents.fill_rect(@x + 3, @y + 36, length, 12, Color.new(0, 0, 0))
          self.contents.fill_rect(@x + 3, @y + 36, spp, 12, Color.new(0, 155, 0))
          self.contents.fill_rect(@x + 3, @y + 38, spp, 8, Color.new(0, 200, 0))
          self.contents.fill_rect(@x + 3, @y + 39, spp, 6, Color.new(0, 225, 0))
          self.contents.fill_rect(@x + 3, @y + 40, spp, 4, Color.new(0, 255, 0))
        end
      end
      #-----------------------------------------------------------------------
      def update
        refresh unless (@hp == $game_party.actors[0].hp and
                        @maxhp == $game_party.actors[0].maxhp and
                        @sp == $game_party.actors[0].sp and
                        @maxsp == $game_party.actors[0].maxsp and
                        @weapon == $game_party.actors[0].weapon_id and
                        @text == @action_text)
        if $game_player.screen_y < 128
          self.contents_opacity -= 15 if self.contents_opacity > 90
        else
          self.contents_opacity += 15 if self.contents_opacity < 255
        end
      end
    end
    attr_accessor :action_triggers
    alias hud_initialize initialize
    alias hud_setup_enemies setup_enemies
    def initialize
      hud_initialize
      @action_triggers = {}
    end
   
    def setup_enemies(events)
      @action_triggers = {}
      for event in events.values
        parameter = SDK.event_comment_input(event, 1, 'Action Trigger')
        next if !parameter
        text = parameter[0].split
        @action_triggers[event.id] = text.to_s
      end
      hud_setup_enemies(events)
    end
   
    def check_straight_facing(element, object)
      element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
      object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
      if element.direction == 2
        return true if object.y > element.y
      end
      if element.direction == 4
        return true if object.x < element.x
      end
      if element.direction == 6
        return true if object.x > element.x
      end
      if element.direction == 8
        return true if object.y < element.y
      end
      return false
    end
  end

  class Scene_Map
    alias hud_update update
    def update
      for event in $game_map.events.values
        if ($ABS.check_range($game_player, event, 1) and
            $ABS.check_straight_facing($game_player, event))
          if $ABS.action_triggers[event.id]
            @hud_window.action_text = $ABS.action_triggers[event.id]
          end
          break
        else
          @hud_window.action_text = ''
        end
      end
      hud_update
    end
  end
 
     
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------

end
Expand to see the code.


[CENTER]Images

[LEFT]You can make your own images using the following requirements, or use the one in the demo. All images go into the "Graphics/Icons" directory.
  • Weapon Icon: 34x34 "Attack Icon"
  • Action Icon: 34x34 "Action Icon"
  • Skill Icon: 34x34 "Skill Icon:
  • Full Heart: 16x16 "HeartF"
  • Damaged Heart: 16x16 "HeartH"
  • Empy Heart: 16x16 "HeartE"
[/LEFT]

[/LEFT]
Demo


Screens

[LEFT]http://i12.photobucket.com/albums/a229/meismeofcourse/PrexHUDDemo1.png[/IMG]
http://i12.photobucket.com/albums/a229/ ... DDemo2.png[/IMG]
http://i12.photobucket.com/albums/a229/ ... DDemo3.png[/IMG]

[/LEFT]
Info

[LEFT]To make the action button say something when you face an event, put two comments at the start of the event. In the first one, put "Action Trigger" without the quotes. In the second one, put what ever the text will be, without any spaces.
[/LEFT]
[/CENTER]
Whoa. this is very impressive, Meisme. This HUD is spectacular; nice work. ^_^
i agree.
this is nice Meisme good work!
Wow Zelda reborn. Lol good work!
Thanks for making this MeisMe, it really turned out great!
I'm not to keen on HUD's... but this one is very nicely done.. very Ocarina of time-esque... good job!
indeed that was my first impression when i saw it.
Looks very similar to Ocarina of Time.

Very well done.
Yeah same here, its looks SO mych like it :) I bet you can make it more like it if you could make so you can assign 4 spells to a,s,d,f, :) That'd be so cool! ;) -giving you a hint to help him with a script-
MistTribe, I cannot do that, unless PRexus makes that into his ABS. I just made a new HUD for it, but he made the base. So, Prexus doesn't make it, I can't make it.
Very impressive... I'll study you hearts code to make a modification...maybe a FF: CC HUD would be great, too.
An FF:CC HUD would be pretty good. Get to work MeisMe *whipcrack*
Once I know what FF:CC is, then I can make the HUD ;)
Final Fantasy Crstyal Chronicles....woot!
Very nice!!

Hm... IÂÂÂ ´m not to good with scripts... The hearts andd SP-bar doesnÂÂÂ ´t show. I think itÂÂÂ ´s because the hero starts with 20 SP/HP. How do I fix this? And also, how do I get text in the action button?

Thanks!
There is 250 HP for each heart, and one pixel for the MP bar is, I think, 50MP. That's why they won't show.
To show the Action Text, the first and second commands in an event must be the following:
@>Comment: Action Trigger
@>Comment: TEXT
Expand to see the code.
Thanks!

IÂÂÂ ´ll just change the HP/SP values in my game, and your HUD will fit just fine! And the Action Text works like a greased midget. Thanks again!
it's cool :), just one problem tough, if you have a picture that's filling the hole screen, and enables the abs, the hud won't show, any directions of how to do so that the icons of the HUD, is at top of all layers
I would love to use this HUD, but this error appears:

http://i79.imagethrust.com/images/33H5/view-image/untitled.html
Hi I'm using the latest version, legal English copy. No other scripts running(Besides Prexus ABS script and SDK). When I use this script I get an error that says "Script 'Prexus ABS (HUD)' Line 214: NoMethod error occured. Undefined method 'action_text=' for nil:NilClass.

I'm new at scripting, so I'm not sure what is wrong.
Ohhh i want this =( but i cant get it to work without the demo!! i had it before but everything on my computer got deleted and i was gonna download it again but the links are down!! so can anyone who has this demo please upload it again?!?!
I tried using the hud and nothing at all shows in the game, any help?
P.S. The demo links are broken.
Did you make the icons needed?

And yes, could you update the demo links* please, otherwise HUD looks impressive.
I wasn't using the real prexus abs I was using the realistic abs
But I've tried it out in the real version and I get this script error that says:
unidentified local variable or method 'action text' any help?

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=9001