[MZ] Phileas's Cursor (MZ MOUSE cursor customizer)

Plugin name: Phileas's Cursor

Author: Phileas

Version: 1.3.10 for MZ

Release date:
1.0.0 - 20.August.2023
1.1.0 - 21.August.2023
1.1.1 - 24.August.2023
1.2.0 - 11.March.2024
1.2.1 - 13.March.2024
1.3.0 - 16.March.2024
1.3.1 - 18.March.2024
1.3.2 - 19.March.2024
1.3.3 - 11.May.2024
1.3.5 - 28.May.2024
1.3.6 - 23.September.2024
1.3.7 - 30.December.2024
1.3.8 - 11.October.2024
1.3.9 - 04.January.2025
1.3.10 - 06.January.2025

Plugin description:
Changes the cursor image to any of the img/system.
Animated cursors are supported, details below.
Use png format!
To change the cursor to the standard one, do not select an image in the parameter/argument (option "(None)").

Plugin commands:
  • Change the default cursor
  • Change the battle cursor
  • Change the menu cursor
  • Hide cursor
  • Show cursor
  • Configure an event - configures the cursor for a single event
  • Configure an event (global) - configures the cursor for a single event on any map
  • Freeze the cursor and Unfreeze the cursor - control the freezing of the cursor
If cursor freeze is enabled, the cursor image will not be updated.
Optimization is useful if you don't use animations, click images, and event cursors.

You can set the cursor configuration for an event using the plugin command and using tags in the event notes:
  • <CursorPicture:cursor> - this picture (cursor.png) will be used when the cursor is hovered over the event.
  • <CursorClickPicture:cursorClick> - the picture displayed when clicked (if not specified, the cursor will not change when clicked)
  • <CursorXOffset:5> - the click point will be shifted 5 pixels horizontally from the upper-left corner
  • <CursorYOffset:5> - the click point will be shifted 5 pixels vertically from the upper-left corner
  • <CursorFramesNumber:3> - the cursor will be animated with 3 frames of animation
  • <CursorClickFramesNumber:3> - the cursor will be animated with 3 frames of animation when clicked
  • <CursorStartOnClick> - the event will be triggered when you click on it.
  • <CursorStartOnHover> - the event will be triggered when the cursor is hovered over it.
The settings set by the plugin command are saved along with the game progress.
When loading the map, the settings set by the plugin commands are first set. If there are none, the settings from the tags are loaded.

You can also switch the invisibility of the cursor by pressing the keyboard, mouse and gamepad keys.
To do this, configure the plugin settings. If you want to specify a key by a string name, set 0 to the number value.

ABOUT ANIMATED CURSORS
To make the cursor animated, set the CursorFramesNumber value (number of frames) via a parameter, command, or plugin tag.
The value must be greater than 1.
Animation is configured separately for the image when clicked, if there is one.
You must place in the "img/system" folder as many cursor images as you specified frames.
Specify the image of the first frame as the cursor image (CursorPicture) in the parameter.
Let's say this file is called "cursor.png" and you specified 3 frames.
Then the names of the other two files should be as follows:
  • "cursor1.png"
  • "cursor2.png"
That is, they must end with the frame number, numbering starts from 0.
You do not need to specify the number for the first frame file!

You can configure the preloading of cursor resources. This will speed up the switching of cursor images, but it may slow down the launch of the game.
Images from the basic cursors (default, battle and menu) are always cached.
If preloading of maps is disabled, the map event commands are cached when loading this map.
If the preloading of general events is disabled, the commands of this event are cached when it is called.

If the cursor image is not displayed, try to reduce its size.

How it looks like:

2024-03-16_21-27-21.png


2024-03-16_21-27-59.png


2024-03-16_21-28-16.png


Code

License
This plugin is released under MIT license.
This means that you can freely use the plugin in non-commercial and commercial games and even edit it.
But be sure to include me in the credits!

Compatibility:
If there are any problems, write to me.
Update 1.1.0!

Added parameters:
  • "Hide at startup?" - if true, the cursor will be invisible when the game starts.
  • "Keyboard/mouse/gamepad key to hide" - when you press this key, the invisibility of the cursor will switch.

