RPG Maker VX Ace

RPG Maker VX Ace

View Stats:
goth sloth Nov 8, 2023 @ 8:17pm
Show Picture Script Call Not Working?
So I know the script call is:

screen.pictures[index].show(file_name, position, x, y, x zoom, y zoom, opacity, blend type)

I have it filled out like

screen.pictures[1].show(1, 0, 0, 0, 100, 100, 255, 0)

But it keeps crashing the game with the error message

Script 'Sprite_Picture' line 40: NoMethodError occurred.

undefined method 'empty?' for 1:Fixnum

I've tried this in a blank project and it still crashes. I'm wondering if anyone knows why this is? The reason I want to use a script call instead of the built in command is because I want to be able to use variables in my photo calls, so I can quickly pull certain images with only a single script call. There's a sort-of "gacha" system in what I'm working on that has up to 300 pull options, and I don't like the idea of having to do 300 conditional branches when it could just be scripted to save time. If I wanted to do something like that, would it look like this?

screen.pictures[1].show($game_variables[52], 0, 0, 0, 100, 100, 255, 0)

I want it to pull from the Pictures folder images based on a variable. So if the gacha variable (52) rolls 60, it would pull an image titled "60" from the pictures folder.
< >
Showing 1-2 of 2 comments
The command is not "screen.pictures...", it is "$game_map.screen.pictures..."
goth sloth Nov 10, 2023 @ 10:00pm 
Originally posted by kittylitterproduction:
The command is not "screen.pictures...", it is "$game_map.screen.pictures..."

Thanks! Weird, I saw multiple posts on RPG Maker forum saying it was the wrong one that I had. I thought I was going crazy when it wouldn't work right. Would you know how I could incorporate a variable to pull certain images? Like if I wanted it to pull images like "Gacha[Variable52].png" so I can set a variable to pull Gacha1.png, Gacha2.png, etc with the same variable.

I'm trying
$game_map.screen.pictures[1].show('Gacha' + $game_variables[52], 0, 0, 0, 100,
100, 255, 0)

But I keep getting
Script 'Game_Interpreter' line 1411: TypeError occurred.
can't convert Fixnum into String

EDIT: Nevermind, got it working by adding ".to_s" after the variable. Don't know much about Ruby coding and didn't realize it can't casually reference variables like that in string without some extra steps.

$game_map.screen.pictures[2].show('Gacha' + $game_variables[52].to_s, 0, 50, 0, 100,
100, 255, 0)
Last edited by goth sloth; Nov 10, 2023 @ 10:14pm
< >
Showing 1-2 of 2 comments
Per page: 1530 50