[XP] Blizz-ABS

Started by Blizzard, January 09, 2008, 08:21:56 am

Previous topic - Next topic

Metaron

Hey all,

I'm getting an odd script error during combat when the main characters are fighting only certain enemies.

I've tried removing all skills that the enemies use, changing the area where they fight and it keeps occurring.


Script 'BlizzABS part 2' line 5224: NoMethodError occurred

undefined method 'last' for nil:NilClass

Would anyone have any idea what this section of code in blizz abs part 2 might relate to so it can help me narrow down what could be causing the issue?

I'm on Version: 2.84

KK20

A clean v2.84 points to the start of a loop at line 5224, so I don't know what edits you may have done. But the method this is occurring in is range_array_union, which has to do with battlers that are "observing" and updating their "minions" with information.

Not sure on the details of how this works, but I find it weird that this is causing an error. Make sure your script order is fine and your scripts were copied over completely.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Metaron

Cheers KK20, I managed to get rid of the error by turning off the observer AI for that particular enemy and it doesn't crash anymore. It doesn't seem to be a problem for any other enemies that have the observer trait, just that one.

Thanks for the quick response :)

Mariorsomething

Hello! I haven't made any tweaks to the code, but I keep getting the error:

"Script 'Blizz_ABS(Pt.2)' line 241: NameError occurred.

undefined method 'hp=' for class 'Game_Battler'"

I know next to nothing about code (in Ruby especially) so it's possible I've missed an integral step somewhere, and upon looking, line 241 has nothing at all written in it, it's simply a space.

I don't know if anyone still checks these, but if you could help, that'd be wonderful!

KK20

That error makes no sense then. Can you upload your scripts.rxdata

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

Try making sure that you aren't loading an old save game that's been created before you added Blizz-ABS.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ronivan

So its been really a long time since I last did any work on RMXP. I knew about this ABS, but after implementation, it had a major issue with a custom script of mine. My script allow a free control over sprites frames without changing the name of the sprite, but when use with your script, it no longer work. I tried change the position with no avail. I'll publish my custom script down here:

#==============================================================================
# Extra Frames
# por COGHWELL
# Edit by KK20
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# KK20's Note: The following instructions are no longer relevant to this script.
# The number of frames a character sprite uses is determined by the amount
# configured in the configuration below.
#==============================================================================
# O script permite que a imagem do character tenha mais que 4 frames.
#
# Para definir a quantidade de frames basta definir o nome adicione [X]
# ao seu nome, onde X é o numero de frames.
#
# Ex.:
# 001-Fighter01[7].png
#
# Isto significa que o 001-Fighter01 terá 7 frames
#==============================================================================
module ExtraFramesConfig
  def self.char_frames(name)
    case name
    #--------------------------------------------------------------------------
    # Begin Configuration
    # Format:
    #             when 'filename' then return FRAMES
    #
    # Any names not configured will be assumed to have 4 frames (RMXP default)
    #--------------------------------------------------------------------------
    when 'Char - Rohan' then return 8
    when 'Char - Rohan2' then return 8
    when 'Char - Rohan Ladder' then return 8
    when 'Char - Rohan2 Ladder' then return 8
    when 'Char - Rohan_quarter' then return 8
    when 'Char - Elenwen' then return 8
    when 'Char - Elenwen Ladder' then return 8
    when 'Char - Elenwen2' then return 8
    when 'Char - Elenwen2 Ladder' then return 8
    when 'Char - Lucain' then return 8
    when 'Char - Lucain2' then return 8
    when 'Char - Lucain Ladder' then return 8
    when 'Char - Lucain2 Ladder' then return 8
    when 'Char - Ramza' then return 8
    when 'Char - Ramza Ladder' then return 8
    when 'Char - Artanis' then return 8
    when 'Char - Artanis Ladder' then return 8
    when 'Char - Judeau' then return 8
    when 'Char - Judeau Ladder' then return 8
    when 'Char - Agrias' then return 8
    when 'Char - Agrias Ladder' then return 8
