Event Popup Tips and Tricks

From Yanfly.moe Wiki
Jump to navigation Jump to search

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.


Introduction

EventPopupTut 4.gif

Since the version 1.55 update of Events and Movement Core, you can use the new Plugin Command called "Event Popup", which creates text above specific targets like the player character or an event, and move it. This feature is made by none other than yours truly, Arisu! There's many applications in which this can be used, but only if you change the way it's used. Let's take a look at them!

ArisuAvatar2.png This is an article written by Arisu.

Oh, and just as a reminder, you do need to have Message Core installed in the same project for this Plugin Command to work.


Use Cases

Quick Messages

EventPopupTut 1a.gif

Similar to how Gab Windows and Proximity Messages are used, this feature can be used to depict quick conversations happening as the player draws near without needing to stop the player. Not much needs to be changed in order for this to work. Just change between using the Plugin Command Event Popup: Event's Event ID parameter to shift between events if needed or by using the Event Popup: Player Plugin Command if you want the text to come from the player.

Normally, the text would fly upward, but if you go into the Plugin Command's Popup Settings and change the Ending Offset Y to match the Starting Offset Y value, the text will still in place like such:

EventPopupTut 1b.png

Make sure the Ending Offset X to match the Starting Offset X values are the same, too! This change to the default Popup Settings will prevent the text from floating upwards and appear above the target character's head briefly.


Obtain Items

EventsMoveCore Update132 Preview.gif

Given this is probably how this feature will be used the most, we decided to make it the default values for the Event Popup: Player Plugin Command. This uses the Message Core text code of \LastGainObjQuantity and \LastGainObj to work. For the sake of this tutorial, I'll explain the process:

First, go to an event that would give the player an item. This can be a treasure chest, exploring a cupboard, etc. For the purpose of this example, we'll use the Treasure Chest quick event. However, we have removed the Show Message event command in favor of the Plugin Command Event Popup: Player.

EventPopupTut 2a.png

Within that inserted Plugin Command, we change the Message Text parameter to display the following:

+\LastGainObjQuantity\LastGainObj

The text codes from the Message Core will display how many of the item the player just received and which item the player has just received.

EventPopupTut 2b.png

If this is the player losing items instead, remove the "+" from the Message Text.

This shows that you can use text codes in Event Popups, and from there, we can explore the possibilities even more.


Giving Gifts

EventPopupTut 3.gif

Allowing text codes to be used enables possibilities like giving gifts between two characters on the screen. For this example, we do this from the Plugin Command Event Popup: Player.

EventPopupTut 3a.png

By changing the Message Text to an icon text code, we emulate the giving of such an item to the target character. That much should be easy to figure out. But how do we make it travel from one character to another?

The answer to that lies in the Popup Settings and more specifically, the offsets:

EventPopupTut 3b.png

We lowered the Y offsets because we want the item to appear closer to the middle of the characters' bodies. -24 is good enough here. Like with the example of a Quick Message, keep the starting and ending offset Y the same. By changing the ending offset X to +48, we have the popup travel right one tile.

However, there is a problem with this arrangement. These settings will only work if you active the target event from the left so that the popup will travel right. We need the player to be flexible in how this is handled. So, from here, we use JavaScript in the offsets!

EventPopupTut 3c.png

These values need to be changed as such:

Starting Offset X

+0

Starting Offset Y

($gameMap.tileHeight() / -2)

Ending Offset X

($gamePlayer.direction() === 4) ? -$gameMap.tileWidth() : (($gamePlayer.direction() === 6) ? $gameMap.tileWidth() : 0)

Ending Offset Y

(($gamePlayer.direction() === 8) ? -$gameMap.tileHeight() : (($gamePlayer.direction() === 2) ? $gameMap.tileHeight() : 0)) + ($gameMap.tileHeight() / -2)

These have to be copied and pasted as one line.

This setup allows your player character to give gifts from any of the four main direction to the target event when interacting with them. The heart balloon reaction is optional.


Throwing Items

EventPopupTut 4.gif

With the ability to utilize JavaScript in mind to determine the offsets, you can use this to create the ability to throw items from anywhere on the map at a target event or tile. Let's take a look at how to do this shall we?

Like with before, let's use an icon text code for the Message Text:

EventPopupTut 4a.png

Doing so allows you to change the icon thrown. Here, we'll use a bomb which is icon index 218, perfect for a thrown item.

Now, it's time to calculate the starting and ending offsets. Unlike the previous example where the player is simply next to the target event, this time, we gotta calculate the offset for the event despite the event being anywhere on the map. To do that, we'll use a different formula in the Popup Settings:

EventPopupTut 4b.png

These values need to be changed as such:

Starting Offset X

+0

Starting Offset Y

($gameMap.tileHeight() / -2)

Ending Offset X

($gameMap.event(id).x - $gamePlayer.x) * $gameMap.tileWidth()

Replace "id" with the numeric ID of the event.

Ending Offset Y

(($gameMap.event(id).y - $gamePlayer.y) * $gameMap.tileHeight()) + ($gameMap.tileHeight() / -2)

Replace "id" with the numeric ID of the event.


These have to be copied and pasted as one line.


If you want to just throw the item to an empty tile, do this instead:

Ending Offset X

(targetTileX - $gamePlayer.x) * $gameMap.tileWidth()

Replace "targetTileX" with the numeric X coordinate.

Ending Offset Y

((targetTileY - $gamePlayer.y) * $gameMap.tileHeight()) + ($gameMap.tileHeight() / -2)

Replace "targetTileY" with the numeric Y coordinate.


EventPopupTut 4c.png

If nothing else is changed in the Popup Settings, the item will be "thrown" in a straight line. This may work for certain things objects but not bombs. We need an arc to it. So to do that, we'll adjust the "arc" value in the Popup Settings to 100. This can be any number you want, but 100 gives a pretty reasonable arc for this kind of animation.

Congratulations! You've created a thrown item animation on the map! Just remember to add some explosions or something for the bomb.


Conclusion

EventPopupTut 1a.gif

There's many cool ways to use this new Plugin Command to add more spice to your gameplay or even cutscenes. Experiment with it and see what kinds of neat things you can do. Just remember that whatever can be conveyed through text codes can be used here.


End of File


Fahrradversicherung Neuwert