Separating a picture's movement from its scale

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.
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.
You would also need to put the move picture commands into script then, otherwise your Move Picture command would reset the scale.
Thanks so much @Eliaquim ! That's exactly what I wanted!
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:
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?
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
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:

Spoiler
1621397977156.png

1621398041744.png

1621398102714.png

Thanks!
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 😳
If you send me a sample project eventing this, I can take a look.
@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

Original thread: https://forums.rpgmakerweb.com/threads/separating-a-pictures-movement-from-its-scale.136621/