How to make equipment increase a specific element skill's damage (Solved!)

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
So in Epic Battle Fantasy 5, some equipment have the ability to boost an element's damage.
1638816178925.png

What I'm trying to do is replicate that very same idea with my own equipment. I want the equipment to be able to increase the damage of a specific element while it's equipped to the character.

1638816277421.png

In the example, I wanna make it so that an equipment can increase the damage that thunder skills like Lightning Bolt would normally deal. Is there a way to do this within the program itself, or will it require a plug in? Also please ignore the mistake in the damage formula. I only just noticed it haha.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,162
Reaction score
1,868
First Language
English
Primarily Uses
RMMV
As far as I know, you would have to code it into the damage formula of each skill that uses that element - check for the actor to be wearing the equipment, and alter your damage formula accordingly.
 

pawsplay

Veteran
Veteran
Joined
Mar 29, 2012
Messages
363
Reaction score
120
First Language
English
Primarily Uses
RMMV
I think you would probably put a notetag on the item <Thunder 20> or whatever, and then you would need to have the damage formulas check for that tag and if it is present add the amount or multiply it or whatever.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
As far as I know, you would have to code it into the damage formula of each skill that uses that element - check for the actor to be wearing the equipment, and alter your damage formula accordingly.
So I would have to use something like this at the beginning of each formula with the right element and the right weapon ID? (I honestly wouldn't know how to continue the code so I left it blank after the question mark)
Code:
if a.hasWeapon(ID) ?

I think you would probably put a notetag on the item <Thunder 20> or whatever, and then you would need to have the damage formulas check for that tag and if it is present add the amount or multiply it or whatever.
If I may ask, how would that be worded as a percentage, and what would the code look like in the damage formula to check it? I'm still really new to all the coding and it takes a bit for me to learn and grasp things sometimes.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,073
Reaction score
15,023
First Language
English
Primarily Uses
RMVXA
I know there are also plug-ins that do this too. If you wish we can move this to plug-in requests if you want to investigate that route more.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
I know there are also plug-ins that do this too. If you wish we can move this to plug-in requests if you want to investigate that route more.
I appreciate the offer, but at the moment I'm trying to refrain from plug ins as much as necessary for this minor project I'm doing. I'm still a bit intimidated with coding as is, and adding more things into the mix will just make it that much more difficult for me. If there comes a time where I feel more comfortable with handling plug ins and find them easier, I will definitely dive through the plug in section for help, tips, and ideas.
 

pawsplay

Veteran
Veteran
Joined
Mar 29, 2012
Messages
363
Reaction score
120
First Language
English
Primarily Uses
RMMV
So I would have to use something like this at the beginning of each formula with the right element and the right weapon ID? (I honestly wouldn't know how to continue the code so I left it blank after the question mark)
Code:
if a.hasWeapon(ID) ?


If I may ask, how would that be worded as a percentage, and what would the code look like in the damage formula to check it? I'm still really new to all the coding and it takes a bit for me to learn and grasp things sometimes.

Instead of 20 or whatever, you would just write 1.5 (for whole numbers) or 150 (for percentages), and multiply that times your formula. You could multiply ATTACK itself, or the final damage.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
Instead of 20 or whatever, you would just write 1.5 (for whole numbers) or 150 (for percentages), and multiply that times your formula. You could multiply ATTACK itself, or the final damage.
Okay so let me see if I got the formula right.

Code:
if (a.hasWeapon(14) === true) { (200 + a.mat * 2 - b.mdf * 2)*1.5 } else { 200 + a.mat * 2 - b.mdf * 2 }

Is this what I need to do?

1638850653756.png
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,162
Reaction score
1,868
First Language
English
Primarily Uses
RMMV
Code:
if (a.hasWeapon(14) === true) { (200 + a.mat * 2 - b.mdf * 2)*1.5 } else { 200 + a.mat * 2 - b.mdf * 2 }

Is this what I need to do?
That can work, but it can be way shortened. You basically never need to ask if something == true (and you really don't need to ask if it ===true), you can just ask if it exists (it's like asking if your left hand is your left hand...if you have a left hand, it's left.)

You can also use a ternary operation instead of if else, shortens it just a bit.
Code:
a.hasWeapon(14) ? (200 + a.mat * 2 - b.mdf * 2)*1.5 : 200 + a.mat * 2 - b.mdf * 2

It's not necessary, but makes your code a bit more readable if you think you might ever need to edit it, so you could use a variable:
Code:
var dam = 200 + a.mat * 2 - b.mdf * 2; a.hasWeapon(14) ? dam*=1.5 : dam

If you're not going to get into trying to read/use the meta tags, there's no reason to put one into your weapon's note field.

And just to put it out there:
I'm trying to refrain from plug ins as much as necessary for this minor project I'm doing. I'm still a bit intimidated with coding as is, and adding more things into the mix will just make it that much more difficult for me.
That's kind of opposite logic. The whole point of a plugin is someone else has done the coding, and all you have to do is set the plugin parameters or type some notetags or whatever the instructions say. What you're doing right now is actually more complex than if there were a plugin for it.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
That can work, but it can be way shortened. You basically never need to ask if something == true (and you really don't need to ask if it ===true), you can just ask if it exists (it's like asking if your left hand is your left hand...if you have a left hand, it's left.)

You can also use a ternary operation instead of if else, shortens it just a bit.
Code:
a.hasWeapon(14) ? (200 + a.mat * 2 - b.mdf * 2)*1.5 : 200 + a.mat * 2 - b.mdf * 2

It's not necessary, but makes your code a bit more readable if you think you might ever need to edit it, so you could use a variable:
Code:
var dam = 200 + a.mat * 2 - b.mdf * 2; a.hasWeapon(14) ? dam*=1.5 : dam

If you're not going to get into trying to read/use the meta tags, there's no reason to put one into your weapon's note field.

Hmm, for some reason it's still doing the same amount of damage. I turned the variance for both skills to 0, using a monster with no resists/weakness to both fire and thunder elements, and I tried both codes ( If I was supposed to replace anything with numbers or such then that might be what is wrong as I copy/pasted). Both skills have the same damage set up (200 + a.mat * 2 - b.mdf * 2), but despite having the weapon equipped, when doing the battle test, or the actual game test, it still shows both skills doing 254 damage.

And just to put it out there:

That's kind of opposite logic. The whole point of a plugin is someone else has done the coding, and all you have to do is set the plugin parameters or type some notetags or whatever the instructions say. What you're doing right now is actually more complex than if there were a plugin for it.

Oh....well, let it be known I'm not exactly a smart thinker haha. I can't quite explain how my brain works, but I'll probably be needing plug ins at some point so I'll look into it more when I do. Maybe it's because by doing the coding myself and learning how it works, I can grasp the concept and knowledge better and thus be able to do it on my own more often and gain the knowledge needed to do it without asking help for every little thing. Either way, I do understand where you're coming from and that may be a route I go down later.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,162
Reaction score
1,868
First Language
English
Primarily Uses
RMMV
Hmm, for some reason it's still doing the same amount of damage.
Ah - I was going off of the code you wrote in post 8, but that's incorrect syntax for hasWeapon. That takes an actual weapon entity, not the ID of a weapon.

So you'd do a.hasWeapon($dataWeapons[14])
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
VE - Element Set may just be easier...
While true, I did say I was waiting to try plug ins for now. I will keep note of this though for future reference.
Ah - I was going off of the code you wrote in post 8, but that's incorrect syntax for hasWeapon. That takes an actual weapon entity, not the ID of a weapon.

So you'd do a.hasWeapon($dataWeapons[14])
IT WORKED! Using the first code you gave me in the last reply, I added the dataWeapons part and it did more damage, just as intended. Is there a way to apply multiple weapons to this, or would that be better with a plug in?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,162
Reaction score
1,868
First Language
English
Primarily Uses
RMMV
Is there a way? Yes, you can do OR conditions with || in between them. It would be easier to do with a plugin.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
Ah okay. I will be sure to give this a try. For now though, I will say that this problem is solved. Thank you for all the help you guys!
 

Latest Threads

Latest Profile Posts

It's definitely discouraging when streamers give a try-to-say-it-nicely (i.e. bad) review of your game demo. It's like jumping into a cold pool. Bad initally, but it gets better with time. And you are now more alert and see better.
Some screenshots of the pub and lodging with the beginnings of clutter taking shape
TTp8uCw.png

jtC202e.png

bSXgyVl.png

eRx9PUF.png
Backgrounds are not my strong suit... :kaodes:
DazI8jt.jpg

Just realized I forgot doing the clouds... woops
Went to get some stuff for February 10, the birthday of my favorite ink monster...
I have a little one-person party for Bendy every year, complete with the life-size plushie I made. And yes, I bake a birthday cake!

Forum statistics

Threads
118,497
Messages
1,116,407
Members
155,489
Latest member
Desarr0
Top