X Tutup

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
So this is all a new thing for me, I have little to no idea how to officially code besides some very basic stuff, however, I did figure out how to do something that have been bothering me for a while now in RPG maker MZ, I figured out how to make chip damage (sorta)... so in rmmz_objects.js line 1957 to 1971 it says:

};

Game_Action.prototype.evalDamageFormula = function(target) {
try {
const item = this.item();
const a = this.subject(); // eslint-disable-line no-unused-vars
const b = target; // eslint-disable-line no-unused-vars
const v = $gameVariables._data; // eslint-disable-line no-unused-vars
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;
const value = Math.max(eval(item.damage.formula), 0) * sign;
return isNaN(value) ? 0 : value;
} catch (e) {
return 0;
}
};


NOW this is good because on line 1966 it says:

const value = Math.max(eval(item.damage.formula), 0) * sign;

if you write in a 1 instead of a 0 such as:

const value = Math.max(eval(item.damage.formula), 1) * sign;

it makes the minimum damage number to 1!

this is wonderful as I hate the damage doing 0 (just my preference) but here's why I'm writing this thread as I've already made this into a working plugin and called it Chip_Damage.js

HOW DO YOU MAKE PARAMETERS!?
my goal is to have it so I can change the number not just to a 1... but to ANY number I want using in game parameters to ether
1. be able to just change it without re-coding the plugin each time OR
2.be able to use the plugin command to change it on the fly mid game

so to sum this all up, I just need some tips and advice of how I can make it so the number 0 in the line of code that is:

const value = Math.max(eval(item.damage.formula), 0) * sign;

can be changed in game with a parameter in the plugin menu.

if anyone can offer support it would be a TON of help to me!
 

Canned_Dinosaur

Werzaque and the Loud Ignorant
Regular
Joined
May 30, 2023
Messages
1,642
Reaction score
2,754
First Language
Duolingo
Primarily Uses
RMMZ
There's threads that go over the plugin basics, so it's recommended to go over those. But to give you the gist, you put this in the header section of the plugin:

* @param Minimum_Damage
* @text Minumum damage on hit
* @desc Set the minimum damage on a successful hit
* @min 0
* @Default 0
* @type number

Then in the code section you define a variable from the parameter:

JavaScript:
const parameters = PluginManager.parameters(PLUGIN_NAME);
const pMinimumDamage = Number(parameters["Minimum_Damage"]);

Then you can use it in your overwrite.
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
There's threads that go over the plugin basics, so it's recommended to go over those. But to give you the gist, you put this in the header section of the plugin:

* @param Minimum_Damage
* @text Minumum damage on hit
* @desc Set the minimum damage on a successful hit
* @min 0
* @Default 0
* @type number

Then in the code section you define a variable from the parameter:

JavaScript:
const parameters = PluginManager.parameters(PLUGIN_NAME);
const pMinimumDamage = Number(parameters["Minimum_Damage"]);

Then you can use it in your overwrite.
Thank you! I will try what you have given and go over the general plugin basics!

If you have a thread suggestion I'd find that helpful also, however if not, I will find one that just covers the general stuff :)
 

Canned_Dinosaur

Werzaque and the Loud Ignorant
Regular
Joined
May 30, 2023
Messages
1,642
Reaction score
2,754
First Language
Duolingo
Primarily Uses
RMMZ
Thank you! I will try what you have given and go over the general plugin basics!
Please, do it the other way around. FIRST go over the general plugin basics. DO NOT just copy paste what I showed you without understanding the basic structure of a plugin :kaoswt:
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
Please, do it the other way around. FIRST go over the general plugin basics. DO NOT just copy paste what I showed you without understanding the basic structure of a plugin :kaoswt:
Oh...whoops well I will do that the other way around now as I wrote all it in and didn't know where to put it haha... yaaa... well thanks for the warning lol

as for just giving what I have currently (just because it might be painfully obvious what to do) here it is- again thank you for the help! if it's just a simple "drag it to line (x)" that would be great, otherwise I'll look up what to do and how the general flow works on a different thread about plugins ;)