#---------------------------------------------------------------
    when 'Rag - Goo' then return 8
    when 'Measure - Portals 01' then return 15
    when 'Measure - Spawn' then return 5
    when 'Measure - Mana Crystal 01' then return 9
    when 'Poring' then return 8
    when 'Rag - Myconid' then return 8
    when 'Rag - Mossy Myconid' then return 8
    when 'Rag - Willow' then return 5
    when 'Rag - Willow 2' then return 5
    when 'Rag - Boa' then return 6
    when 'Rag - Bat' then return 8
    when 'Rag - Knight M-1' then return 8
    when 'Rag - Swordsman M-1' then return 8
    when 'Rag - Swordsman M-2' then return 8
    when 'Rag - Archer M-1' then return 8
    when 'Rag - Botaring' then return 6
    when 'Rag - Corruption' then return 6
    when 'Rag - Schist' then return 5
    when 'Rag - Ochu' then return 7
    when 'Rag - Banshee' then return 6
    when 'Rag - Wraith' then return 6
    when 'Rag - Hopper' then return 7
    when 'Rag - Dolomedes' then return 6
    when 'Rag - Raydric' then return 6
    when 'Rag - Raydric Archer' then return 6
    when 'Rag - Abyss Knight' then return 8
    when 'Rag - Parasite' then return 6
    when 'Rag - Thief M1' then return 8
   
   
    #--------------------------------------------------------------------------
    # End of Configuration
    #--------------------------------------------------------------------------
    else
      return 4
    end
  end
end

#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  def update
    if jumping?
      update_jump
    elsif moving?
      update_move
    else
      update_stop
    end
    frames = ExtraFramesConfig.char_frames(@character_name)
    if frames != 4
      @anime_count = 20 if @anime_count > 0 and @pattern == @original_pattern
      if @anime_count * (frames - 1) / 4 > 18 - @move_speed * 3
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = @pattern % (frames - 1) + 1
        end
        @anime_count = 0
      end
    else
      if @anime_count > 18 - @move_speed * 2
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = (@pattern + 1) % 4
        end
        @anime_count = 0
      end
    end
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    if @move_route_forcing
      move_type_custom
      return
    end
    if @starting or lock?
      return
    end
    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
      case @move_type
      when 1
        move_type_random
      when 2
        move_type_toward_player
      when 3
        move_type_custom
      end
    end
  end
end


#================================================= =============================
# ■ Sprite_Character
#================================================= =============================
class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  def update
    super
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
        @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
        @character.character_hue)
        frames = ExtraFramesConfig.char_frames(@character.character_name)
        if frames != 4
          @cw = bitmap.width / frames
          @ch = bitmap.height / 4
        else
          @cw = bitmap.width / 4
          @ch = bitmap.height / 4
        end
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    self.visible = (not @character.transparent)
    if @tile_id == 0
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end

#================================================= =============================
# ■ Window_Base
#================================================= =============================
class Window_Base < Window
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    frames = ExtraFramesConfig.char_frames(actor.character_name)
    if frames != 4
      cw = bitmap.width / frames
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 4
      ch = bitmap.height / 4
    end
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end

#================================================= =============================
# ■ Window_SaveFile
#================================================= =============================
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = "File #{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      for i in 0...@characters.size
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        frames = ExtraFramesConfig.char_frames(@characters[i][0])
        if @characters[i][0][/\[(\d+)\]/]
          cw = bitmap.width / frames
          ch = bitmap.height / 4
        else
        cw = bitmap.width / 4
        ch = bitmap.height / 4
      end
      src_rect = Rect.new(0, 0, cw, ch)
      x = 300 - @characters.size * 32 + i * 64 - cw / 2
      self.contents.blt(x, 68 - ch, bitmap, src_rect)
    end
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 8, 600, 32, time_string, 2)
    self.contents.font.color = normal_color
    time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
    self.contents.draw_text(4, 40, 600, 32, time_string, 2)
    end
  end
