Changing Enemy Select a bit, Actor Command Window becomes a void? [SOLVED]

Status
Not open for further replies.

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
-Update 2-

Ignore Update 1, it was bollocks and me looking in the wrong place lol.

Solved it (see my reply post below) by changing the Viewport Code in the Window_BattleEnemy class.

Good luck to everyone else also messing about with Battle Window positioning for the first time, this stuff is weird :D.

Changed thread title to include [SOLVED] but will hold off on reporting for closing for a few hours just in case anyone else wants to chip in on the issue.

-end of Update 2-

-Update 1-
I was looking in the wrong place.
-End of Update 1-

Original Post:

Hey everyone!

So I've been messing around with Enemy Select Window and all I've done is change where the window appears, how big it is and how many columns it has in it so far yet I've encountered something quite bizarre...

The "Attack, Special, Guard, Item" Actor Command Window has only PARTIALLY disappeared when Enemy Select is up, leaving behind part of its border as a result.

Pictured here (you'll notice the border of the menu is still a bit there in the bottom right):
Void Actor Command 1.png

-------------------------------------------------------------------------------------

What's more, if I were to move the Info Display Window (the same way it moves to the right or left depending on whether the Party Command Window or the Actor Command Window is active) to the right...

This happens:
Void Actor Command 2.png

-------------------------------------------------------------------------------------

Here are all the changes I've made to the code so far (not many as I'm sure you'll see):

Ruby:
# Under Window_BattleEnemy:

  #--------------------------------------------------------------------------
  # * Object Initialization
  #     info_viewport : Viewport for displaying information
  #--------------------------------------------------------------------------
  def initialize(info_viewport)
  # super(0, info_viewport.rect.y, window_width, fitting_height(4))
    super(0, 100, window_width, fitting_height(4))
    refresh
    self.visible = false
    @info_viewport = info_viewport
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
  # Graphics.width - 128
    Graphics.width - 420
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
  # return 2
    return 1
  end

  #--------------------------------------------------------------------------
  # * Show Window
  #--------------------------------------------------------------------------
  def show
    if @info_viewport
      width_remain = Graphics.width - width
    # self.x = width_remain
      @info_viewport.rect.width = width_remain
      select(0)
    end
    super
  end
Ruby:
# Under Scene_Battle


  #--------------------------------------------------------------------------
  # * Update Information Display Viewport
  #--------------------------------------------------------------------------
  def update_info_viewport
    move_info_viewport(0)   if @party_command_window.active
    move_info_viewport(128) if @actor_command_window.active

    move_info_viewport(0)   if @enemy_window.active

    move_info_viewport(64)  if BattleManager.in_turn?
  end

-------------------------------------------------------------------------------------


So, anyone know why it's doing this?


I've tried .hide .show .close .open and .deactivate and .activate for the Actor Command Window but it still creates this weird void-actor command window regardless.

Quite the enigma to me at the moment, so any thoughts on the subject would be appreciated :).

Kind regards and all the best,
- The_Sarah
 
Last edited:

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
285
Reaction score
70
First Language
English
Primarily Uses
RMXP
It's a viewport issue indeed.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
If you don't understand how viewport works, try this piece of code
Code:
DataManager.init

# Stationed at X,Y = 50,10
# With size 100,100
$viewport = Viewport.new(100,100,100,100)

# This window start position (x,y) = 0,0
$window = Window_Base.new(0,0,100,100)

# This window has this viewport
$window.viewport = $viewport

loop do
  Graphics.update
  Input.update
 
  # if you press shift, viewport will move while you press arrow button
  if Input.press?(:SHIFT)
    $viewport.rect.x += 5 if Input.press?(:RIGHT)
    $viewport.rect.x -= 5 if Input.press?(:LEFT)
   
    $viewport.rect.y -= 5 if Input.press?(:UP)
    $viewport.rect.y += 5 if Input.press?(:DOWN)
  else
    $window.x += 2 if Input.press?(:RIGHT)
    $window.x -= 2 if Input.press?(:LEFT)
   
    $window.y -= 2 if Input.press?(:UP)
    $window.y += 2 if Input.press?(:DOWN) 
  end
end
Paste it in your script list, and run the game.
If you press the arrow button, the window will move.
If you press the arrow button while holding shift, the viewport will move.

It might give you an idea of why the window gets cut.
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
If you don't understand how viewport works, try this piece of code
Code:
DataManager.init

# Stationed at X,Y = 50,10
# With size 100,100
$viewport = Viewport.new(100,100,100,100)

# This window start position (x,y) = 0,0
$window = Window_Base.new(0,0,100,100)

# This window has this viewport
$window.viewport = $viewport

