Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,037
Reaction score
4,648
First Language
English
Primarily Uses
RMMZ
Thank you. I am trying it out right now and so far it is working splendidly ^v^
Do note that 0 is one of the possible values of randomInt and the number you use for the argument isn't included, so if you wanted this to be 1-6 rather than 0-5 you'll have to add 1 to it.
 

FirestormNeos

Veteran
Veteran
Joined
Jul 23, 2019
Messages
260
Reaction score
236
First Language
English
Primarily Uses
RMMV
How do I make an attack that consumes all TP the character currently has, then deals more damage based on how much TP was consumed? Specifically, without using Common Events or Yanfly plugins.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,943
Reaction score
3,139
First Language
English
Primarily Uses
RMMV
How do I make an attack that consumes all TP the character currently has, then deals more damage based on how much TP was consumed? Specifically, without using Common Events or Yanfly plugins.
There's no need for plugins here, but you may find this thread more useful:

You'd do:
Code:
var tpDam=a.tp; a.setTp(0); damage formula that incorporates the variable tpDam

The only part of this that could be improved by use of a plugin is the fact that when selecting the skill, it will only show it costing the amount of TP that you define in the database (you should at minimum make that 1).

Using Yanfly's Skill Core, you'd be able to make that display dynamically, so the player will see that the cost of the skill is equal to however much TP that actor currently has.
 

FirestormNeos

Veteran
Veteran
Joined
Jul 23, 2019
Messages
260
Reaction score
236
First Language
English
Primarily Uses
RMMV
There's no need for plugins here, but you may find this thread more useful:

You'd do:
Code:
var tpDam=a.tp; a.setTp(0); damage formula that incorporates the variable tpDam

The only part of this that could be improved by use of a plugin is the fact that when selecting the skill, it will only show it costing the amount of TP that you define in the database (you should at minimum make that 1).
tysfm! works perfectly!
 

HM_Misfit

Villager
Member
Joined
May 14, 2022
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hey guys I'm new to this whole RPG Maker scene. I've spent a good chunk of time on it this week but, it really is a lot to learn. Can someone help me create a damage formula that will do around 13-14k damage at level 99? Just basic attacks. From there I can edit how I want my skills and spells. I do have Yanfly's plugin to change around the parameters. I'm just not the greatest with formulas in general. Any help is appreciated. Cheers!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,943
Reaction score
3,139
First Language
English
Primarily Uses
RMMV
Can someone help me create a damage formula that will do around 13-14k damage at level 99?
The answer to that question is no :stickytongue:

Based on your post, we have no idea what the rest of your game is like. Level doesn't have anything to do with it, unless you make it.

If you just want to do 14k damage at level 99 you divide 14,000 / 99 and make your damage formula a.level*141 :smile:

But are you actually using the other parameters? How high do they go? Do you want defense to decrease the damage dealt? How high does that go? No one can tell you all of this for your game.

To just approach this, you're talking super basic math.

If you have 100 ATK at level 99, and you want to do 14k damage, then divide 14,000 / 100 and your damage formula is a.atk*140 right?

If you have 9,999 ATK and you want to do 14k damage, then divide 14,000 / 9,999 and your damage formula is a.atk*1.4

If you read other posts in this thread, the things that can make damage formulae complex are things like what's the least damage you should do, and how does it scale against different values of defense and across your levels and stuff like that. Just saying "I want to do this much damage at this point" is very simple math.

You should take some of the other formulae posted here (or even better, in here) and see how much damage they do in your game with your numbers. If you want it to do more, modify the formula with higher values.
 

HM_Misfit

Villager
Member
Joined
May 14, 2022
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
To just approach this, you're talking super basic math.

If you have 100 ATK at level 99, and you want to do 14k damage, then divide 14,000 / 100 and your damage formula is a.atk*140 right?

If you have 9,999 ATK and you want to do 14k damage, then divide 14,000 / 9,999 and your damage formula is a.atk*1.4
Hey this helped a ton. I didn't know it was so simple. I must have just been over thinking things when trying to create a formula.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,289
Reaction score
15,405
First Language
English
Primarily Uses
RMVXA
So I want to make a skill that if the enemies level is < the caster's level, it instantly KO's them. What would be the best way to do that in the damage formula box?
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
765
Reaction score
1,157
First Language
German
Primarily Uses
RMMV
@bgillisp
I assume you are using a "enemy levels" plugin?
Asking because enemies don't have a level parameter by default.

Depending on how the plugin works, it would most likely be something like

b.level < a.level ? b.mhp : 0

Then again, if the plugin does not add the level parameter, you have to replace b.level with whatever is determining how high the enemies' level is, which could be a variable if you are going for no plugins.
 
Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,289
Reaction score
15,405
First Language
English
Primarily Uses
RMVXA
In MZ level is part of the default engine parameters and works there, so I assume its in just fine. Though I guess I did just post in MV derp. Still the idea there is what I needed, thanks.
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
765
Reaction score
1,157
First Language
German
Primarily Uses
RMMV
@bgillisp
Fair enough, I just assumed this was for MV since this thread was originally aimed at MV, hence the name. Though I guess it mostly works for MZ just fine aswell.

Except on this specific occasion, where there is a difference in how enemy levels are handled.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,289
Reaction score
15,405
First Language
English
Primarily Uses
RMVXA
Its ok. I was stuck on the or snytax and evaluation which seems to be the same in MZ as MV.
 

Oggy

