I'm trying to use Moghunter's Battle HUD in my game, but I'm having an issue in that it is always drawn behind things drawn with the "Show Picture" Event command, and I want it to always be out in front.
The script has a configurable Z value for the HUD, but even if i set it to 90 million or so, it's still behind the show picture images.
Here's the script:
http://www.atelier-rgss.com/RGSS/Battle/ACE_BAT23.html
If anyone can help me figure out how to keep the HUD on top that'd be highly appreciated.
Moghunter's Battle HUD in front of pictures (Or lowering Z value of pictures)
● ARCHIVED · READ-ONLY
-
-
Show Picture always uses a higher layer by default. The HUD and the pictures are likely using different viewports.
-
Right you are!
... I don't have a clue what a viewport actually IS, but searching around told me that pictures are in viewport2,
and CRTL+F on the script for "viewport" let me find two lines that say "Vewport1" So I changed that 1 to a 2 in both places and it did the trick.
Since I'm not entirely sure what I was just messing with, I HOPE I didn't actually break anything, but everything seems functional so far.
I'm guessing a veiwport works like layers in Adobe Illustrator?
So the z value is really the depth of something within it's viewport, but everything in viewport 1 is behind everything in 2, which is behind everything in 3, etc.
At any rate, thanks for the hint. -
Yes, viewports are like layers and they have their own z value. Then sprites get placed into a viewport and THEY have their own z value, but it is only relevant to other sprites in the same viewport.
If viewport1 has z = 0 and viewport2 has z = 50, you can place a sprite in viewport1 and set its z to 1000, and a sprite in viewport2 and set its z to 10, and the viewport2 sprite will always display above the viewport1 sprite.
What you've done is probably harmless enough - better to change the viewport of the hud than of the pictures, as they do need to be in the correct arrangement with the map and its sprites.
In the default battle system, the following things are on these viewports:
Viewport1 - battleback; battlers;
Viewport2 - timer; pictures;
Viewport1 and its objects are subject to tone changes and screen shaking
Viewport2 and its objects are subject to flash color (this will also affect Viewport1 and its objects, as Viewport2 is drawn above it)
Viewport3 and its objects are subject to brightness (and will also affect Viewports1 and 2 and their objects)
So moving the hud from viewport1 to viewport2 just means if the screen shakes or changes tone, the hud won't be affected.
Hope this helps :)
Closed