Any way to assign sprite location to Galv Screen Buttons?

Hahasea

Veteran
Veteran
Joined
Jul 4, 2019
Messages
151
Reaction score
17
First Language
English
Primarily Uses
RMMV
I'm playing with Galv Screen Buttons to be able to make a clickable item that pops up next to the pc sprite. As far as I can tell the plugin only allow you a fixed x,y location on the screen for the button img, wondering if anyone has figured out a workaround to be able to call on the sprite's location and then place the img slightly to the side of it?

Plugin here: https://galvs-scripts.com/2016/11/29/mv-screen-buttons/
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
252
Reaction score
233
First Language
English
Primarily Uses
RMMV
Do you want the button to move continuously with the sprite? If so, you'd have to keep checking for the sprite's location and updating the button position (probably in a parallel process), and that's more complicated and not something I can help with.

However, if the button will be displayed while the sprite is standing still and will be removed after the player clicks on it, that's probably doable though I haven't tried it myself. You can get the player character's or an event sprite's Screen X and Screen Y under Control Variables > Character > Player > Screen X or Screen Y, and then just modify the x and y of the button position accordingly when using Galv's addButton script call.

E.g., let's say you set Variable 1 to the screen X and variable 2 to the screen Y. if you want the button's x-position to be to the left of the sprite, use $gameVariables.value(1) - 48 as the x and $gameVariables.value(2) as the y. You can modify 48 to a bigger or smaller number depending on how far left you want it to be.

Note that you may want to account for cases when the sprite is at the edge of the map (i.e., if it's on the left edge, a button that's added to the left of the sprite won't be visible).
 

Hahasea

Veteran
Veteran
Joined
Jul 4, 2019
Messages
151
Reaction score
17
First Language
English
Primarily Uses
RMMV
Do you want the button to move continuously with the sprite? If so, you'd have to keep checking for the sprite's location and updating the button position (probably in a parallel process), and that's more complicated and not something I can help with.

However, if the button will be displayed while the sprite is standing still and will be removed after the player clicks on it, that's probably doable though I haven't tried it myself. You can get the player character's or an event sprite's Screen X and Screen Y under Control Variables > Character > Player > Screen X or Screen Y, and then just modify the x and y of the button position accordingly when using Galv's addButton script call.

E.g., let's say you set Variable 1 to the screen X and variable 2 to the screen Y. if you want the button's x-position to be to the left of the sprite, use $gameVariables.value(1) - 48 as the x and $gameVariables.value(2) as the y. You can modify 48 to a bigger or smaller number depending on how far left you want it to be.

Note that you may want to account for cases when the sprite is at the edge of the map (i.e., if it's on the left edge, a button that's added to the left of the sprite won't be visible).
Thanks, this 'sort of' works. It's weird actually, I've just been testing it as $gameVariables.value(x) to get it working, and for some reason the button does not locate exactly on the event location, it's offset to the right and down a fair bit. And I can't for the life of me figure out why. I'm attempting to get it to appear next to an NPC event, that I will eventually have on a movement route. At the moment it's just static while I figure out how to get this to work.

Screen Shot 2020-03-21 at 12.46.35 am.png
The NPC event (event 001) is the purple haired sprite. Super weird that the image is so offset.

This is what I have in the event (couldn't get the whole script call in one screen grab, sorry!)

Screen Shot 2020-03-21 at 12.37.52 am.png
Screen Shot 2020-03-21 at 12.38.07 am.png

I mean, logically the button should appear right over the NPC right? I'm not sure why it's offset...
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
252
Reaction score
233
First Language
English
Primarily Uses
RMMV
Based on this post, Screen X and Y "point at the middle of the bottom of your character's sprite". So it's not surprising that the image appears below the sprite (since the x and y in Galv's script call refer to the upper left position of the image). If your "Event!" image has a small transparent border, that's probably the reason why it's looks offset to the right. If not, you might want to show us just the "Event!" image.
 

Hahasea

Veteran
Veteran
Joined
Jul 4, 2019
Messages
151
Reaction score
17
First Language
English
Primarily Uses
RMMV
Based on this post, Screen X and Y "point at the middle of the bottom of your character's sprite". So it's not surprising that the image appears below the sprite (since the x and y in Galv's script call refer to the upper left position of the image). If your "Event!" image has a small transparent border, that's probably the reason why it's looks offset to the right. If not, you might want to show us just the "Event!" image.
Ah gotcha, ok, I'll just manually shift it to the right spot, just wanted to make sure I was doing it right. Thanks for your help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top