Separating a picture's movement from its scale

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
333
Reaction score
79
First Language
English
Hi all,

My goal here is to get a picture tied to a certain event on screen so that every time the camera moves, the pictures stays in place relative to the event. This part is simple - you assign variables to the Screen X and Y of the event, and voila.

The hard part is trying to figure out how to give this picture a gradual scale change over a longer amount of frames (say, 100) and still have it stay in place relative to the event. This is impossible to do with one "Move Picture" command, because the scale and movement are both controlled within this at the same time. Obviously if you run two simultaneous commands for the same picture in separate parallel events, only one of them will take priority.

So the issue seems to be that I need to separate movement from scale, but when I had a look at the script call sheet, it doesn't seem that these commands are broken down.

It would be absolutely wonderful to have a solution to this problem no matter what it involves, but if I can get away with it with some clever scripting over a plugin, that would probably be ideal at this stage in development. Failing that though, a plugin is still fine.

Thank you!

Edited for spelling.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,990
Reaction score
1,459
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

To change the picture scale without the need for the Move picture event command, you can use the script call:

$gameScreen.pictures(picId)._scaleX = value
You can also change the "=" sign to:
+= to add a value, instead of set one.

$gameScreen.pictures(picId)._scaleX = 30 // The scale will be 30.

$gameScreen.pictures(picId)._scaleX += 30 // The scale will be whatever the value is plus 30.
So if it was 100, will be 130.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,490
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
You would also need to put the move picture commands into script then, otherwise your Move Picture command would reset the scale.
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
567
Reaction score
244
First Language
PT-BR
Primarily Uses
RM2k3
Hello!
Apparently you already managed to solve it.
But out of curiosity, how do you check the distance between the Map-Event and the Player (Camera)?

I believe it is possible to do this using only Loop, combining with image position variables (different from the map coordinates)

Sorry for my bad English.

I'm away from my computer to test:
Code:
◆Control Variables:#0002 EVT-PicX = Screen X of Player
◆Control Variables:#0003 EVT-PicY = Screen Y of Player
◆Control Variables:#0003 EVT-PicY -= 24
◆Show Picture:#20, Effect-Dark_Place, Center ({EVT-PicX},{EVT-PicY}), (10%,10%), 255, Normal
◆Tint Screen:(0,0,0,0), 15 frames
◆Loop
  ◆Control Variables:#0002 EVT-PicX = Screen X of Player
  ◆Control Variables:#0003 EVT-PicY = Screen Y of Player
  ◆Control Variables:#0003 EVT-PicY -= 24
  ◆Move Picture:#20, Center ({EVT-PicX},{EVT-PicY}), (100%,100%), 255, Normal, 60 frames
  ◆If:#0005 BreakPic is ON
    ◆Break Loop
    ◆
  :End
:Repeat Above

A IF (Conditional Branch) is required to guarantee the interruption of the Loop. In my tests I realized that the game gets stuck in the Loop even if I turn off the Switch that activated the page or Common Event.

This is the same technique I used here:
 
Last edited:

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
333
Reaction score
79
First Language
English
You would also need to put the move picture commands into script then, otherwise your Move Picture command would reset the scale.


I rushed away from this too soon. How would one script the movement of a picture?

Edit: @Eliaquim , I tested the script you sent through and I can't get it to work. Here's my setup:

I have a parallel event on map that uses the "Show Picture" command to set up picture 1 at 100% scale. The event then erases itself.

I have an event with an action button trigger that then runs this script when prompted:

JavaScript:
$gameScreen.pictures(1)._scaleX = 30

Nothing happens - the picture does not change. What am I doing wrong?
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,990
Reaction score
1,459
First Language
Portuguese - Br
Primarily Uses
RMMZ
I rushed away from this too soon. How would one script the movement of a picture?

Edit: @Eliaquim , I tested the script you sent through and I can't get it to work. Here's my setup:

I have a parallel event on map that uses the "Show Picture" command to set up picture 1 at 100% scale. The event then erases itself.

I have an event with an action button trigger that then runs this script when prompted:

JavaScript:
$gameScreen.pictures(1)._scaleX = 30

Nothing happens - the picture does not change. What am I doing wrong?
Your script call seems fine.
Probably there is another event moving/showing the picture again, and setting its scale to 100.

Try to make the test on a blank map.
Put there just one event.
Show the picture, then change its scale with the script call and see what happens.
If even that not work, send the event page screenshot
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
333
Reaction score
79
First Language
English
Your script call seems fine.
Probably there is another event moving/showing the picture again, and setting its scale to 100.

Try to make the test on a blank map.
Put there just one event.
Show the picture, then change its scale with the script call and see what happens.
If even that not work, send the event page screenshot

@Eliaquim Sure - actually this test was on a blank map with only the two events:

1621397977156.png
1621398041744.png
1621398102714.png

Thanks!
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,990
Reaction score
1,459
First Language
Portuguese - Br
Primarily Uses
RMMZ
Well, that is strange. Because using pictures with the "s", should trigger an error.
The right script call would be this:

$gameScreen.picture(1)._scaleX = 30

Are you sure you are activating this event with the action button?
Are you sure there is no common event running in the background?
If yes, then probably a plugin issue o_O
If you send me a sample project eventing this, I can take a look.
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
333
Reaction score
79
First Language
English
@Eliaquim It doesn't throw an error, but removing the S worked! Thanks.

Regarding moving the picture through a script without affecting the other arguments, do you know how I would do this? Is it possible?

Basically, the same way we've used the scale function, but for the picture movement instead?

EDIT: Nevermind! It appears to be:

JavaScript:
$gameScreen.picture(pictureId)._x
$gameScreen.picture(pictureId)._y
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Phew! logged back. Seems I was too occupied with 3D learning (yeah for RPGM purposes) creating IRL space, trying to grow catnip, dealing with health and DC is good. (so MrC) ^^
Currently trying to add items in the same style as Kyrise's excellent icons. I like having a large variety of items :3 KyriseandMe.PNG
Create MiniMaps, Sprites for MV Enemies, & Aethereal Plane Battlebacks | RPG Maker News #74

Vtubers Vs MOTHER.png

This might be my next project. You like it?
I'm off to search the master script list for my skill issue. HOORAY! FUN!

Forum statistics

Threads
112,328
Messages
1,067,419
Members
145,966
Latest member
Ziaz82
Top