loop do
  Graphics.update
  Input.update

  # if you press shift, viewport will move while you press arrow button
  if Input.press?(:SHIFT)
    $viewport.rect.x += 5 if Input.press?(:RIGHT)
    $viewport.rect.x -= 5 if Input.press?(:LEFT)
  
    $viewport.rect.y -= 5 if Input.press?(:UP)
    $viewport.rect.y += 5 if Input.press?(:DOWN)
  else
    $window.x += 2 if Input.press?(:RIGHT)
    $window.x -= 2 if Input.press?(:LEFT)
  
    $window.y -= 2 if Input.press?(:UP)
    $window.y += 2 if Input.press?(:DOWN)
  end
end
Paste it in your script list, and run the game.
If you press the arrow button, the window will move.
If you press the arrow button while holding shift, the viewport will move.

It might give you an idea of why the window gets cut.
Thanks, this is my first time messing about with battle window positions, so this'll probably help. Will get back to you with me results.
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
Alright, couldn't really figure it out today.

Apparently it's to do with viewports and apparently there are 3 viewports in battles (according to an old message by Shaz from 2014) that have z values of 0, 50 and 100.

So I guess I've gotta figure out which viewport does what in battle.

Though that still doesn't explain why the Actor Command Window disappears like that.

Bleeeeeeeeeeeeeeeeeeegh

Time for sleep.

Appreciate any helpful comments made before I wake.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
285
Reaction score
70
First Language
English
Primarily Uses
RMXP
Probably because you messed up with the hide command by... disabling it? after the default script attempted to, err, hide it from you. Plus it didn't manage to be scrolled right off screen where screen actually means its own viewport.
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
Probably because you messed up with the hide command by... disabling it? after the default script attempted to, err, hide it from you.
Wait... where did I do that?
Again, the original minor changes I made that lead to all this are all included in the original post.

Nothing about hide or close or deactivate in the original changes :/

I later went on to mess with those in the enemy selection screen method but have since taken those out and it's all the same still, disappearing status window when moved to the right despite it being fine existing to the right when the party command window is up and the "Attack, Special, Guard, Item" Actor Command Window disappears (rather awkwardly) when selecting an enemy.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
285
Reaction score
70
First Language
English
Primarily Uses
RMXP
I see. Now I'm suspecting the viewport needs to get increased automatically and this happens when you're using the default implementation but it never got this adjustment because you interfered with it after you altered the script's inner workings.
Thus I'd need to run some tests to find out more about this issue unless somebody else already know the answer to your question and shows up before I find the root cause...
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
Alright, found the issue by replicating my minor changes one at a time and playtesting at each step (evidently a good thing to do when trying to see what's doing what).

Thanks for the Viewport tips, definitely alien to me before I started this thread.

Solution:
Basically what's happening is the Viewport created/used when Enemy Select's Window is summoned is cutting off everything that you could previously see in that bottom right corner.

The solution was to do this here (original code commented out so you can still see it) Window_BattleEnemy class:
Ruby:
  #--------------------------------------------------------------------------
  # * Show Window
  #--------------------------------------------------------------------------
  def show
    if @info_viewport
#      width_remain = Graphics.width - width
#      self.x = width_remain
#      @info_viewport.rect.width = width_remain

      width_remain = 100
      self.x = width_remain
      @info_viewport.rect.width = Graphics.width
    
    
      select(0)
    end
    super
  end
As you can see, originally when the Enemy Select Window is called, it creates a viewport that has the width of Graphics.width - width, which creates that void corner.

What we really want it to be to keep seeing what's normally in that corner after moving the window is simply the width of Graphics.width.

Got there in the end :D.

Thanks again for viewport tips.

Hope this helps anyone else also messing around with Window Positions in battle for the first time.

Peace out.


P.S - Yes I know my new version of width_remain is redundant, that's just me messing about with it and not in any way final code.
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,366
Reaction score
5,027
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Recent threads, and my very poor algorithm for my minimap plugin have made me face the fact that I need to review algorithms and such.

Going through Cracking the Coding Interview now. I am so excited.
Kes
I've seen a reference to a Community Lighting plugin for MZ, but cannot find it. Is it still in beta?

Todo:
Add fog of war
Add enemy indicators
Make window draggable
Optimise map drawing algorithm (5 seconds to load the map you see, so it's a... poo-poo algorithm)

Any suggestions? :kaoblush:
bleh studio hell job haha at least they like it didnt had time to do much laundry tho ;w;'....YES I DO AT LEAST TAKE A SHOWER everyday!
Ami
--- Food Ingredients ---

Hero: Since the Chef are in Hospital,we can't eat his Dish in 3 Days.
F.Mage: What we have to Eat?
M.Healer: Don't worry,we can Eat the Food Ingredients.
Hero & F.Mage
: Really?

(3 Days Later)

Chef: Hi,Guys. I'm Ba---
(Entire Party Collapse After Eat Raw Meat)
Chef: Wha...WHAT GOING ON HERE!!!!!!

Forum statistics

Threads
102,913
Messages
995,918
Members
134,363
Latest member
Wilsonliz
Top