ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
Edit: removed because I found a more active thread to ask the same question, as this one appears to have been dead a while
Just as a suggestion, there's not much reason to do that. Recent/unread posts show up in the same lists on the site. So unless there's someone who's only working off of notifications from threads they've Followed, we're going to see your post regardless of which specific damage formula thread it's in :wink:
 

emelian65

Regular
Regular
Joined
Sep 13, 2015
Messages
224
Reaction score
68
First Language
Spanish
Primarily Uses
RMMV
Theorically, making a check for more than one condition would work with && on it right?

For example:


JavaScript:
a.mp && a.tp >= 35 ? 75 : 40;

Could this work if I need the skill to deal extra damage as long as MP and TP are above 35? Or should I need to do something else?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
Theorically, making a check for more than one condition would work with && on it right?
No, that's not correct JavaScript syntax. Each side of the boolean operator must be a complete comparison. See:

So you'd do a.mp>=35 && a.tp>=35
 

Fonixed

Regular
Regular
Joined
Mar 24, 2023
Messages
31
Reaction score
13
First Language
Eglish
Primarily Uses
RMMV
I'm not receiving any battle damage with this formula I'm not sure why.
Can this be done or do I need to make two different damage formulas with the same name?
JavaScript:
if (a.actorId() === 1) { (v[1] + a.atk * 4 - b.def * 2); } else { (a.atk * 4 - b.def * 2); }
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,960
First Language
English
Primarily Uses
RMMV
@Fonixed, try == instead of ===. What's in variable 1?
 

Fonixed

Regular
Regular
Joined
Mar 24, 2023
Messages
31
Reaction score
13
First Language
Eglish
Primarily Uses
RMMV
@Fonixed, try == instead of ===. What's in variable 1?

I've given Variable 1 the value of 25, it's just a random value that I'm using to see if I can get it working.

Also == and === have the same effect in this case. I can deal damage but not receive any.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
Also == and === have the same effect in this case.
With RPG Maker they always will. Unless you manually set a variable to something weird, they will always be numbers and not need to be a strict comparison.

I can deal damage but not receive any.
Because enemies don't have an actorId() field. When an enemy uses the skill, calling actorId() is undefined and zeros out the entire formula.
 

kn1000a

Golden Vampire
Regular
Joined
Dec 21, 2017
Messages
74
Reaction score
5
First Language
English
Primarily Uses
RMMZ
How much of these can be applied on VXA? I know MV uses javascript but idk how much I can reference, I could not find a comprehensive "Damage Formula 101" for VXA (Forma wrote one but it was not as in depth with each functionality)

Are these functions here like currentExp() the same in VXA? Would've be so nice if VXA let me uses as much as what is documented here.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
Are these functions here like currentExp() the same in VXA? Would've be so nice if VXA let me uses as much as what is documented here.
No, VX uses Ruby for scripting while MV/Z are coded in JavaScript - two completely different languages.

You can look up the VXAce script call list for functions to use in that engine.
 
Joined
Apr 1, 2022
Messages
2
Reaction score
1
First Language
french
Primarily Uses
RMMV
Hey, I'd like to make a damage formula that allows me to hit an enemy and at the same time give back a fixed number (for example) 7 of mana and TP to my allies and myself. Is it possible to do this?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
Hey, I'd like to make a damage formula that allows me to hit an enemy and at the same time give back a fixed number (for example) 7 of mana and TP to my allies and myself. Is it possible to do this?
Yes, but it's generally not best practice to put that in the damage formula.

The first post of this thread lists the functions for gaining MP and TP. You can use the forEach() method to do it to everyone. For example:
Code:
a.friendsUnit().forEach(battler => battler.gainMp(7)); damage formula

However, if you give that skill to enemies or you ever use the auto battle trait, it can produce unexpected results. So it's better to use something like Yanfly's Skill Core to execute code like that only when a skill is actually used.
 

Zakarijazh

I love making maps!
Regular
Joined
Aug 18, 2019
Messages
246
Reaction score
50
First Language
English
Primarily Uses
RMMV
So i thought I could make a formula that drained 35% of a target's TP and restored it to the user but I feel like I'm missing something?