end

#================================================= =============================
# ■ Game_Player
#================================================= =============================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  def anime_update
    frames = ExtraFramesConfig.char_frames(@character_name)
    if frames != 4
      @anime_count = 20 if @anime_count > 0 and @pattern == @original_pattern
      if @anime_count * (frames - 1) / 4 > 18 - @move_speed * 2
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = @pattern % ($1.to_i - 1) + 1
        end
        @anime_count = 0
      end
    else
      if @anime_count > 18 - @move_speed * 2
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = (@pattern + 1) % 4
        end
        @anime_count = 0
      end
    end
  end
end

I would really appreciate any help on this subject because I really want to use this script.

KK20

Hey, welcome back. I remember you asked for this like 7 years ago, and I told you it would be a lot of work to do it. I can take another stab at it to make sure if that remains the case or not.

Do you have a character sheet for me to use as a reference?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ronivan

August 03, 2020, 08:59:07 am #5448 Last Edit: August 03, 2020, 09:00:48 am by Ronivan
Thanks for remembering me. Its really been a while, but I decided to give it another try here. Here a sprite with 8 frames movement:



Thanks for looking in to this issue for me.

KK20

Start with this:
#==============================================================================
# Extra Frames (for Blizz-ABS)
# por COGHWELL
# Edit by KK20
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# KK20's Note:
# The number of frames a character sprite uses is determined by the amount
# configured in the configuration below.
#==============================================================================
module ExtraFramesConfig
  def self.char_frames(name)
    case name
    #--------------------------------------------------------------------------
    # Begin Configuration
    # Format:
    #             when 'filename' then return FRAMES
    #
    # Any names not configured will be assumed to have 4 frames (RMXP default)
    #--------------------------------------------------------------------------
    when 'Hero' then return 8
    #--------------------------------------------------------------------------
    # End of Configuration
    #--------------------------------------------------------------------------
    else
      return 4
    end
  end
end

#==============================================================================
# ■ Map_Battler
#==============================================================================
class Map_Battler
  def pattern_size
    # check graphic file
    @pattern_size = ExtraFramesConfig.char_frames(@character_name)
   
    # if in action or charging and animating
    if (in_action > 0 || charging?) && @sindex < @sframes.size &&
        @sframes[@sindex] > 0
      # return sprite animation modified pattern
      return @sframes.size
    end
    # return normal pattern if not in action
    return @pattern_size
  end
end

#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  def update
    if jumping?
      update_jump
    elsif moving?
      update_move
    else
      update_stop
    end
    frames = ExtraFramesConfig.char_frames(@character_name)
    if frames != 4
      @anime_count = 20 if @anime_count > 0 and @pattern == @original_pattern
      if @anime_count * (frames - 1) / 4 > 18 - @move_speed * 3
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = @pattern % (frames - 1) + 1
        end
        @anime_count = 0
      end
    else
      if @anime_count > 18 - @move_speed * 2
        if not @step_anime and @stop_count > 0
          @pattern = @original_pattern
        else
          @pattern = (@pattern + 1) % 4
        end
        @anime_count = 0
      end
    end
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    if @move_route_forcing
      move_type_custom
      return
    end
    if @starting or lock?
      return
    end
    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
      case @move_type
      when 1
        move_type_random
      when 2
        move_type_toward_player
      when 3
        move_type_custom
      end
    end
  end
end

#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    frames = ExtraFramesConfig.char_frames(actor.character_name)
    if frames != 4
      cw = bitmap.width / frames
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 4
      ch = bitmap.height / 4
    end
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end

