In sight script thing + HP Bar

Started by Futendra, January 01, 2011, 09:40:14 am

Previous topic - Next topic

Futendra

January 01, 2011, 09:40:14 am Last Edit: January 01, 2011, 11:02:45 am by Futendra
In Sight
Well I saw on some games that there ae scenes like this:

  • You got to to walk to the other side
  • When the guards see you, game over
  • The guards are turning around all the time and the sight does change
  • Guards have sights

    Can someone help me with this?

    My scene is:

    You got to escape form a prison but there are some guards

    HP Bar
    I need HP bars for my 4 members, they can be round or whatever, but I would love to have a colortheme like this:

    Just the colors, It doesnt need to be animated.

    The script I use for animated Bars in battle:

    Spoiler: ShowHide
    # HP/SP gauge animation indication Ver1.03
    # 07/01/11
    # Distribution original support URL
    # http://members.jcom.home.ne.jp/cogwheel/

    #==============================================================================
    # ** Game_Actor
    #------------------------------------------------------------------------------
    #  This class handles the actor. It's used within the Game_Actors class
    #  ($game_actors) and refers to the Game_Party class ($game_party).
    #==============================================================================

    class Game_Actor < Game_Battler
      def now_exp
        return @exp - @exp_list[@level]
      end
      def next_exp
        return (@exp_list[@level+1] > 0 ?
          @exp_list[@level+1] - @exp_list[@level] : 0)
      end
    end

    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This class is for all in-game windows.
    #==============================================================================

    class Window_Base < Window
      #--------------------------------------------------------------------------
      # * Object Initialization
      #     x      : window x-coordinate
      #     y      : window y-coordinate
      #     width  : window width
      #     height : window height
      #--------------------------------------------------------------------------
      alias :initialize_gauge :initialize
      def initialize(x, y, width, height)
        initialize_gauge(x, y, width, height)
        # Initialize HP and SP gauge values
        @hp_gauge = {}
        @sp_gauge = {}
      end
      #--------------------------------------------------------------------------
      # * Dispose
      #--------------------------------------------------------------------------
      alias :dispose_gauge :dispose
      def dispose
        # ƒQ[ƒW,̍폜
        gauge_delete
        # ƒIƒŠƒWƒiƒ‹,̉ð•úˆ--
        dispose_gauge
      end
      #--------------------------------------------------------------------------
      # * Gauge Delete
      #--------------------------------------------------------------------------
      def gauge_delete
        # HP ƒQ[ƒW,̏Á‹Ž
        for gauge in @hp_gauge.values
          gauge[0].bitmap.dispose
          gauge[0].dispose
        end
        # SP ƒQ[ƒW,̍XV
        for gauge in @sp_gauge.values
          gauge[0].bitmap.dispose
          gauge[0].dispose
        end
        @hp_gauge = {}
        @sp_gauge = {}
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      alias :update_gauge :update
      def update
        update_gauge
        # HP ƒQ[ƒW,̍XV
        for gauge in @hp_gauge.values
          gauge_refresh(gauge, 0)
        end
        # SP ƒQ[ƒW,̍XV
        for gauge in @sp_gauge.values
          gauge_refresh(gauge, 1)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw HP Gauge
      #--------------------------------------------------------------------------
      # Modification of the original Draw HP process
      alias :draw_actor_hp_hpsp :draw_actor_hp
      def draw_actor_hp(actor, x, y, width = 144)
        # ‰•`‰æ,̏ꍇ
        if @hp_gauge[actor] == nil
          # ƒQ[ƒW,
          height = 10
          # FÝ'èBcolor1:ŠO˜gCcolor2:'†˜g
          # color3:‹óƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor4:‹óƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
          color1 = Color.new(0, 0, 0, 192)
          color2 = Color.new(255, 255, 192, 192)
          color3 = Color.new(64, 0, 0, 192)
          color4 = Color.new(0, 0, 0, 192)
          # ‹óƒQ[ƒW,Ì•`‰æ
          @hp_frame = gauge_rect(width, height, color1, color2, color3, color4)
          sprite = Sprite.new
          sprite.bitmap = Bitmap.new(width, height)
          sprite.x = self.x + x + 16
          sprite.y = self.y + y + 42 - height
          sprite.z = self.z + 1
          count = rand(400)
          # •ϐ"rate,É Œ»Ý,ÌHP/MHP,ð'ã"ü
          if actor.maxhp != 0
            rate = ((width - 4) * actor.hp.to_f / actor.maxhp).ceil
          else
            rate = width - 4
          end
          # ˆÊ'u"™î•ñ,Ì‹L‰¯
          @hp_gauge[actor] = [sprite, actor, rate, count, x, y - height]
          # ƒQ[ƒW•`‰æ
          gauge_refresh(@hp_gauge[actor], 0)
          # ƒ^[ƒQƒbƒgƒEƒBƒ"ƒhƒE,̏ꍇA‰Šúó'Ô,Í"ñ•\ަ
          @hp_gauge[actor][0].visible = false if self.is_a?(Window_Target)
        end
        # •ϐ"rate,É Œ»Ý,ÌHP/MHP,ð'ã"ü
        if actor.maxhp != 0
          rate = ((width - 4) * actor.hp.to_f / actor.maxhp).ceil
        else
          rate = width - 4
        end
        @hp_gauge[actor][2] = rate
        # ƒIƒŠƒWƒiƒ‹,ÌHP•`‰æˆ--,ðŒÄ,яo,µ
        draw_actor_hp_hpsp(actor, x, y, width)
      end
      #--------------------------------------------------------------------------
      # * Draw SP Gauge
      #--------------------------------------------------------------------------
      # Modification of the original Draw SP process
      alias :draw_actor_sp_hpsp :draw_actor_sp
      def draw_actor_sp(actor, x, y, width = 144)
        # ‰•`‰æ,̏ꍇ
        if @sp_gauge[actor] == nil
          # ƒQ[ƒW,
          height = 10
          # FÝ'èBcolor1:ŠO˜gCcolor2:'†˜g
          # color3:‹óƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor4:‹óƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
          color1 = Color.new(0, 0, 0, 192)
          color2 = Color.new(255, 255, 192, 192)
          color3 = Color.new(0, 64, 64, 192)
          color4 = Color.new(0, 0, 0, 192)
          # ‹óƒQ[ƒW,Ì•`‰æ
          @sp_frame = gauge_rect(width, height, color1, color2, color3, color4)
          sprite = Sprite.new
          sprite.bitmap = Bitmap.new(width, height)
          sprite.x = self.x + x + 16
          sprite.y = self.y + y + 42 - height
          sprite.z = self.z + 1
          count = rand(400)
          # •ϐ"rate,É Œ»Ý,ÌHP/MHP,ð'ã"ü
          if actor.maxsp != 0
            rate = ((width - 4) * actor.sp.to_f / actor.maxsp).ceil
          else
            rate = width - 4
          end
          # ˆÊ'u"™î•ñ,Ì‹L‰¯
          @sp_gauge[actor] = [sprite, actor, rate, count, x, y - height]
          # ƒQ[ƒW•`‰æ
          gauge_refresh(@sp_gauge[actor], 1)
          # ƒ^[ƒQƒbƒgƒEƒBƒ"ƒhƒE,̏ꍇA‰Šúó'Ô,Í"ñ•\ަ
          @sp_gauge[actor][0].visible = false if self.is_a?(Window_Target)
        end
        # •ϐ"rate,É Œ»Ý,ÌHP/MHP,ð'ã"ü
        if actor.maxsp != 0
          rate = ((width - 4) * actor.sp.to_f / actor.maxsp).ceil
        else
          rate = width - 4
        end
        @sp_gauge[actor][2] = rate
        # ƒIƒŠƒWƒiƒ‹,ÌHP•`‰æˆ--,ðŒÄ,яo,µ
        draw_actor_sp_hpsp(actor, x, y, width)
      end
      #--------------------------------------------------------------------------
      # * Drawing of gauge
      #--------------------------------------------------------------------------
      def gauge_rect(width, height, color1, color2, color3, color4)
        bitmap = Bitmap.new(width, height)
        # ˜g•`‰æ
        bitmap.fill_rect(0, 0, width, height, color1)
        bitmap.fill_rect(1, 1, width - 2, height - 2, color2)
        # ‹óƒQ[ƒW,Ì•`‰æ
        bitmap.gradation_rect(2, 2, width-4, height-4, color3, color4, 1)
        return bitmap
      end
      #--------------------------------------------------------------------------
      # œ ŽÀƒQ[ƒW,̍XV
      #--------------------------------------------------------------------------
      def gauge_refresh(gauge, type)
        # ƒ^ƒCƒv,É,æ,蕪Šò
        case type
        when 0 # HPƒQ[ƒW,̏ꍇ
          graphic = RPG::Cache.system("Gauge_HP")
          rate = gauge[2] * 100 / (gauge[0].bitmap.width - 4)
          point = (rate < 50 ? 8 : 0) + (rate < 25 ? 8 : 0)
          frame = @hp_frame
        when 1 # SPƒQ[ƒW,̏ꍇ
          graphic = RPG::Cache.system("Gauge_SP")
          rate = gauge[2] * 100 / (gauge[0].bitmap.width - 4)
          point = (rate < 50 ? 8 : 0) + (rate < 25 ? 8 : 0)
          frame = @sp_frame
        end
        # ƒJƒEƒ"ƒg,̍XV
        gauge[3] = (gauge[3] - 2) % 400
        # ‹óƒQ[ƒW,Ì,Ì•`‰æ
        gauge[0].bitmap.fill_rect(0, 0, gauge[0].bitmap.width,
          gauge[0].bitmap.height, Color.new(0, 0, 0, 0))
        gauge[0].bitmap.blt(0, 0, frame, frame.rect)
        # ƒQ[ƒW,Ì'†g,ð•`‰æ‰Â"\,ȏꍇ
        if gauge[2] > 0
          # ŽÀƒQ[ƒW,Ì•`‰æ
          gauge[0].bitmap.blt(2, 2, graphic,
            Rect.new(gauge[3], point, gauge[2], gauge[0].bitmap.height - 4), 192)
          gauge[0].bitmap.fill_rect(3, 3, gauge[2] - 2,
            gauge[0].bitmap.height - 6,Color.new(0, 0, 0, 0))
          gauge[0].bitmap.blt(3, 3, graphic,
            Rect.new(gauge[3]+1,point+1,gauge[2]-2,gauge[0].bitmap.height- 6), 128)
        end
        # ƒQ[ƒWÀ•W,̍XV
        gauge[0].x = [self.x - self.ox + gauge[4] + 16, self.x + 16].max
        gauge[0].y = [self.y - self.oy + gauge[5] + 42, self.y + 16].max
        gauge[0].src_rect = Rect.new([self.ox - gauge[4], 0].max,
          [self.oy - gauge[5] - 26, 0].max,
          [self.ox + self.width - gauge[4] - 32, gauge[0].bitmap.width].min,
          [self.oy + self.height - gauge[5] - 32, gauge[0].bitmap.height].min)
        gauge[0].visible = self.visible
      end
      #--------------------------------------------------------------------------
      # Set X-position for gauge
      #--------------------------------------------------------------------------
      def x=(new_x)
        super(new_x)
        if @hp_gauge != nil
          # HP ƒQ[ƒW,̍XV
          for gauge in @hp_gauge.values + @sp_gauge.values
            gauge[0].x = self.x + gauge[4] + 16
          end
        end
      end
      #--------------------------------------------------------------------------
      # Set Y-position for gauge
      #--------------------------------------------------------------------------
      def y=(new_y)
        super(new_y)
        if @hp_gauge != nil
          # HP ƒQ[ƒW,̍XV
          for gauge in @hp_gauge.values + @sp_gauge.values
            gauge[0].y = self.y + gauge[5] + 42
          end
        end
      end
      #--------------------------------------------------------------------------
      # Set Z-depth for gauge
      #--------------------------------------------------------------------------
      def z=(new_z)
        super(new_z)
        if @hp_gauge != nil
          # HP ƒQ[ƒW,̍XV
          for gauge in @hp_gauge.values + @sp_gauge.values
            gauge[0].z = self.z + 1
          end
        end
      end
    end


    #==============================================================================
    # ** Window_Help
    #------------------------------------------------------------------------------
    #  This window shows skill and item explanations along with actor status.
    #==============================================================================

    class Window_Help < Window_Base
      #--------------------------------------------------------------------------
      # * Set Text
      #  text  : text string displayed in window
      #  align : alignment (0..flush left, 1..center, 2..flush right)
      #--------------------------------------------------------------------------
      alias :gauge_set_text :set_text
      def set_text(text, align = 0)
        # ƒeƒLƒXƒg,ƃAƒ‰ƒCƒ"ƒƒ"ƒg,̏*,È,*,Æ,àˆê•û,ª'O‰ñ,ƈá,Á,Ä,¢,éê‡
        if text != @text or align != @align
          # ƒQ[ƒW,̍폜
          gauge_delete
          # ƒIƒŠƒWƒiƒ‹,̏ˆ--
          gauge_set_text(text, align)
        end
      end
      #--------------------------------------------------------------------------
      # * Set Actor
      #     actor : status displaying actor
      #--------------------------------------------------------------------------
      alias :gauge_set_actor :set_actor
      def set_actor(actor)
        if actor != @actor
          # ƒQ[ƒW,̍폜
          gauge_delete
          # ƒIƒŠƒWƒiƒ‹,̏ˆ--
          gauge_set_actor(actor)
        end
      end
      #--------------------------------------------------------------------------
      # * Set Enemy
      #     enemy : name and status displaying enemy
      #--------------------------------------------------------------------------
      alias :gauge_set_enemy :set_enemy
      def set_enemy(enemy)
        # ƒQ[ƒW,̍폜
        gauge_delete
        # ƒIƒŠƒWƒiƒ‹,̏ˆ--
        gauge_set_enemy(enemy)
      end
    end


    #==============================================================================
    # ** Spriteset_Battle
    #------------------------------------------------------------------------------
    #  This class brings together battle screen sprites. It's used within
    #  the Scene_Battle class.
    #==============================================================================

    class Spriteset_Battle
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias :initialize_gauge :initialize
      def initialize
        initialize_gauge
        @viewport2.z = 100
      end
    end

    #==============================================================================
    # ** Bitmap
    #------------------------------------------------------------------------------
    # New routine added to the Bitmap class.
    #==============================================================================

    class Bitmap
    #--------------------------------------------------------------------------
    # * Rectangle Gradation Indicator
    #   color1: Start color
    #   color2: Ending color
    #   align: 0: On side gradation
    #          1: Vertically gradation
    #          2: The gradation (intense concerning slantedly heavily note)
    #--------------------------------------------------------------------------
      def gradation_rect(x, y, width, height, color1, color2, align = 0)
        if align == 0
          for i in x...x + width
            red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
            green = color1.green +
                    (color2.green - color1.green) * (i - x) / (width - 1)
            blue  = color1.blue +
                    (color2.blue - color1.blue) * (i - x) / (width - 1)
            alpha = color1.alpha +
                    (color2.alpha - color1.alpha) * (i - x) / (width - 1)
            color = Color.new(red, green, blue, alpha)
            fill_rect(i, y, 1, height, color)
          end
        elsif align == 1
          for i in y...y + height
            red   = color1.red +
                    (color2.red - color1.red) * (i - y) / (height - 1)
            green = color1.green +
                    (color2.green - color1.green) * (i - y) / (height - 1)
            blue  = color1.blue +
                    (color2.blue - color1.blue) * (i - y) / (height - 1)
            alpha = color1.alpha +
                    (color2.alpha - color1.alpha) * (i - y) / (height - 1)
            color = Color.new(red, green, blue, alpha)
            fill_rect(x, i, width, 1, color)
          end
        elsif align == 2
          for i in x...x + width
            for j in y...y + height
              red   = color1.red + (color2.red - color1.red) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              green = color1.green + (color2.green - color1.green) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              blue  = color1.blue + (color2.blue - color1.blue) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              alpha = color1.alpha + (color2.alpha - color1.alpha) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              color = Color.new(red, green, blue, alpha)
              set_pixel(i, j, color)
            end
          end
        elsif align == 3
          for i in x...x + width
            for j in y...y + height
              red   = color1.red + (color2.red - color1.red) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              green = color1.green + (color2.green - color1.green) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              blue  = color1.blue + (color2.blue - color1.blue) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              alpha = color1.alpha + (color2.alpha - color1.alpha) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              color = Color.new(red, green, blue, alpha)
              set_pixel(i, j, color)
            end
          end
        end
      end
    end

    #==============================================================================
    # **  Sprite
    #------------------------------------------------------------------------------
    #  Class for sprites added to various effect handling used within RPGXP
    #==============================================================================

    module RPG
      class Sprite < ::Sprite
        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 = "Arial Black"
          bitmap.font.size = 32
          bitmap.font.color.set(0, 0, 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)
          if value.is_a?(Numeric) and value < 0
            bitmap.font.color.set(176, 255, 144)
          else
            bitmap.font.color.set(255, 255, 255)
          end
          bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
          if critical
            bitmap.font.size = 20
            bitmap.font.color.set(0, 0, 0)
            bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
            bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
            bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
            bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
            bitmap.font.color.set(255, 255, 255)
            bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
          end
          @_damage_sprite = ::Sprite.new
          @_damage_sprite.bitmap = bitmap
          @_damage_sprite.ox = 80 + self.viewport.ox
          @_damage_sprite.oy = 20 + self.viewport.oy
          @_damage_sprite.x = self.x + self.viewport.rect.x
          @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
          @_damage_sprite.z = 3000
          @_damage_duration = 40
        end
        def animation(animation, hit)
          dispose_animation
          @_animation = animation
          return if @_animation == nil
          @_animation_hit = hit
          @_animation_duration = @_animation.frame_max
          animation_name = @_animation.animation_name
          animation_hue = @_animation.animation_hue
          bitmap = RPG::Cache.animation(animation_name, animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          @_animation_sprites = []
          if @_animation.position != 3 or not @@_animations.include?(animation)
            for i in 0..15
              sprite = ::Sprite.new
              sprite.bitmap = bitmap
              sprite.visible = false
              @_animation_sprites.push(sprite)
            end
            unless @@_animations.include?(animation)
              @@_animations.push(animation)
            end
          end
          update_animation
        end
        def loop_animation(animation)
          return if animation == @_loop_animation
          dispose_loop_animation
          @_loop_animation = animation
          return if @_loop_animation == nil
          @_loop_animation_index = 0
          animation_name = @_loop_animation.animation_name
          animation_hue = @_loop_animation.animation_hue
          bitmap = RPG::Cache.animation(animation_name, animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          @_loop_animation_sprites = []
          for i in 0..15
            sprite = ::Sprite.new
            sprite.bitmap = bitmap
            sprite.visible = false
            @_loop_animation_sprites.push(sprite)
          end
          update_loop_animation
        end
        def animation_set_sprites(sprites, cell_data, position)
          for i in 0..15
            sprite = sprites
            pattern = cell_data[i, 0]
            if sprite == nil or pattern == nil or pattern == -1
              sprite.visible = false if sprite != nil
              next
            end
            sprite.visible = true
            sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
            if position == 3
              if self.viewport != nil
                sprite.x = self.viewport.rect.width / 2
                sprite.y = self.viewport.rect.height - 160
              else
                sprite.x = 320
                sprite.y = 240
              end
            else
              sprite.x = self.x + self.viewport.rect.x -
                          self.ox + self.src_rect.width / 2
              sprite.y = self.y + self.viewport.rect.y -
                          self.oy + self.src_rect.height / 2
              sprite.y -= self.src_rect.height / 4 if position == 0
              sprite.y += self.src_rect.height / 4 if position == 2
            end
            sprite.x += cell_data[i, 1]
            sprite.y += cell_data[i, 2]
            sprite.z = 2000
            sprite.ox = 96
            sprite.oy = 96
            sprite.zoom_x = cell_data[i, 3] / 100.0
            sprite.zoom_y = cell_data[i, 3] / 100.0
            sprite.angle = cell_data[i, 4]
            sprite.mirror = (cell_data[i, 5] == 1)
            sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
            sprite.blend_type = cell_data[i, 7]
          end
        end
      end
    end


    #==============================================================================
    # ** RPG
    #------------------------------------------------------------------------------
    # A module containing RPGXP's data structures and more.
    #==============================================================================

    module RPG
      #============================================================================
      # ** Cache
      #----------------------------------------------------------------------------
      # A module that loads each of RPGXP's graphic formats, creates a Bitmap
      # object, and retains it.
      #============================================================================
      module Cache
        def self.system(filename)
          self.load_bitmap("Graphics/Pictures/", filename)
        end
      end
    end

Futendra

This is what I got for the HP/SP Bar:

Spoiler: ShowHide
class Window_YourHUD < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.opacity = 0
    self.contents = Bitmap.new(640 - 32, 64 - 32)
    refresh
  end
  def refresh
    self.contents.clear
    reset_variables
    return if !@actor
    draw_actor_hp(@actor, 0, 0)
    draw_actor_sp(@actor, 300, 0)
  end
  def reset_variables
    @actor = $game_party.actors[0]
    @old_hp = @actor ? @actor.hp : 0
    @old_maxhp = @actor ? @actor.maxhp : 0
    @old_sp = @actor ? @actor.sp : 0
    @old_maxsp = @actor ? @actor.maxsp : 0
  end
  def update
    super
    refresh if (@actor = $game_party.actors[0] or
                @old_hp = @actor ? @actor.hp : 0 or
                @old_maxhp = @actor ? @actor.maxhp : 0 or
                @old_sp = @actor ? @actor.sp : 0 or
                @old_maxsp = @actor ? @actor.maxsp : 0)
  end
end
class Scene_Map
  alias yourhud_main main
  alias yourhud_update update
  def main
    @yourhud = Window_YourHUD.new
    yourhud_main
    @yourhud.dispose
  end
  def update
    @yourhud.update
    yourhud_update
  end
end


But I need 4 party members to show up, not one, how do I do this? NEWB TO RGSS RUBY

Holyrapid

Are you using what battle system?
And as for the in sight, that's easy to event. Just take an events X and Y positions on the map, compare those to the players, and if the event is facing the player, if player is say five squares away, it will react.

Futendra

Quote from: DesPKP on January 01, 2011, 01:25:52 pm
Are you using what battle system?
And as for the in sight, that's easy to event. Just take an events X and Y positions on the map, compare those to the players, and if the event is facing the player, if player is say five squares away, it will react.


RTP Battle system, so no ABS

And can you make a tut on that?

The Niche

It's easy. Set two variables to the player's x and y positions, this is easy to do using the control variables command. Then, make a conditional branch checking if these variables are between certain numbers (the boundaries of the area you want your guards to be able to detect in)
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Futendra

Quote from: The Niche on January 01, 2011, 07:52:55 pm
It's easy. Set two variables to the player's x and y positions, this is easy to do using the control variables command. Then, make a conditional branch checking if these variables are between certain numbers (the boundaries of the area you want your guards to be able to detect in)


but it must be moving around, so what do i do then??

The Niche

Quote from: Futendra on January 02, 2011, 08:27:35 am
Quote from: The Niche on January 01, 2011, 07:52:55 pm
It's easy. Set two variables to the player's x and y positions, this is easy to do using the control variables command. Then, make a conditional branch checking if these variables are between certain numbers (the boundaries of the area you want your guards to be able to detect in)


but it must be moving around, so what do i do then??



Ah, now that's a bit more difficult. This'll be a bit of work. So, make a label at the top of the event, then do the conditional branch thing. Then, if they haven't seen the player, put in the first step of the move route. Conditional branch again. Next step, etc. Have them return to the starting point and then jump to the label at the top of the event. Note: There's probably a better way to do this, I don't think Blizzard could have been bothered to do like seven maps with around seven moving guards each this way. So use this until someone comes up with a better way.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Futendra

Quote from: The Niche on January 02, 2011, 08:54:59 am
Quote from: Futendra on January 02, 2011, 08:27:35 am
Quote from: The Niche on January 01, 2011, 07:52:55 pm
It's easy. Set two variables to the player's x and y positions, this is easy to do using the control variables command. Then, make a conditional branch checking if these variables are between certain numbers (the boundaries of the area you want your guards to be able to detect in)


but it must be moving around, so what do i do then??



Ah, now that's a bit more difficult. This'll be a bit of work. So, make a label at the top of the event, then do the conditional branch thing. Then, if they haven't seen the player, put in the first step of the move route. Conditional branch again. Next step, etc. Have them return to the starting point and then jump to the label at the top of the event. Note: There's probably a better way to do this, I don't think Blizzard could have been bothered to do like seven maps with around seven moving guards each this way. So use this until someone comes up with a better way.

Can you make a demo??

Also, can you help me out with my HUD?
HUD For RTP, 4 party members, caterpillar, and an animated health bar (check main post)

Holyrapid

HUD can be found in Tons, as well as caterpillar. As for the health bar, though it can be found in tons as well, it's not animated. And i think that making animated bars would create lag, probably in such portions that it wouldn't be worth it...

The Niche

The demo, no, but all the commands you need are in the first two tabs of the event editor. Control variables, label, conditional branch, set move route and jump to label.

Basic diagram of the event, using an area of five tiles around the event, which is at (009,004) on the map.

Label: Label1 (Call this whatever you like I can't be bothered to come up with a name for it)
Control Variables: Player X == Player's map X
Control Variables: Player Y == Player's map Y
Conditional branch: Player X > 4
Conditional branch: Player X < 14
Conditional branch: Player Y > 0
Conditional branch: Player Y < 9
Set move route: This event, move left.
Control Variables: Player X == Player's map X
Control Variables: Player Y == Player's map Y
Conditional branch: Player X > 3
Conditional branch: Player X < 13
Conditional branch: Player Y > 0
Conditional branch: Player Y < 9
(Next step on the move route, adjust the variables again)
(Make the move route bring the event back to (009, 004) again)
Jump to label: Label1

As to the hud, listen to Des.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Futendra

Quote from: DesPKP on January 02, 2011, 09:12:30 am
HUD can be found in Tons, as well as caterpillar. As for the health bar, though it can be found in tons as well, it's not animated. And i think that making animated bars would create lag, probably in such portions that it wouldn't be worth it...


I meant I am using a caterpillar and I need a HUD with a health bar, with 4 party members, but in the beginning its only 1.

Futendra

SOMEONE PLEASE HELP ME GET MY HUD DOWN :(

I NEED IT PRETTY URGENT AS PEOPLE WANT DEMO...

WhiteRose

Quote from: Futendra on January 02, 2011, 10:03:48 am
Quote from: DesPKP on January 02, 2011, 09:12:30 am
HUD can be found in Tons, as well as caterpillar. As for the health bar, though it can be found in tons as well, it's not animated. And i think that making animated bars would create lag, probably in such portions that it wouldn't be worth it...


I meant I am using a caterpillar and I need a HUD with a health bar, with 4 party members, but in the beginning its only 1.


I believe you can change that in the configuration of that Add-on in Tons. In fact, I'm fairly certain of it. Also, when you post parts of scripts, using code tags will make it much easier for people to help you.

Futendra

Quote from: WhiteRose on January 03, 2011, 05:49:24 pm
Quote from: Futendra on January 02, 2011, 10:03:48 am
Quote from: DesPKP on January 02, 2011, 09:12:30 am
HUD can be found in Tons, as well as caterpillar. As for the health bar, though it can be found in tons as well, it's not animated. And i think that making animated bars would create lag, probably in such portions that it wouldn't be worth it...


I meant I am using a caterpillar and I need a HUD with a health bar, with 4 party members, but in the beginning its only 1.


I believe you can change that in the configuration of that Add-on in Tons. In fact, I'm fairly certain of it. Also, when you post parts of scripts, using code tags will make it much easier for people to help you.

I don't hve BLIZZABS! So will it work? I never got tons of add ons to work, ever...

WhiteRose

Tons and BABS aren't directly related at all. What part of Tons were you having trouble with? It's fairly simple - just enable each add-on you want to use at the top of its part (1, 2, or 3,) and then use the configuration before each Add-On in the script to tweak it to your liking.

Futendra

Quote from: WhiteRose on January 04, 2011, 11:30:02 am
Tons and BABS aren't directly related at all. What part of Tons were you having trouble with? It's fairly simple - just enable each add-on you want to use at the top of its part (1, 2, or 3,) and then use the configuration before each Add-On in the script to tweak it to your liking.


I always get errors that he cant find blizz abs.......

Thats why I dont use it XD

Starrodkirby86

Tons of Add-ons and Blizz-ABS can work separately.

There's tons of projects I had before that use Tons of Add-ons without Blizz-ABS.

It's a shame since Tons of Add-ons has HP/SP/sex bars included already from the package.

Just make three new scripts above Main and copypasta each Tons of Add-ons part in the right order. Then in the configuration section, just set whatever one you want enabled as true. o.O

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Futendra

Quote from: Starrodkirby86 on January 04, 2011, 02:20:24 pm
Tons of Add-ons and Blizz-ABS can work separately.

There's tons of projects I had before that use Tons of Add-ons without Blizz-ABS.

It's a shame since Tons of Add-ons has HP/SP/sex bars included already from the package.

Just make three new scripts above Main and copypasta each Tons of Add-ons part in the right order. Then in the configuration section, just set whatever one you want enabled as true. o.O


Well , when I try to run my tons of add ons, It always give errors saying it needs a special input?
Like Game_Character and stuff, while it is in the script?

Maybe its just me doing something wrong... What I tried is:
-Just saying true to what I want
-Just saying true + configuring more
-Configuring and instead of making the true thing, make it false in her configuring itself

none seem to work...

The Niche

Quote from: Starrodkirby86 on January 04, 2011, 02:20:24 pm
Tons of Add-ons and Blizz-ABS can work separately.

There's tons of projects I had before that use Tons of Add-ons without Blizz-ABS.

It's a shame since Tons of Add-ons has HP/SP/sex bars included already from the package.

Just make three new scripts above Main and copypasta each Tons of Add-ons part in the right order. Then in the configuration section, just set whatever one you want enabled as true. o.O


Right, now I'm going to go make a game where exp is replaced with sex.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

WhiteRose

Quote from: Futendra on January 05, 2011, 05:50:41 am
Well , when I try to run my tons of add ons, It always give errors saying it needs a special input?
Like Game_Character and stuff, while it is in the script?

Maybe its just me doing something wrong... What I tried is:
-Just saying true to what I want
-Just saying true + configuring more
-Configuring and instead of making the true thing, make it false in her configuring itself

none seem to work...


If you're getting errors, you've either copy-pasted the scripts incorrectly, or you've changed something you shouldn't have.