Simple Confetti Plugin

Hi! I have made a simple Confetti Effect script (first script, with the help of ChatGPT 😅) and after some struggling it works. I would like to share it with you. Maybe it can help someone...
// ==Plugin== // @name confetti // @desc A plugin to add colorful confetti effect to the game. // ==/Plugin== (function() { var confettiEnabled = false; var confettiContainer = null; var shouldStopConfetti = false; // New variable var _Scene_Map_start = Scene_Map.prototype.start; Scene_Map.prototype.start = function() { _Scene_Map_start.call(this); if (confettiEnabled && !shouldStopConfetti) { // Check shouldStopConfetti this.startConfettiEffect(); } }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function() { _Scene_Map_terminate.call(this); shouldStopConfetti = true; // Set to true when scene terminates this.stopConfettiEffect(); }; Scene_Map.prototype.startConfettiEffect = function() { var confettiContainer = new Sprite(); confettiContainer.z = 10; this.addChild(confettiContainer); var confettiImages = ['confetti', 'confetti2', 'confetti3']; var numConfetti = 100; for (var i = 0; i < numConfetti; i++) { var confettiImage = confettiImages[Math.floor(Math.random() * confettiImages.length)]; var confetti = new Sprite(ImageManager.loadPicture(confettiImage)); confetti.x = Math.random() * Graphics.width; confetti.y = -Math.random() * 200; confetti.anchor.x = 0.5; confetti.anchor.y = 0.5; confetti.rotationSpeed = Math.random() * 0.1 - 0.05; confetti.fallSpeed = Math.random() * 2 + 2; confetti.tilt = Math.random() * 30 - 15; confetti.blendMode = PIXI.BLEND_MODES.ADD; confettiContainer.addChild(confetti); } confettiContainer.update = function() { for (var i = 0; i < this.children.length; i++) { var confetti = this.children[i]; confetti.rotation += confetti.rotationSpeed; confetti.y += confetti.fallSpeed; confetti.x += Math.sin(confetti.rotation) * confetti.tilt; if (confetti.y > Graphics.height) { confetti.x = Math.random() * Graphics.width; confetti.y = -10; } } }; }; Scene_Map.prototype.stopConfettiEffect = function() { if (confettiContainer) { this.removeChild(confettiContainer); confettiContainer = null; } }; })();
Usage:
To activate script you use SCRIPT command on an event and paste this code:

SceneManager._scene.startConfettiEffect();

If you call the event multiple times... more confetti. Pretty simple.

The effect is auto-disables when you leave the map

You need to have images for the confetti on your /img/pictures/ folder. Their name should be confetti.png, confetti2.png, and confetti3.png. You can change this or add more images or whatever editing this line of the script:

var confettiImages = ['confetti', 'confetti2', 'confetti3'];


I used these three images, you can use them, or edit them or whatever you want. Same with the code. Use it, edit it, improve it, I dont really care.

Greetings, friends!
If it just falls from the sky i bet this could be used for more then just confetti :popcorn:
if you turn the scriptcall to a switch inside a parameter like the image, you
also have a bit more control + user friendly to configure the way they want.

the effect seems nice, as you could use it if you made a goal or achievement.
where you can set a time and remove it (if you add args to the function).

so you have a much wider range of possibility.

grats on the plugin, it looks cool though =)
Hi you both and thank you for your responses!

If it just falls from the sky i bet this could be used for more then just confetti :popcorn:

It does an small rotation effect also, but changing this should be easy editing some lines, I think. I didn't try it, but it should work!

// ==Plugin== // @name confetti // @desc A plugin to add colorful confetti effect to the game. // ==/Plugin== (function() { var confettiEnabled = false; var confettiContainer = null; var shouldStopConfetti = false; var _Scene_Map_start = Scene_Map.prototype.start; Scene_Map.prototype.start = function() { _Scene_Map_start.call(this); if (confettiEnabled && !shouldStopConfetti) { this.startConfettiEffect(); } }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function() { _Scene_Map_terminate.call(this); shouldStopConfetti = true; this.stopConfettiEffect(); }; Scene_Map.prototype.startConfettiEffect = function() { var confettiContainer = new Sprite(); confettiContainer.z = 10; this.addChild(confettiContainer); var confettiImages = ['confetti', 'confetti2', 'confetti3']; var numConfetti = 100; for (var i = 0; i < numConfetti; i++) { var confettiImage = confettiImages[Math.floor(Math.random() * confettiImages.length)]; var confetti = new Sprite(ImageManager.loadPicture(confettiImage)); confetti.x = Math.random() * Graphics.width; confetti.y = -Math.random() * 200; confetti.anchor.x = 0.5; confetti.anchor.y = 0.5; confetti.rotationSpeed = 0; confetti.fallSpeed = Math.random() * 2 + 2; confetti.tilt = 0; confetti.blendMode = PIXI.BLEND_MODES.ADD; confetti.rotation = 0; confettiContainer.addChild(confetti); } confettiContainer.update = function() { for (var i = 0; i < this.children.length; i++) { var confetti = this.children[i]; confetti.y += confetti.fallSpeed; confetti.x += 0; if (confetti.y > Graphics.height) { confetti.x = Math.random() * Graphics.width; confetti.y = -10; } } }; }; Scene_Map.prototype.stopConfettiEffect = function() { if (confettiContainer) { this.removeChild(confettiContainer); confettiContainer = null; } }; })();

if you turn the scriptcall to a switch inside a parameter like the image, you
also have a bit more control + user friendly to configure the way they want.

the effect seems nice, as you could use it if you made a goal or achievement.
where you can set a time and remove it (if you add args to the function).

so you have a much wider range of possibility.

grats on the plugin, it looks cool though =)


As I said, I am not very good at scripting yet. I was looking for a confetti plugin and I didn't found anything, so I did it by myself. Now its enough for me, but if someone with better skills could improve it, that would be great. Anyway, it was fun. Maybe I'll try doing some experiments now that I've lost my fear of scripting. Thanks for your tips!
confetting plugin can be similair to weather effect (set a conffectti image).
simialir to MOG_WeatherPlugin which you can add you own images and
directions and layer part where it goes (above, below etc).

however, while that is more extended version, this is a more simplied version.
but creating is also alot of testing to make it work 🙂

but you have to start somewhere 🙂

my first plugin in creating a plugin is my TF plugin, but those are very small,
some experimental, and aren't the best, but they work 🙂

so see how you can improve it and maybe extend it explosion from the event,
like a chest, that you got something cool 😛

good luck on this, I might try it later, but not something I can use, maybe on my
side game when you beat the game, as it sounds cool or on game over as it is
also evented one, so it should work there too ^^

Original thread: https://forums.rpgmakerweb.com/threads/simple-confetti-plugin.160525/