VXAce Problem with Command Slider

1234567.png


Script Link

Here is the Scene_Skill class.

How to solve the situation that appears in the picture?

Thank you!
The problem is that it uses 1 or more sprites that need a viewport. Supposedly, the script passes the window's viewport to each sprite. What happens in real life is that it might have none (nil in Ruby), thus it gets a default one that might be as large as the game screen itself.

You need to set a single viewport that has the same dimensions as the window's minus the corresponding padding.

Creating the viewport inside the Window_Command's initialize method, right before the refresh call, would be the perfect place to do that.

Ruby:
@viewport = Viewport.new(wx, wy, ww, wh)

Then pass @viewport to all the sprites that need it. (Right now they get a self.viewport instead.)
The problem is that it uses 1 or more sprites that need a viewport. Supposedly, the script passes the window's viewport to each sprite. What happens in real life is that it might have none (nil in Ruby), thus it gets a default one that might be as large as the game screen itself.

You need to set a single viewport that has the same dimensions as the window's minus the corresponding padding.

Creating the viewport inside the Window_Command's initialize method, right before the refresh call, would be the perfect place to do that.

Ruby:
@viewport = Viewport.new(wx, wy, ww, wh)

Then pass @viewport to all the sprites that need it. (Right now they get a self.viewport instead.)
Thank you for your reply. The problem has been successfully solved.

Change "sprite = Sprite.new(self.viewport)" to:
Ruby:
y = self.y + standard_padding
h = self.height - standard_padding * 2
@viewport = Viewport.new(self.x, y, self.width, h)
@viewport.z = self.viewport ? self.viewport.z + 1 : 100
@viewport.ox += self.x; @viewport.oy += y
sprite = Sprite.new(@viewport)

Then delete these three lines:
Ruby:
if sprite.viewport != self.viewport
  sprite.viewport = self.viewport
end

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.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-command-slider.179230/