a.setTp(a.Tp * .65); user.setTp(user.Tp + (a.Tp * .65)
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
So i thought I could make a formula that drained 35% of a target's TP and restored it to the user but I feel like I'm missing something?

a.setTp(a.Tp * .65); user.setTp(user.Tp + (a.Tp * .65)
There are a few things wrong with this.

1 - There's no such property as "Tp". It's "a.tp" or "b.tp," etc.

2 - As described in the first post of this thread, the last thing in your formula must always be the value being used for damage. The setTp function does not return a value, so you're going to be getting undefined from all of that.

3 - There's no such thing as user in the damage formula - I'm not sure where you're getting that from. You might be confused with the documentation for plugin notetags, but the damage formula only has a and b.

4 - Your syntax is incorrect. The second statement (after the semicolon) has two open parentheses and one close.

If this skill is not supposed to do any HP or MP damage to the target at all, you probably don't want to use the damage formula for this. You must have a value if you do, which means if nothing else you'll see a 0 damage popup every time you use the skill. If that's the case, you'd be better off using something like Yanfly's Skill Core and putting the code into an After Eval notetag or something like that.
 

Zakarijazh

I love making maps!
Regular
Joined
Aug 18, 2019
Messages
246
Reaction score
50
First Language
English
Primarily Uses
RMMV
There are a few things wrong with this.

1 - There's no such property as "Tp". It's "a.tp" or "b.tp," etc.

2 - As described in the first post of this thread, the last thing in your formula must always be the value being used for damage. The setTp function does not return a value, so you're going to be getting undefined from all of that.

3 - There's no such thing as user in the damage formula - I'm not sure where you're getting that from. You might be confused with the documentation for plugin notetags, but the damage formula only has a and b.

4 - Your syntax is incorrect. The second statement (after the semicolon) has two open parentheses and one close.

If this skill is not supposed to do any HP or MP damage to the target at all, you probably don't want to use the damage formula for this. You must have a value if you do, which means if nothing else you'll see a 0 damage popup every time you use the skill. If that's the case, you'd be better off using something like Yanfly's Skill Core and putting the code into an After Eval notetag or something like that.
okay, thanks. I'll try to do something with the skill core. I did some other stuff but I'm not good as coding at all, so it's... a process. lol
 

Disponi

Villager
Member
Joined
May 2, 2015
Messages
21
Reaction score
3
First Language
English
Primarily Uses
I want to make an item that has double strength in battle. How would I go about checking to make sure I'm in the Battle Scene?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
I want to make an item that has double strength in battle. How would I go about checking to make sure I'm in the Battle Scene?
Code:
SceneManager._scene instanceof Scene_Battle ? original formula : stronger formula
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,158
Reaction score
9,109
First Language
English
Primarily Uses
RMMV
@Disponi Oops, sorry, yeah, quickly typed that backward :stickytongue:
 

mahadeva

Villager
Member
Joined
May 18, 2021
Messages
27
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm not so good in formulas. Could you please explain me one thing. Is it possible to create formula that will change damage to heal or heal to damage depending on state or something like that? I'll be very grateful.

Right now I'm trying to create a classes that normally heal characters but damage undead enemies with the same skills. I already know about Silv Undead plugin but I'm also using FROG Health which demands special fomulas written in the plugin options. In other case it's bugging the game. Silv's Undead works only with straight formulas like a.atk and so on.

Found what I need in the another thread. Won't bother. Will just create damaging skills for my healers.
 
Last edited:

Latest Threads

Latest Profile Posts

I'm just gonna remove the Dark Spells from my game. They wouldn't be fighting Gods or Angels. So why have it?
Every day I'm getting rough-outs of another sprite sheet or two. Getting real close to just needing to make new original stuff and editing my tables and chairs to look correct for the taller sprites is among the top of the revisions list.
Eye_Guys.gif
Some eyew guys! One is absent for... reasons of taste
Eeee! X3 Ever since I started doing 3d Art ,my Pixel Art got sooo much better! I cant wait till im done with the tileset!
Crystal Shock Devlog #5 yay!



This week was super fun as I got to work on my favorite thing: Combat! A new boss has been added and some new mechanics on top of that. I also made some improvements to the first town.

Forum statistics

Threads
134,916
Messages
1,251,899
Members
177,754
Latest member
thelankystank
Top