RPG Maker VX Ace

RPG Maker VX Ace

View Stats:
Signum1221 Oct 24, 2014 @ 4:34am
Show a picture (with script)
Im currently working on making a health bar that shows while in in the map, while i succeed in making the bar with window and self.contents.fill_rect(...) i dont know how to show a picture with scripts, i want to show it over the window while the player is on the map.
< >
Showing 1-15 of 16 comments
Hajami Oct 24, 2014 @ 5:26am 
I just have the RGSS3 Command for using in Eventcomand Script safed on my PC, but it should also Work in normal Scripts.

Show Picture Command:
$game_map.screen.pictures[index].show(fName, placement, x, y, xZoom, yZoom, opacity, blend)

# fName - Also automatically searches files included in RGSS-RTP.
# File extensions may be omitted.
# placement - [0] Upper Left, [1] Center
# x - X value of image.
# y - Y value of image.
# xZoom - [100; Default] Horizontal scaling of image.
# yZoom - [100; Default] Vertical scaling of image.
# opacity - [255; Default] Opacity of image.
# blend - [0] Normal, [1] Add, [2] Sub

Move Picture Command:
$game_map.screen.pictures[imgNum].move(placement, x, y, xZoom, yZoom, opacity, blend, duration)

# imgNum - Numerical identifier of the image.
# placement - [0] Upper Left, [1] Center
# x - X value of image.
# y - Y value of image.
# xZoom - [100; Default] Horizontal scaling of image.
# yZoom - [100; Default] Vertical scaling of image.
# opacity - [255; Default] Opacity of image.
# blend - [0] Normal, [1] Add, [2] Sub
# duration - Duration of time to move image.
# NOTE : Does not pause script. Use one of the following instead :
#
# wait(iFrames)
# iFrames.to_i.times { Fiber.yield }
#
# iFrames - Number of frames to wait (1000 is equal to 1 second)


Tint Picture Command:
$game_map.screen.pictures[imgNum].start_tone_change(tone, duration)

# imgNum - Numerical identifier of image.
# tone - Tone information :
#
# Tone.new(red, blue, green, grey)
#
# duration - Duration of time to alter image.
# NOTE : Does not pause script. Use one of the following instead :
#
# wait(iFrames)
# iFrames.to_i.times { Fiber.yield }
#
# iFrames - Number of frames to wait (1000 is equal to 1 second)
Last edited by Hajami; Oct 24, 2014 @ 5:26am
Shadow Oct 24, 2014 @ 6:13am 
That was a freaking great answer Hajami!
Kudos!
Signum1221 Oct 24, 2014 @ 6:20am 
Thanks, im now able to make pictures appear, i thought the picture would appear over the bars but it seems like windows have priority over pictures, theres a easy way to change this?

PD: Epic answer!
Last edited by Signum1221; Oct 24, 2014 @ 6:21am
Hajami Oct 24, 2014 @ 6:32am 
Originally posted by Dread:
That was a freaking great answer Hajami!
Kudos!
But i just Copy Pasted it from an Datafile^^ i wrote and partly copy pasted with stuff i wanted to know.
Some information i found on the Internet other stuff i asked in Forums.
Last edited by Hajami; Oct 24, 2014 @ 6:35am
Hajami Oct 24, 2014 @ 6:34am 
Originally posted by Signum1221:
Thanks, im now able to make pictures appear, i thought the picture would appear over the bars but it seems like windows have priority over pictures, theres a easy way to change this?

PD: Epic answer!
You are searching for "Changing Z Values", iam not familiar with those.
Sorry cant help with that.
Shadow Oct 24, 2014 @ 6:34am 
Yes and you got ALL of YOUR effort in just an answer.
Usually that is really more than enough.
Your answer has excellent documentation and covers the question 100% 99%.
That is what it counts.
Last edited by Shadow; Oct 24, 2014 @ 6:35am
Hajami Oct 24, 2014 @ 6:36am 
Ok thanks for this nice motivating Words :)
Shadow Oct 24, 2014 @ 6:38am 
Well you deserve it!
That qquestionn helped me too!!! :P
Hajami Oct 24, 2014 @ 6:54am 
Ok if the Zoom isnt working with game variables (iam not sure if this is the case, didnt tested it with this new commands) but if that is the case, than thanks to Asandril here is the Solution:
http://www.rpg-studio.org/forum/index.php?page=Thread&postID=533516#post533516
Insert in Scriptmanager:

