Gargoyle77

Veteran
Veteran
Joined
Dec 4, 2017
Messages
81
Reaction score
11
First Language
English
Primarily Uses
RMMV
Hello, everyone. I tried reading the damage formula 101, but can't make what I have in mind work. Basically I want the formula to check if the target is affected by certain state. If so, then that state is removed, then the user vaina some mp and finally certain amount of dmg is applied. And if the target is not affected by that state, then normal dmg is applied. How can accomplish this? Thanks for reading !
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
83
Reaction score
98
First Language
English
Primarily Uses
RMMZ
Hello, everyone. I tried reading the damage formula 101, but can't make what I have in mind work. Basically I want the formula to check if the target is affected by certain state. If so, then that state is removed, then the user vaina some mp and finally certain amount of dmg is applied. And if the target is not affected by that state, then normal dmg is applied. How can accomplish this? Thanks for reading !

Hmm let's say.. your initial damage (for the skill in question) is 20

Code:
if (b.isStateAffected(stateId) === false) {
    20;
} else {
    b.removeState(stateId);
    a.gainMp(amount);
    20 * someMultiplierOfYourChoice;
};

Am I on the right track here?
Edit: corrected var misshap.
 
Last edited:

Gargoyle77

Veteran
Veteran
Joined
Dec 4, 2017
Messages
81
Reaction score
11
First Language
English
Primarily Uses
RMMV
Hmm let's say.. your initial damage (for the skill in question) is 20

Code:
if (b.isStateAffected(stateId) === false) {
    20;
} else {
    b.removeState(stateId);
    a.gainMp(amount);
    20 * someMultiplierOfYourChoice;
};

Am I on the right track here?
Edit: corrected var misshap.
Worked perfectly fine. Thanks a lot for your help
 

cubeking1

Villager
Member
Joined
Dec 19, 2013
Messages
13
Reaction score
1
First Language
english
Primarily Uses
ive been trying to make a skill that ramps its damage up with each use but the first use the skill is always zero what am i missing?

((a.atk+(a.luk/2))*(.8+(v[21]*.2)))*4-(b.def+(b.luk/2))*2
 

Zealvern

Villager
Member
Joined
Oct 30, 2020
Messages
18
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
I'm doing a thing, in a nutshell I want my healer to have an attack that hits an enemy and restores the most wounded ally's HP based on half the damage dealt, but it gives 0. Please be noted I have zero idea of JavaScript


var damage=a.atk-b.def; var group=$gameParty.aliveMembers(); group[group.reduce(((lowest, next, index) => group[next].hp < group[lowest].hp : index ? lowest), 0)].gainHp(damage/2); damage

Can this script be fixed or is there a better way to do it?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
650
Reaction score
264
First Language
English
Primarily Uses
RMMV
You seem to be overcomplicating your code; there's no need to care about the index of the most wounded member. I tried simplifying it and came up with this; let me know if it works. (Of course you need to remove the line breaks to use it in the damage box.)

JavaScript:
var damage=a.atk-b.def;
var group=$gameParty.aliveMembers();
var mostWounded = group.reduce((lowest, next) => next.hp < lowest.hp : next ? lowest)
mostWounded.gainHp(damage/2);
damage

Or with fewer variables:

JavaScript:
var damage=a.atk-b.def;
$gameParty.aliveMembers().reduce((lowest, next) => next.hp < lowest.hp : next ? lowest).gainHp(damage/2);
damage

(As to whether there's a better way to do it… probably, but it would require a plugin.)
 

Zealvern

Villager
Member
Joined
Oct 30, 2020
Messages
18
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
You seem to be overcomplicating your code; there's no need to care about the index of the most wounded member. I tried simplifying it and came up with this; let me know if it works. (Of course you need to remove the line breaks to use it in the damage box.)

JavaScript:
var damage=a.atk-b.def;
var group=$gameParty.aliveMembers();
var mostWounded = group.reduce((lowest, next) => next.hp < lowest.hp : next ? lowest)
mostWounded.gainHp(damage/2);
damage

Or with fewer variables:

JavaScript:
var damage=a.atk-b.def;
$gameParty.aliveMembers().reduce((lowest, next) => next.hp < lowest.hp : next ? lowest).gainHp(damage/2);
damage

(As to whether there's a better way to do it… probably, but it would require a plugin.)
Negative, it does zero. For your information, if it would require a plugin, I have the whole YEP pack
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
650
Reaction score
264
First Language
English
Primarily Uses
RMMV
Well, the way to debug what's wrong with the formula would be to past the key part into the developer console (which can be opened with either F8 or F12) and press enter:

JavaScript:
$gameParty.aliveMembers().reduce((lowest, next) => next.hp < lowest.hp : next ? lowest)

At a glance, I think the ? and : need to switch places.
 

Latest Threads

Latest Profile Posts

One tried and true way to trigger a lot of people to be nasty is to tell a truth that they are uncomfortable with, like how most people will stand by while they see a crime happening, unless it's illegal to stand by. We probably wouldn't have stories about "special heroes" or games about heroes if the "everyday common folk" were largely capable of being heroes. Heroes face dangers that most people are not willing to.
I'm having toooo much fun designing the new MP (Mental Psyche) system. I've only worked it out for enemies so far, but it's fun to stun them, then go after their MP and delete them instead to farm for better item drops.
anyone know of a place I can promote my game? sorta like game awards but for indie devs, like a place where I can drop a trailer and like stir up some hype
Doing RPG Maker News for 17th October 2021

That moment when you came up with a very good game title, but when you searched it, it has already been used... T.T

Forum statistics

Threads
115,875
Messages
1,093,674
Members
151,123
Latest member
Smitty
Top