Save-Point
[RMXP]Game Over and Atoa Battle Status mishaps - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: [RMXP]Game Over and Atoa Battle Status mishaps (/thread-5233.html)



[RMXP]Game Over and Atoa Battle Status mishaps - firestalker - 08-03-2014

[Image: hmDgKi.png] OKay, so this the mishap I'm talking about. I'm using Mog - Game Over Karen v1.5 [is there a newer version by chance?] and Atoa's ATB battle system. When I make the background of the Battle status in a picture it doesn't dispose at all. Also, on a separate note, neither does the ATB Bar.... And I have no idea how to get rid of them.

Untitled Project

I've provided my complete project for you to look through with you find that will help. I want them to dispose when the Game Over screen comes on. That's all.

Thanks in Advance...
Fire


RE: [RMXP]Game Over and Atoa Battle Status mishaps - DerVVulfman - 08-04-2014

Well, I just pasted Moghunter's script above the battlesystem, and I had no problems. The issus is apparently on your moggy battlestatus and ATB bar end. Would you perhaps be able to just post your battlestatus and ATB bar script?


RE: [RMXP]Game Over and Atoa Battle Status mishaps - firestalker - 08-04-2014

Not sure which is which.... but I'm using Atoa Custom Battle System ver. 3 with his ATB Addon.

I thought of adding the Game OVer script above the Battle Script and it didn't change a thing.

Here's the Battle Status Script:
Add| Battle Windows

and here's the ATB Script:
Add | Atoa ATB



RE: [RMXP]Game Over and Atoa Battle Status mishaps - DerVVulfman - 08-04-2014

Ah. The AT script was cut-off, though they're in the ACBS demo.

However, you said you made the background for the battlestatus window. Perchance, did that require an edit?


RE: [RMXP]Game Over and Atoa Battle Status mishaps - firestalker - 08-04-2014

(08-04-2014, 04:57 AM)DerVVulfman Wrote: Ah. The AT script was cut-off, though they're in the ACBS demo.

However, you said you made the background for the battlestatus window. Perchance, did that require an edit?
Actually no... the Battle Status Background picture is part of the Add | Battle Windows Script...
Code:
# Battle Window Background image, leave nil or '' for no image

# The file must be on the pictures folder

Battle_Window_Backgroud = 'Battle_Status'

I did make one change to the Battle Window script at this section:
Code:
#==============================================================================

# ** Window_BattleStatus

#------------------------------------------------------------------------------

# This window displays the status of all party members on the battle screen.

#==============================================================================



class Window_BattleStatus < Window_Base

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize

super(Battle_Window[0], Battle_Window[1], Battle_Window[2], Battle_Window[3])

if Battle_Window_Backgroud != nil and Battle_Window_Backgroud != ''

@background_image = Sprite.new

@background_image.bitmap = RPG::Cache.picture(Battle_Window_Backgroud)

@background_image.x = Battle_Window[0]

@background_image.y = Battle_Window[1]

@background_image.z = 899

end

self.contents = Bitmap.new(width - 32, height - 32)

@level_up_flags = []

for i in 0...$game_party.actors.size

@level_up_flags << false

end

self.z = 900

self.back_opacity = Battle_Window[4]

self.opacity = Battle_Window[4] if Battle_Window[5]

refresh

end

This line
Code:
@background_image.x = Battle_Window[0]

@background_image.y = Battle_Window[1]
originally read like this:
Code:
@background_image.x = Battle_Window_Bg_Position[0]

@background_image.y = Battle_Window_Bg_Position[1]

But there was no constants or variables for them. This is the only two lines they are used in the whole system. So there's no array objects for it to pull from. Removing the _Bg_Position didn't really change except removed an error that I long ago forgot about.

Heres the ATB Script again if you need it... Wierd how it got cut off like that:


Add | Atoa ATB

Edited formatting, a few tags were forgotten and distorted the page. - MetalRenard


RE: [RMXP]Game Over and Atoa Battle Status mishaps - DerVVulfman - 08-06-2014

And now I am confused to holy heck. Confused

Looking at Victor's script, he placed the @background_image system directly into the Window_Battlestatus class. FINE! That's what I woulda done. And that being said, Mog's gameover system takes a fresh copy of the battlestatus window and pulls it down. The placement of the image in the window should be freakin' FIXED IN THE WINDOW!

So I tried cleaning up the dispose method and copy the part of the battlestatus window into Mog's system... just to make an accompanying @background_image sprite in his system and tie it to work with the copy of battle_status. THE HECK!?!? It didn't work

I almost got it so it had a background image to sweep down with the battlestatus window, but for some reason a second copy remained in place.

Okay, this is tickin' me off.


RE: [RMXP]Game Over and Atoa Battle Status mishaps - firestalker - 08-06-2014