class Game_Picture
attr_accessor :zoom_x # Für Picture Zoom - Callscript abfrage
attr_accessor :zoom_y # Für Picture Zoom - Callscript abfrage
end

Now you should be able to Zoom Pictures by Variable. Usefulll if you dont want to move a health bar out of the picture, now you can zoom it directly everywhere on the map.
But maybe its also possible without this script. have to test it someday for this purpose.
(He changed only 2 "reader" to "accesor")
Last edited by Hajami; Oct 24, 2014 @ 6:56am
Signum1221 Oct 24, 2014 @ 7:26am 
I tried changing the z of the picture but it seems that it is in a different layer, i searched a little and if i did understant the layers are viewports, so i tried something like this
v1=Viewport.new(138, 0, 120, 100) v1.z=0 s1=Sprite.new(v1) b1=Bitmap.new("Bar.png") s1.bitmap=b1
Bar.png is inside the pictures folder, it seems like i need to write the path to that folder because it says Bar.png doesnt exist, im not sure how to write the path.

Edit: Hajami i just readed your answer in the other post XD, i want the bars in the upper part of the map screen and also in the menu, the bars are for food, water, stamina... they will be merged with the time system im making.

Evented version will do, i dont like having to copy a pararell process in each map but is no problem.
Last edited by Signum1221; Oct 24, 2014 @ 7:43am
Hatsukuro Oct 24, 2014 @ 7:49am 
If you're making something custom you may want to read up on the Sprite class in the documentation. It's easy to set those to a custom position, custom zoom, and give them a custom bitmap. I'd give you a short example but my Internet is down right now so I only have my phone. Keep in mind however that unlike windows from the last thread, sprites do not automatically update in scenes and are not automatically disposed.

Pretty much what I'm saying is to display a picture/sprite specifically how and when you want you need to do a bit more custom code than using the picture settings for events.
Signum1221 Oct 24, 2014 @ 8:39am 
Well i upgraded a little the code you helped me with the other day so i can just list all calls that need to be updated while scene map (or scene menu or any other scene) so refreshing it is no problem, im going to play a little with it, in the worst case scenario maybe i'll need to do a loop that paints each pixel every update, im not too sure about how will affect perfonmance
Last edited by Signum1221; Oct 24, 2014 @ 8:44am
Hatsukuro Oct 24, 2014 @ 9:33am 
Painting each pixel would be horrible in the way of performance. Working wroth bitmaps you'd be better off with the fill_rect, clear_rect, blt, and other similar methods. Even with these there's a lot you can do.
Signum1221 Oct 24, 2014 @ 11:13am 
I tried this:
$test=100 class Scene_Map < Scene_Base alias signum_default_start_ddf start alias signum_default_update_grgw update BACKGROUND = Color.new(150, 150, 150) HP = Color.new(255, 0, 0) def start(*args) signum_default_start_ddf(*args) # @s1=Sprite.new() @s1.x=300 @s1.y=300 @s1.z=10 @s2=Sprite.new() @s2.x=300 @s2.y=300 @s2.z=9 b1=Bitmap.new(100,100) b2=Bitmap.new(100,100) @s1.bitmap=b1 @s2.bitmap=b2 @s2.bitmap.fill_rect(1, 1, 100, 6*4, BACKGROUND) end def update signum_default_update_grgw # @s1.bitmap.clear_rect(1, 1, 100, 6*4) @s1.bitmap.fill_rect(1, 1,$test, 6*4, HP) @s1.update if($time==0) $test=$test-1 end # end end
It seems to work well,i have to figure out how to load in a sprite a .png, i readed something like bitmap.new(filename) but i dont know how to write the rute to the file.

Thanks
Marquise* Oct 24, 2014 @ 5:27pm 
^^; I want to need to use this ^^; I just can't understand out of context but I know it is great! ^^
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Oct 24, 2014 @ 4:34am
Posts: 16