Added commands:
  • "Hide cursor" - makes the cursor invisible.
  • "Show cursor" - makes the cursor visible.

See the first message of the topic.
Update 1.1.1

Fixed a gamepad bug.
Does your plugin have the ability to replace the cursor image when hovering over events and removing the hover? How does your plugin react when the cursor goes outside the game window?
Updated to 1.2.0

Added the cursor setting for the event using tags and the plugin command.
Changing the image when hovering over an event, launching an event by clicking and hovering over it.
Updated to 1.2.1!
  • Now the cursor settings for the event, set using the plugin command, are saved to the save files and restored from them.
    • When loading the map, the cursor settings set by the commands are checked first. If there are none, the settings from the tags are loaded.
  • I also added a global command that allows you to set the cursor for an event on any map. It can be useful in common events.
Updated to 1.3.0!

The plugin has been significantly improved and expanded.
  • Animated cursors
  • The ability to set a separate image for a click
  • Offset of the click point (for example, if you need to click with the cursor center)
  • The ability to customize cursors for battles and menus
Unfortunately, I don't have time to thoroughly test the plugin. Please let me know about any problems.
Updated to 1.3.1

Added the ability to preload all cursor images. Enabled by default.
The plugin scans all the events of the game and loads all the cursor images that are used in notes and commands. Of course, the images from the plugin parameters are also cached.

I've optimized the code a bit. Replaced the animation period with the cursor update period, which is measured in frames (by default - 6 frames, this is about 10 times per second at FPS = 60).
1.3.2

Optimized the code a little more.

The idea of setting the refresh rate in frames was unsuccessful. I returned to the old logic, the animation frequency in milliseconds is adjusted separately.

Complicated the preload setup. A full preload will speed up the switching of cursor images, but it may slow down the launch of the game.
Now the images from the basic cursors (default, battle and menu) are always cached.
If preloading of maps is disabled, the map event commands are cached when loading this map.
If the preloading of general events is disabled, the commands of this event are cached when it is called.
If you enable a full preload, when the game starts, all maps and general events are scanned for the use of the plugin, and images from all tags and commands are cached.

Sorry for such frequent updates, the first ideas are not always the most successful.
1.3.3

Now you can disable and enable event cursors.
1.3.4
  • Fixed switching of menu cursors and battles.
  • Fixed disabling event cursors.
1.3.5

Fixed restoring cursor settings when loading a save.
It's strange that no one wrote about the bug...
Hello!

I've run into a problem while using your cursor and wasn't able to find a solution. I'm using QTE and Trigger System VisuStella MZ and whenever I hover the cursor over an event with a Timing Bar mini-game, I get an error that crashes the game.

Zrzut ekranu 2024-09-02 211133.png


This is what the console log shows:

Zrzut ekranu 2024-09-02 211139.png


I tried to disable the cursor for events and hide the cursor but I still got the error. What is curious, my other mini-game that uses the Timed Sequence QTE works fine with the cursor. It might be some incompatibility issue within the Visustella's plugin. I wanted to let you know nevertheless.
1.3.6
Cursor data getting fix.

It is possible to fix compatibility with the VisuStella plugin.
Unfortunately, this is a paid plugin, and I'm not going to buy it, so I can't test it myself.
Aeghite, I ask you to give me feedback.
1.3.6
Cursor data getting fix.

It is possible to fix compatibility with the VisuStella plugin.
Unfortunately, this is a paid plugin, and I'm not going to buy it, so I can't test it myself.
Aeghite, I ask you to give me feedback.
It works perfectly now! Thank you so much! :LZSproud:
You have such great plugins in general, but this one was my favorite to add a cute bit of flavor to my project! Thank you so much for sharing your work.
will I able to change cursor when hovering a picture / image?
will I able to change cursor when hovering a picture / image?
I have not added such functionality yet.
1.3.7

Added a parameter:
Cursor is frozen by default

And 2 commands:
  • Freeze cursor
  • Unfreeze cursor

If cursor freeze is enabled, the cursor image will not be updated.
Optimization is useful if you don't use animations, click images, and event cursors.
1.3.8

Fixed common events preloading.

Original thread: https://forums.rpgmakerweb.com/threads/mz-phileass-cursor-mz-mouse-cursor-customizer.160470/