So you're a lot like me where when something should work and it doesn't ticks you off... it makes you not able to focus on anything until the world makes sense again. Maybe? Blushing + Cheery

The script works great when it's the default game over script. But that looks like it just covers up the battle scripts... It slowly fades in over top the Battle Status screens.

Okay, I've gotten the two scripts to work together [when I say that I mean that I changed the background from Battleback to Map] and it works fine that way.

I changed this:
Code:
GTYPE = 0
to this:
Code:
GTYPE = 1

How do you change the character graphic from a script? Maybe I can make this work better than the other way.

Though I would prefer the Battle back as the game over screen, I just like the way it looks better. But I can be flexible if need be.


RE: [RMXP]Game Over and Atoa Battle Status mishaps - DerVVulfman - 08-06-2014

Meh, when all else fails. HIT IT WITH A HAMMER!!!!

So that's what I did.... twice over with two separate patches. Put em both below your ATB addon script:

I altered the Battlestatus window to be larger, so it can draw an entire 640x160 background can show... I expanded the window by 32px in all directions and moved it up and left by 16. And then I adjusted the objects within to match. Doing that, I got it to show the way you want (or I hope). I had to have some fun with the AT bars, making sure that the y-position of the bars adjusted each time the status window moved and stuff. I figure, most of your problems were in these sections. Enjoy.

Code:
#==============================================================================
# PATCH:  Battle Window Add-On & Scene GameOver Karen
# by DerVVulfman (Based on Atoa/Victor Sant's work)
# August 6, 2014
#==============================================================================
# This patch, placed below the Battle Windows add-on, rewrites the methods that
# draw and refresh  the Battle Status window.   Particularly for the purpose of
# allowing the use of a background image instead of a windowskin window.
#
# For that, this script must at least be placed below the Battle Window add-on
# script.  But if in use with his ATB add-on,  this this script must be placed
# directly below Atoa's Active Time Battle script.
#
# NOTE:  As this pastes a background image within the confines of the Battle
#        Status window, and the window itself has a 16px border all the way
#        around, the calculated dimensions of the battlestatus window have
#        been increased to compensate, as have the placement of the status
#        display objects such as 'draw hp', 'draw sp'.
#
#==============================================================================



#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(Battle_Window[0]-16, Battle_Window[1]-16,
          Battle_Window[2]+32, Battle_Window[3]+32)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = []
    for i in 0...$game_party.actors.size
      @level_up_flags << false
    end
    self.z = 900
    self.back_opacity = Battle_Window[4]
    self.opacity = Battle_Window[4] if Battle_Window[5]
    if Battle_Window_Backgroud != nil and Battle_Window_Backgroud != ''
      self.back_opacity = 0
      self.opacity      = 0
      @bg_img           = RPG::Cache.picture(Battle_Window_Backgroud)
      bw                = @bg_img.width
      bh                = @bg_img.height
      @bgsrc_rect       = Rect.new(0, 0, bw, bh)
    end    
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if Battle_Window_Backgroud != nil and Battle_Window_Backgroud != ''
      self.contents.blt(0, 0, @bg_img, @bgsrc_rect)
    end
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      self.contents.font.size = 22
      hp_w = HP_Number[3] ? 140 : 80
      sp_w = SP_Number[3] ? 140 : 80
      actor = $game_party.actors[i]
      case Display_Type
      when 0
        wd = (width - 32) / Max_Party
        actor_x = Horizontal_Centralize ? ((i * wd) +  (wd * (Max_Party - $game_party.actors.size) / 2)) : i * wd
        actor_y = 0
      when 1
        actor_x = 0
        actor_y = i * 32
      when 2
        actor_x = Custom_Stat_Position[i][0]
        actor_y = Custom_Stat_Position[i][1]
      end
      draw_actor_battle_face(actor, 16+actor_x + Face_Config[0], 16+actor_y + Face_Config[1], Face_Config[2]) if Show_Faces
      draw_actor_battle_graphic(actor, 16+actor_x + Char_Config[0], 16+actor_y + Char_Config[1], Char_Config[2]) if Show_Char
      draw_actor_name(actor, 16+actor_x + Name_Config[0], 16+actor_y + Name_Config[1])
      draw_actor_hp(actor, 16+actor_x + HP_Text[0], 16+actor_y + HP_Text[1], hp_w)
      draw_actor_sp(actor, 16+actor_x + SP_Text[0], 16+actor_y + SP_Text[1], sp_w)
      draw_actor_level(actor, 16+actor_x + Level_Text[0], 16+actor_y + Level_Text[1]) if Draw_Level
      if @level_up_flags[i] and Lvl_Up_Flag
        self.contents.font.color = normal_color
        self.contents.draw_text(16+actor_x + State_Config[0], 16+actor_y + State_Config[1], 132, 32, Lvl_Up_Msg )
      else
        draw_actor_state(actor, 16+actor_x + State_Config[0], 16+actor_y + State_Config[1])
      end
    end
  end