#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = "File #{@file_index + 1}"
    self.contents.draw_text(4, 0, 600, 32, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      for i in 0...@characters.size
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        frames = ExtraFramesConfig.char_frames(@characters[i][0])
        if @characters[i][0][/\[(\d+)\]/]
          cw = bitmap.width / frames
          ch = bitmap.height / 4
        else
        cw = bitmap.width / 4
        ch = bitmap.height / 4
      end
      src_rect = Rect.new(0, 0, cw, ch)
      x = 300 - @characters.size * 32 + i * 64 - cw / 2
      self.contents.blt(x, 68 - ch, bitmap, src_rect)
    end
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 8, 600, 32, time_string, 2)
    self.contents.font.color = normal_color
    time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
    self.contents.draw_text(4, 40, 600, 32, time_string, 2)
    end
  end
end
Give it a test and report whatever breaks.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ronivan

August 04, 2020, 10:18:47 am #5450 Last Edit: August 04, 2020, 10:20:36 am by Ronivan
A big, big, BIG thanks for this edit. At my first test with a clean project, it worked by activating the Action Sprites. I'll began my understand of this ABS now and test it further on.


Ronivan

August 05, 2020, 03:01:53 pm #5451 Last Edit: August 05, 2020, 03:02:56 pm by Ronivan
Alright, first issue found with my attacking animation. It won't play the attacking animation, which has 6 frames. I'll post here the attack animation I'm using for this test in particular:



This worries me, because I have animation with several different number of frames, including the enemies too.

KK20

If I name the spritesheet as Hero_atk1 and make a 1x1 sprite named Hero_wpn1, I see that the 6 frames are not represented and are treated as if 4 frames of animation (by default). Which results in the non-attack spritesheet getting treated as 4 frames again.

If I edit BABS configuration so that the default frames for Weapons is 6 frames, i.e.
    def self.frames(id)
      return [3, 3, 3, 3, 3, 3]
    end
then everything looks normal. I don't even have to configure the Extra Frames script for the attack spritesheet.

I guess the only issue would be if your actors use a different number of frames for the same weapon.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ronivan

Thanks again for this lesson. I still need to get a better understand of this battle system, but at least now I have the will to get going with it.

Ronivan

August 08, 2020, 11:48:20 am #5454 Last Edit: August 08, 2020, 01:05:16 pm by Ronivan
I've found a minor issue with enemies idle animation that may be related to the multiple frames script. If use the enemy idle animation option, the walking animation of the said enemy flicker sometimes, and when the said enemy is hit during battle, for a short moment, it plays the idle animation, but without considering the multiple frames script, which display the picture of all frames at once.

KK20

Alright, let's just rely on the graphic filename and the configuration to wholly determine the number of frames:
  def pattern_size
    # use frame count defined by above configuration only
    @pattern_size = ExtraFramesConfig.char_frames(@character_name)
  end
So now you will have to define the _atk, _idl, etc. filenames under ExtraFramesConfig.

Make sure that you continue defining your frames for your attacks, skills, etc. appropriately like before in the Blizz-ABS configuration (i.e. the self.frames post I made previously).

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ronivan

Thanks again for the reply. This have indeed solved not only the strange animation thing after attacking the target, but the one I was having here while further testing the animation during enemy skill damage, which sometimes was causing the incorrect number of frames appearing. However, this did not solve the flickering of enemy animation if idle is enabled. In fact I noticed now that it actually is not even playing the moving animation; it just show the idle, and when it moves, it shows nothing. I'll look on this because I feel like I'm doing something wrong on my part here.

KK20

It's not just you. Idle sprites do not animate from what I can tell from the code. I don't get it either...possibly a regression?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ronivan

August 09, 2020, 10:28:09 am #5458 Last Edit: August 09, 2020, 10:32:57 am by Ronivan
I didn't knew they should not be animated. I used the RMXP event option to animate the event graphic. I guess the issue may be coming from this.

Moving animation:



Idle animation:

Ronivan

For the rest, everything here seems to be working in order. The issue I still have is not related to the ABS itself, but rather from the Custom Resolution (DLL-less) 0.97e, which is working properly with Blizz ABS, except for the player is not correctly centered on the screen. The player position is fixed in the upper-left corner of the screen. I'm trying to tweak the Custom Resolution script trying to find the centering method, but so far I haven't found it.