MZ Custom Show Balloons (Mostrar Globos Animados) for MZ; compatibility Issue

JavaScript:
/*:
 * @target MZ
 * @plugindesc Plugin para mostrar globos de texto en eventos, el jugador o miembros del grupo.
 * @url
 * @author RafusGarrafus
 *
 * @command CustomShowBalloon
 * @text Mostrar Globo de Texto
 * @desc Muestra un globo de texto en el objetivo especificado con el ID del globo proporcionado.
 *
 * @arg target
 * @text Objetivo
 * @type select
 * @option Este Evento
 * @option Jugador
 * @option Primer Seguidor
 * @option Segundo Seguidor
 * @option Tercer Seguidor
 * @desc Selecciona el objetivo para mostrar el globo de texto.
 * @default Este Evento
 *
 * @arg balloonID
 * @text Tipo de Globo
 * @type select
 * @option Exclamación
 * @option Interrogación
 * @option Nota Musical
 * @option Corazón
 * @option Enojo
 * @option Sudor
 * @option Frustración
 * @option Silencio
 * @option Bombilla
 * @option Zzz
 * @desc Selecciona el tipo de globo de texto a mostrar.
 * @default Exclamación
 *
 * @arg durationSeconds
 * @text Duración (segundos)
 * @type number
 * @decimals 2
 * @min 0.01
 * @desc La duración del globo en segundos.
 * @default 1.25
 */

(() => {
    const pluginName = "CustomShowBalloon";
    const commandName = "CustomShowBalloon";

    const balloonIDs = {
        "Exclamación": 1,
        "Interrogación": 2,
        "Nota Musical": 3,
        "Corazón": 4,
        "Enojo": 5,
        "Sudor": 6,
        "Frustración": 7,
        "Silencio": 8,
        "Bombilla": 9,
        "Zzz": 10
    };

    PluginManager.registerCommand(pluginName, commandName, args => {
        const target = args.target;
        const balloonName = args.balloonID;
        const balloonID = balloonIDs[balloonName];
        const durationSeconds = parseFloat(args.durationSeconds); // Duración del globo en segundos

        let eventID;

        switch (target) {
            case "Este Evento":
                eventID = $gameMap._interpreter.eventId().toString();
                break;
            case "Jugador":
                eventID = "player";
                break;
            case "Primer Seguidor":
                eventID = "follower:1";
                break;
            case "Segundo Seguidor":
                eventID = "follower:2";
                break;
            case "Tercer Seguidor":
                eventID = "follower:3";
                break;
        }

        if (eventID !== undefined) {
            // Mostrar el globo de inmediato
            if (eventID === "player") {
                $gameTemp.requestBalloon($gamePlayer, balloonID);
            } else if (eventID.startsWith("follower:")) {
                const followerIndex = parseInt(eventID.split(":")[1]);
                const follower = $gamePlayer.followers().follower(followerIndex - 1);
                if (follower) {
                    $gameTemp.requestBalloon(follower, balloonID);
                }
            } else {
                const event = $gameMap.event(parseInt(eventID));
                if (event) {
                    $gameTemp.requestBalloon(event, balloonID);
                }
            }

            const intervalID = setInterval(() => {
                if (eventID === "player") {
                    $gameTemp.requestBalloon($gamePlayer, balloonID);
                } else if (eventID.startsWith("follower:")) {
                    const followerIndex = parseInt(eventID.split(":")[1]);
                    const follower = $gamePlayer.followers().follower(followerIndex - 1);
                    if (follower) {
                        $gameTemp.requestBalloon(follower, balloonID);
                    }
                } else {
                    const event = $gameMap.event(parseInt(eventID));
                    if (event) {
                        $gameTemp.requestBalloon(event, balloonID);
                    }
                }
            }, 1250); // Repetir la animación cada 1250 milisegundos (que es la duración base del globo)
            
            setTimeout(() => {
                clearInterval(intervalID);
                SceneManager._scene._spriteset.removeAllBalloons(); // Detener todas las animaciones de globo
            }, durationSeconds * 1000);
        } else {
            console.error("Error: No se pudo obtener el ID del evento.");
        }
    });
})();


He creado este plugin, es muy simple, llamas a un comando de plugin desde un evento o evento comun, configuras tus opciones, y listo, es muy muy simple, pero útil, pero tengo un problema, yo no soy programador y parece que si uso Show Text con el plugin de Visustella no se muestra el globo, mientras que si no llamo a un showtext o si lo llamo desde un proyecto sin el plugin de visustella entonces si funciona

I have created this plugin, it is very simple, you call a plugin command from an event or common event, you configure your options, and that's it, it is very very simple, but useful, but I have a problem, I am not a programmer and it seems that I use Show Text with the Visustella plugin the balloon is not shown, whereas if I don't call a showtext or if I call it from a project without the visustella plugin then it does work


Alguna idea de como compatibilizarlo? podeis comentar mejoras que pueda hacer y vere si soy capaz de ello, podeis descargarlo para usarlo en vuestros proyectos si os es util

Any idea how to make it compatible? You can comment on improvements that I can make and I will see if I am capable of it, you can download it to use it in your projects if it is useful to you

No me e presentado, soy nuevo en el foro, llamadme Rafus la mayoria de mis trabajos estarán en castellano y los traducire poco a poco al ingles, tratare de postear en ambos idiomas, no soy programador, solo un fan, asique mis trabajos no estaran muy pulidos, pero siempre estoy encantado de aprender, grarcias por dejarme forrmar parte de esta comunidad.
Muchas de las traducciones al ingles las haré con google transalate en mis posts, por ahorrar tiempo, solo por avisar que alomejor esta escrito raro.

I have not introduced myself, I am new to the forum, call me Rafus, most of my works will be in Spanish and I will translate them little by little into English, I will try to post in both languages, I am not a programmer, just a fan, so my works will not be very polished, but I am always happy to learn, thank you for letting me be part of this community.
I will do many of the translations into English with Google Transalate in my posts, to save time, just to warn you that maybe it is written strangely.
Welcome!

If you are not a programmer, how did you make the plugin? Our forum rules prohibit distributing plugins made by AI.
I'm not a programmer, just an amateur.
It is not made by an AI but it is true that I use AI to quickly find errors, or look for alternatives to the code, I practically used forums to decide how to approach the plugin. My saving problem is that I have no way of seeing how to make it compatible as I mentioned above.
If helping me with AI is a problem we can remove it from the forum and I sincerely apologize, my main reason for sharing it was to seek help to make it compatible, and by the way, if it helps someone to use it, the last thing I want is generate a problem.
and thank you for the welcome!! 🙂
You can use AI as an error-checker so long as the code itself was written by you.

It's probably just a matter of terminology or translation - it seemed odd for you to say you're "not a programmer" then produce this well-formatted and pretty lengthy code.

The problem with making something compatible with VisuStella is they obfuscate the code of their plugins. So if your plugin and theirs are both overwriting the same function, it's impossible to see what they've done and accommodate it.

So if yours doesn't work even placing it beneath all VisuStella plugins in the plugin manager, there's not a lot anyone can do to help.
Thanks for thinking that the code is well structured.
Yes, I also can't access the visustella code, it seems to be encrypted, it's a shame because I wanted to give more life to the messages, maybe I have to work on another plugin to make attractive messages and use the balloons. but thanks for the quick response. If I make progress on anything I'll let you know!

Original thread: https://forums.rpgmakerweb.com/threads/custom-show-balloons-mostrar-globos-animados-for-mz-compatibility-issue.167281/