end

Code:
#==============================================================================
# PATCH:  Atoa's Active Time Battle & Scene GameOver Karen
# by DerVVulfman (Based on Atoa/Victor Sant's work)
# August 6, 2014
#==============================================================================
# This patch, placed below the Active Timer Battle patch,  rewrites a method in
# the Window_BattleStatus class  that refreshes the AT waiting bars  as well as
# key methods that draws and places the AT bars within the window itself.
#
# For that, this script must be placed directly below Atoa's Active Time Battle
# script.
#
# NOTE:  Designed for use in tandem with the BattleStatus / Game_Over patch,
#        this patch has allowances that adjusts the position  of the bars by
#        16  or so pixels.   For further  vertical adjustments,  consult the
#        Y_METER_ADJUST configurable below.
#
# ADDTL: The refresh_meter method contains a couple rewrites. Of note is a
#        rewrite of the  'automatic adjustment' (case 1) branch as the ori-
#        ginal calculations of the face/hp/sp position didn't match up.
#
#==============================================================================


Y_METER_ADJUST = 48

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Time bar update
  #--------------------------------------------------------------------------
  def active_time_update
    need_reset
    @atb_meters.refresh(self.y) if @atb_meters != nil
    @enm_meters.refresh if @enm_meters != nil
    @atb_bars.refresh if @atb_bars != nil
  end
end

#==============================================================================
# ** ATB_Meters
#------------------------------------------------------------------------------
# Class that shows the time meters of actors
#==============================================================================

class ATB_Meters
  #--------------------------------------------------------------------------
  # * Include Settings Module
  #--------------------------------------------------------------------------
  include Atoa
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :meters
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @meters = []
    @skin = RPG::Cache.windowskin(Meter_Skin)
    i = 0
    for actor in $game_party.actors
      @meter = MeterSprite.new(@skin, 5)
      refresh_meter(i)
      i += 1
    end
    refresh(Y_Meter - (Y_METER_ADJUST+8))
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(y_position)
    i = 0
    for actor in $game_party.actors
      refresh_meter_y(i, actor, y_position + Y_METER_ADJUST)
      @meters[i].line = actor.atb_linetype
      @meters[i].amount = actor.atb_lineamount
      @meters[i].refresh
      @meters[i].atb_visible = true
      i += 1
    end
  end
  #--------------------------------------------------------------------------
  # * Update meter
  #     index : index
  #--------------------------------------------------------------------------
  def refresh_meter(index)
    actor = $game_party.actors[index]
    case Meter_Pos_Style
    when 0
      @meter.x = index * (624 / Max_Party) + 4 + X_Meter + 16
      @meter.y = Y_Meter
      @meter.z = 1000
    when 1
      # NEW -------------
      width = Battle_Window[2]+32
      wd = (width - 32) / Max_Party
      actor_x = 16 + (index * wd) +  (wd * (Max_Party - $game_party.actors.size) / 2)
      @meter.x = actor_x
      # -------------------
      #@meter.x = X_Meter + ((624 / Max_Party) * ((4 - $game_party.actors.size)/2.0 + index)).floor
      @meter.y = Y_Meter
      @meter.z = 1000
    when 2
      @meter.x = X_Meter
      @meter.y = index * 32 + Y_Meter
      @meter.z = 1000
    when 3
      @meter.x = actor.base_x - @skin.width / 2
      @meter.y = actor.base_y - @skin.height / 5
      @meter.z = 100
    when 4
      @meter.x = actor.base_x - @skin.width / 2
      @meter.y = actor.base_y - @skin.height / 5 - 64
      @meter.z = 2500
    when 5
      base = Meter_Position[index]
      @meter.x = base[0]
      @meter.y = base[1]
      @meter.z = 2500
    end
    @meters[index] = @meter
  end
  #--------------------------------------------------------------------------
  # * Update meter
  #     index : index
  #     actor : actor
  #     y_position : y-position in battlestatus window
  #--------------------------------------------------------------------------
  def refresh_meter_y(index, actor, y_position)
    case Meter_Pos_Style
    when 0
      @meters[index].y = y_position
    when 1
      @meters[index].y = y_position
    when 2
      @meters[index].y = index * 32 + y_position
    when 3
      @meters[index].y = actor.base_y - @skin.height / 5
    when 4
      @meters[index].y = actor.base_y - @skin.height / 5 - 64
    when 5
      @meters[index].y = base[1]
    end
  end
end



RE: [RMXP]Game Over and Atoa Battle Status mishaps - firestalker - 08-07-2014

You are a scripting God, DerVV!!! This works like a charm. I had to adjust some of the other bars a little, but nothing major [took like two minutes tops]. Thank you so very much!