Villager
Member
Joined
Jun 1, 2022
Messages
24
Reaction score
12
First Language
English
Primarily Uses
RMMZ
Im trying to add the equipped weapon ATK parameter to my damage formula but I'm having trouble setting up the call. Something to this effect:

$game.Actors.actor.equips()[0]params[2] + (1.75*a.atk)-def

This doesn't seem to be working though. Any help would be much appreciated.
Im using MZ
 
Last edited:

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,224
First Language
English
Primarily Uses
RMMV
$game.Actors.actor.equips()[0]params[2] + (1.75*a.atk)-def
You're missing a "." in there. It should be $game.Actors.actor.equips()[0].params[2]
 

fladdles

Villager
Member
Joined
Jul 20, 2017
Messages
9
Reaction score
2
First Language
english
Primarily Uses
RMMV
What a perfect thread, I was about to make a new thread just for this question heh.
In my game I'm implemented a very basic wounds system and need Bandages to stop Bleeding and a Stint to mend Broken Bones. Only issue is I can apply both items whenever I want - I need them to only be able to apply if certain a state is active on an actor. And I can't figure it out, but I've seen it done before with If/Else statements in an item's formula box regarding Vampire Potions and a If/Else that checks if a Vampire state is applied to the actor so I imagine this is exactly the same.

For bandages, I need the item to check if the Bleeding state is applied and then remove it. If Bleeding is not applied, cancel the item (bandage) usage somehow (Either by consuming the item and giving it back or otherwise).

Splints are a bit more complex. I need a Splint to check if Broken Bones is applied and remove the Broken Bones state but THEN add a new state called Splinted. Likewise, if Broken Bones is not applied, do nothing and keep the Splint (whether thats by a consume/replace or not).

If anyone could figure this out with the fancy programming language of the formula box I'd be overjoyed
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,943
Reaction score
3,139
First Language
English
Primarily Uses
RMMV
Only issue is I can apply both items whenever I want - I need them to only be able to apply if certain a state is active on an actor.
You can't do that within the Damage Formula. The Formula takes place after the item/skill has started to perform its action, which is way after the target selection.

The other thing for you to keep in mind (perhaps you don't understand in the first place) is that the damage formula is always used when you're damaging/healing the target in some way; it requires that a number get produced, and it will show that number. So even if it's 0, doing things like this is going to end up with the player using your item in the game and that 0 damage or healing popup displaying on the screen, which I would consider aesthetically undesirable.

For Bandages, what you describe should actually be the default way the engine works - if you have an item and the only thing on it is a Trait that removes your Bleeding state (no unnecessary Damage Formula at all), the game should not allow you to expend that item on a target who doesn't have the state to be removed.

If you have both that Trait and one that restores HP, then you'll be allowed to use the item if either trait would result in a change to the target actor. So the easiest way to implement what you want is to make a simple item, one trait to remove the state, and that's already how the engine works.
Splints are a bit more complex. I need a Splint to check if Broken Bones is applied and remove the Broken Bones state but THEN add a new state called Splinted. Likewise, if Broken Bones is not applied, do nothing and keep the Splint (whether thats by a consume/replace or not).
This could be done in the damage formula - the trick is, it'll "break" your item. That is, as I described above, you can't stop the player from using the item on an actor who doesn't have Broken Bones. You can use code to restore the item after, so it nets out, but it will behave differently from all of the rest of your items that sit there and give an error sound on an invalid target.

If you don't care about any of that, then you can do:
Code:
if (b.isStateAffected(brokenBones)) {b.removeState(brokenBones); b.addState(splinted)} else $gameParty.gainItem(itemId, 1); 0
where brokenBones, splinted, and itemId are replaced by the appropriate database IDs (no leading 0s).

You may find this a more useful thread that has instructions on how to do exotic things in your damage formulae:
 

fladdles

Villager
Member
Joined
Jul 20, 2017
Messages
9
Reaction score
2
First Language
english
Primarily Uses
RMMV
The whole point of the Stint was to remove Broken Bones but then apply a 'Limping'-like state for 100 steps as the mended bones healed on their own while splinted. This was to avoid an 'instant' heal of broken bones, but it looks like I could just default back to that lol

Thanks man, you explained it super well! Now, got me thinking: is there a way to store which actor an item was used on in a variable? I could use common events to apply states to actors that were 'Stinted'.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,943
Reaction score
3,139
First Language
English
Primarily Uses
RMMV
Now, got me thinking: is there a way to store which actor an item was used on in a variable? I could use common events to apply states to actors that were 'Stinted'.
Actually, there's a thing you could try which didn't occur to me in my original post. It might not work, but it's free to try.

Grab Yanfly's Skill Core plugin and put in the notes of your Splint:
Code:
<After Eval>
target.addState(splinted);
</After Eval>

I haven't tested whether those notetags work when you're using the item from the menu.
 

Latest Threads

Latest Profile Posts

I just got all of my wisdom teeth out today, thankfully I have the rest of the week off.
Man I am learning I am bad at naming armor lmao.
The game's opening, now fully polished! :LZScheeze:





Aaand, here's me working on it in today's "Game Making Every Day" video! :LZSooo:

Hello! Can anyone help me? I followed making cooking tutorial for RPG Maker MV. But for some reason buff state that food gives doesn't work in overworld. It disappears. What am I supposed to do?
A shotgun is not a rifle. Huh.

Forum statistics

Threads
124,406
Messages
1,163,387
Members
163,203
Latest member
Mwenye
Top