The one nice thing is that my plugin works and does what I want, aside from the parameter functions (what I'm trying coding in)

Edit: thanks for giving a plugin basics link in the first reply, I didn't see that until now.
 

Attachments

  • Current state of Chip_Damage.png
    Current state of Chip_Damage.png
    705 KB · Views: 5

Canned_Dinosaur

Werzaque and the Loud Ignorant
Regular
Joined
May 30, 2023
Messages
1,642
Reaction score
2,754
First Language
Duolingo
Primarily Uses
RMMZ
You need to wrap your code in an IIFE, since otherwise you're creating global variables, eg:

JavaScript:
( () => {
//stuff
} )();

Again, it's better to start with the template in the other thread if you're unsure.
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
You need to wrap your code in an IIFE, since otherwise you're creating global variables, eg:

JavaScript:
( () => {
//stuff
} )();

Again, it's better to start with the template in the other thread if you're unsure.
Ah well... I'll definitely read up on plugin basics and some more on JavaScript, because as it stands- I have little to no experience with this all, and I don't really even know how I made my original plugin even work tbh- blind luck maybe? Idk, however thanks for taking the time to help with all this! It's awesome to see how actually helpful this community is!
 

Aerosys

Regular
Regular
Joined
Apr 23, 2019
Messages
1,671
Reaction score
2,114
First Language
German
Primarily Uses
RMMZ
Ah well... I'll definitely read up on plugin basics and some more on JavaScript, because as it stands- I have little to no experience with this all, and I don't really even know how I made my original plugin even work tbh- blind luck maybe? Idk, however thanks for taking the time to help with all this! It's awesome to see how actually helpful this community is!
That's the tricky thing. Many plugins work fine in your project, but as soon as you or someone else uses your plugin with another plugin, and one of them does not follow common conventions, they will break your game (people start saying that plugin X is not compatible with Y). That means many errors stay undetected. Some concepts are difficult to fully understand for a beginner and require practice to master.

An IIFE is a simple tool to make your plugin robust, but it also has its pros and cons. Sooner or later, you should invest some time to understand what they are really doing, but for the beginning, it's okay just to use them, I think.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
11,982
Reaction score
5,546
First Language
Dutch
Primarily Uses
RMMV
use it best without IIFE, but you mostly probably require to use "use strict".

another way is to alias the function if possible, so it wont be a full override,
or use your own global name (less likely to overwrite).

you can check some plugins how they do it though, so you can make your own.
in my case, I can give it direct parameters without calling them first as global.

so it has its own parser, to I can avoid JSON.parse in this case, or .map
in some cased unless required.

if you know most basics, and understand the core, you can come further,
but it isn't always easy as I keep learning too ^^
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
7,985
Reaction score
10,509
First Language
English
Primarily Uses
RMMZ
For future reference and an alternative viewpoint, I actually prefer using a uniquely-named container object (I generally use TLB to store all of my aliases and variables); the benefit of that over an IIFE is that other plugins can reference them if needed. When you use an IIFE, it completely encapsulates the code, so any new class, variable or property you create can only be accessed by your plugin and nothing else. If you try to reference it outside of that, you'll get a "not defined" error.
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
This thread has gotten surprisingly informative lol, I didn't expect this much JavaScript info as Canned_Dinosaur provided a good amount of useful info already!
 

Canned_Dinosaur

Werzaque and the Loud Ignorant
Regular
Joined
May 30, 2023
Messages
1,642
Reaction score
2,754
First Language
Duolingo
Primarily Uses
RMMZ
As I experienced two years ago when I was struggling with my first tiny plugin, people here seem very very eager to drag the willing into coding hell :kaojoy:
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
As I experienced two years ago when I was struggling with my first tiny plugin, people here seem very very eager to drag the willing into coding hell :kaojoy:
Knowledge is power? Idk but I do find all this fun tbh (even if very complicated), I've never really been into coding or RPGs until recently, so this is all pretty neat ESPECIALLY because of how active this community is and willing to help!

If I may ask- what was the function of the first plugin you made?
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
7,985
Reaction score
10,509
First Language
English
Primarily Uses
RMMZ
Knowledge is power? Idk but I do find all this fun tbh (even if very complicated), I've never really been into coding or RPGs until recently, so this is all pretty neat ESPECIALLY because of how active this community is and willing to help!

If I may ask- what was the function of the first plugin you made?
I know I'm not the one you asked, but for me, outside of the work I did with VisuStella, the first MZ plugin I did was my Limited Shop Stock one, which allows you to give shops defined inventory.
 

Canned_Dinosaur

Werzaque and the Loud Ignorant
Regular
Joined
May 30, 2023
Messages
1,642
Reaction score
2,754
First Language
Duolingo
Primarily Uses
RMMZ
If I may ask- what was the function of the first plugin you made?
Actually not sure which was the first... I think it was something about making event touch trigger after a jump? (by default there is no check for triggering touch events after a jump) I remember it feeling pretty overwhelming, like being drilled by Gunnery Sergeant Hartman (joke, everyone was very nice and patient).
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
Actually not sure which was the first... I think it was something about making event touch trigger after a jump? (by default there is no check for triggering touch events after a jump) I remember it feeling pretty overwhelming, like being drilled by Gunnery Sergeant Hartman (joke, everyone was very nice and patient).
Oh that's neat- pretty nice and simple, but I could see how that would be complicated lol, I've only made one functional plugin myself, being just a plugin to move the timer graphic down a few pixels... Not super exiting lmao, not one I have that's a lifesaver is just a plugin that's a description- I put all the script calls info on it so I can use F1 call up plugin help and copy paste stuff like

$gameMap.event(n).start();

and not type it every time- prevents mistakes too :D

but this community is pretty awesome, I didn't expect feedback if I'm being honest, I expected me to post my OG post, then have to wait a week or 2 for someone to say.... "Ya uh just learn JavaScript" and be done lmao not this explosion of coders!
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
I know I'm not the one you asked, but for me, outside of the work I did with VisuStella, the first MZ plugin I did was my Limited Shop Stock one, which allows you to give shops defined inventory.
And also thanks for the name of that shop plugin Trihan! I'm using it currently and it's bomber, exactly what I was looking for a while ago
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
7,985
Reaction score
10,509
First Language
English
Primarily Uses
RMMZ
And also thanks for the name of that shop plugin Trihan! I'm using it currently and it's bomber, exactly what I was looking for a while ago
Oh, nice! Are there any features it lacks that you need?
 

Ebon_Maker5

Regular
Regular
Joined
Aug 11, 2025
Messages
88
Reaction score
22
First Language
English
Primarily Uses
N/A
Oh, nice! Are there any features it lacks that you need?
Um wow... well
As I only plan on using the limited inventory function, currently nothing that comes to mind, it's pretty much perfect for my project! However if there is something that comes to mind I'll suggest it



Thanks for asking though! I honestly didn't expect that question



On average, how long does a plugin update / making a new plug-in with your coding knowledge take? I'm just wondering because I plan on making generic plugins for myself in the future (simple features and stuff) and just want a generic "good at code" average

I understand if that's a vague question and I also know code isn't a 1 size fits all, but I'm just asking from your experience
 

Latest Threads

Latest Profile Posts

Twitch stream is live with Resident Evil 9! Feel free to drop by!
1000207302.png
All of the skill/system icons: Done
Pepper hopped up on my bed to snuggle earlier... and now there's grains of kitty litter all over the foot of my bed. Now she's in her own bed fast asleep. Sometimes, I like to wonder what Pepper dreams about... does she dream of chasing her toys? Pouncing on the lizards she sees on her patio? Purring in a sunny window? Receiving pets and scritchies?
Oh no... she's back in my bed.
Really interesting seeing the public be so okay with the placeholder art in Slay the Spire 2. I guess they trust in the potential of the final product, but it would be cool if the general consumer had a better understanding of dev pipelines.
Haven't updated my status in awhile. I'm taking a short break from working on my game because I have a sliiiight burnout,,

Forum statistics

Threads
154,254
Messages
1,407,567
Members
209,657
Latest member
MINGKY3
Top
X Tutup