(MZ) How to show a variable onscreen

So in my game there’s a sort of secondary currency system. There’s two possible things that I would like to do to show you have gotten more of it. Either of these works.

1

When you get granted an amount of it, I want there to be a pop-up in the corner (separate from the text box) that says “You got X points!” or something like that.

2

When you get granted an amount of it, I want there to be a pop-up in the corner (separate from the text box) that says “Points=+0” and then it counts all the way up to “Points=+X”

Does anyone know how to achieve this?

This solution might be how you want it:

One of the default plugins that comes with every created MZ project is TextPicture:
TextPicture

This plugin allows you to show text in any part of the screen, without using the text box with the plugin command.

So when you have an event give you that second currency, you can set a Text Picture using the plugin:


Here, I’m using a variable, just in case you want to keep track of the points gained like that.

Then, just show the picture, and then when you interact with the event, it will show up at the picture coordinates (As said above, Show Picture must not specify an image):


You can use the various Picture commands in order to mess around with this, such as making it fade in and out, ease into and out of position, etc. You might even be able to do the count up part if you really wanted, but I’m not well versed in how that might work. A loop, probably.

Hope this helped!

This is fantastic, thank you! If anyone knows how to add a counting effect, please let me know too!

1 Like

You can do it with the same TextPicture thing, just have to animate it.

You’ll need two variables. I’ll call them pointsValue and pointsValueDisplay.

Before adding/removing points, save in pointsValueDisplay the current value of pointsValueDisplay.

Then change the real points by the amount you want.

Now run a loop, where the pointsValueDisplay will increase/decrease by 1 until it’s equal to the pointsValue. This should make it count from the original value to the new value.

Add to the loop redrawing the picture (use the pointsValueDisplay variable), and don’t forget to add a wait between each draw, 4 frames or so should be enough. Otherwise the effect will go too fast.

Thank you, I’ll see about adding it