- Joined
- Mar 6, 2020
- Messages
- 68
- Reaction score
- 12
- First Language
- English
- Primarily Uses
- RMMV
Do I put this formula on the damage formula box or the note tag?Code:let value = a.atk * 4 - b.def * 2; b.isStateAffected(4) ? value * 2 : value
Do I put this formula on the damage formula box or the note tag?Code:let value = a.atk * 4 - b.def * 2; b.isStateAffected(4) ? value * 2 : value
$gameVariables.value(5). To change the value of a variable, you need to write $gameVariables.setValue(5, newValue). Also by the way, you can access a variable in the damage formula using abbreviated syntax: v[5].var base = a.atk - b.def / (2 + b.level / 2);
var bonus = base * 0.035 * v[1];
base + bonus
Thanks for the reply. I use $gameVariables for my var 1 since if you were to use v[1] and use test battle and dont have the var defined in the fight it leads to undefined or 0. I was using v[#] for the formula but it wasn't working so i figured i would just try $gameVariables to just see if it would do anything. When it didn't i just copied it and pasted it here looking for help. To start out i was actually trying to use just x and y, I'm very new to using variables in damage formulas so i don't really know what works or not, and don't know anyting on javascript variables either.You can't assign to$gameVariables.value(5). To change the value of a variable, you need to write$gameVariables.setValue(5, newValue). Also by the way, you can access a variable in the damage formula using abbreviated syntax:v[5].
Now, there's one other weird thing about your formula. Why are you using $gameVariables 5 and 6 at all? Do you need these numbers somewhere else outside of the damage formula? If you don't, then you should just use JavaScript variables - it'll make for a much shorter and readable formula.
Take out the line breaks obviously, but I think that should do the same as what the code you posted looked like it meant to do.JavaScript:var base = a.atk - b.def / (2 + b.level / 2); var bonus = base * 0.035 * v[1]; base + bonus
Ahh, that's true. Well, the code I posted doesn't depend on v[1] vs $gameVariables.value(1), so you can use whichever you prefer.I use $gameVariables for my var 1 since if you were to use v[1] and use test battle and dont have the var defined in the fight it leads to undefined or 0.
Put a console.log("enemy killed") or something statement in place of the b.die() statement to make sure the code is even being reached. If you use the skill and don't see "enemy killed" in the debug console after using the skill on an enemy it should work against, then you're somehow determining enemy levels wrong.I posted this here for 2 reasons:
1. Both RMMV & RMMZ use javascript, so I thought it would be okay to post here.
2. I didnt see a section for damage formulas for MZ, so I thought that meant that both makers use the same types of damage formulas.
Anyway, that aside, thanks for your help. I already did try b.die() instead of b.setHp(0), but sadly, it didnt work.
a.level > b.level ? b.hp : 0
Nope, it still didnt work.
I had already disabled VisuStella's style formulas or w/e theyre called, so Im pretty sure that isnt whats causing the problem.
I tried
a.level > b.level ? console.log("enemy killed")
but nothing appeared. I turned off VisuStella's Battle Core plugin just in case(This is the plugin that adds the style formulas) but still nothing. I also turned off every plugin except for the Core Engine plugin, still nothing. Finally, I disabled every plugin I had to see if that would do something, but once again, there was nothing new, not even an error message to tell me that my formula was wrong.
If Im doing something wrong, I really dont know what it is. My test enemy has a
<Level: 3>
notetag in its notebox and my actor 1 is level 5. I even gave him a
<Initial Level: 5>
notetag to see if that would do something, but nope, nothing.
I know the above didnt work, but I still wanted to try the formula that you wrote just in case something would happen, but nothing. I did like you recommended and I set the variance to 0%. Dunno if this helps, but I also set the element to "none", the critical hits to "no" and the hit type to "certain hit".
Yeah I just downloaded their demo, added levels to the goblin and tried it out and it's definitely the engine not recognizing the plugin. I did a simple damage formula of a.level and it worked. But b.level / b.lv / b.lvl / b.Level all don't work.So youre saying that its a problem with the engine and/or the plugins?