[RMXP] Script call to show pictures?

Started by jayje, December 26, 2018, 08:57:28 pm

Previous topic - Next topic

jayje

any way I could script call show a picture based on a variable? IE Show Picture 1 \V[1]?


KK20

December 27, 2018, 01:00:28 am #1 Last Edit: December 27, 2018, 01:08:53 am by KK20
Note, this does not allow dynamic updating of the picture (every time you update the game variable's value, you will need to do the picture script call)

$game_screen.pictures[NUMBER].show($game_variables[1], ORIGIN, X, Y, ZOOM_X, ZOOM_Y, OPACITY, BLEND_TYPE)

replacing the constants above with actual values...

NUMBER = which picture ID to show (generally 1~100)
ORIGIN = upper-left (0) or center (1)
X/Y = screen coordinates
ZOOM_X/_Y = percentage to zoom in/out picture, default is 100
OPACITY = transparency, default 255
BLEND_TYPE = normal (0), add (1), sub (2)

...and the game variable ID accordingly.


Alternatively, you can change Game_Picture's name attribute to accessor:
attr_reader   :name                     # file name

into
attr_accessor :name                     # file name

And use the script call:
$game_screen.pictures[NUMBER].name = $game_variables[1]

Assuming all you want to do is change the graphic it uses and nothing else.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

jayje

December 27, 2018, 07:41:37 am #2 Last Edit: December 27, 2018, 08:44:01 am by jayje
I tried to use this:
$game_screen.pictures[12].show(Wraith, [0], 120, 120, 0, 0, 255, [0])

and got an error. So I messed up. I have a bunch of pictures, numbered 1-100, that correspond to the actor  IDs in my database. Each picture is called 'Face" followed by a number face1, face2, etc. How would I get it to show these pictures with a variable?

I'm Looking to do something similar to this. A combination of SHOW Choice and Pictures:


KK20

A lot of things wrong with that script call of yours.

  • Wraith needs to be a string, which is surrounded by quotes. So either 'Wraith' or "Wraith".

  • ORIGIN and BLEND_TYPE are not arrays. Drop the square brackets around them. What I meant in my explanation
    Quoteupper-left (0) or center (1)
    normal (0), add (1), sub (2)

    is "use one of the following integers". Otherwise I would have indicated that you should put the number in an array.

  • ZOOM_X and ZOOM_Y should be set to 100, not 0, if you don't want to apply any zooming. A zoom value of 0 means your picture is zoomed out so far that it is infinitesimally small, i.e. invisible.



Assuming $game_variables[1] holds some integer value,
name = 'face' + $game_variables[1].to_s
$game_screen.pictures[12].show(name, 0, 120, 120, 100, 100, 255, 0)





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

jayje

December 27, 2018, 09:21:31 pm #4 Last Edit: December 27, 2018, 09:22:51 pm by jayje
I got an error using that scriptlet:
name = 'face' + $game_variables
[920].to_s
$game_screen.pictures[12].show(name,
0, 120, 120, 100, 100, 255, 0)


Quote"TypeError occurred while running script. cannot convert Game_Variables into string"


KK20

It's because the lines are broken up incorrectly. The [920].to_s needs to be on the same line as $game_variables. So put the line break after the plus sign.
name = 'face' +
$game_variables[920].to_s





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

jayje

Thanks for the headsup. I'll post the results later on.