What am I doing wrong?
I thought this would be the right command (sounds intuitive enough)
<JS Pre-Damage>
$gameTemp.reserveCommonEvent(9)
</JS Pre-Damage>
But when I test this skill, the common event is run AFTER the skill has damaged the enemy. Should I use another JS tag?
you RESERVE the common event a slot in the regular list of the execution.
that script command was never meant for immediate execution, and that is why it doesn't start the common event.
I know yanfly in MV had a specific notetag for starting common event, but I don't know how Visustella handled that.
I'm a bit lost.
So any command included between <JS Pre-Damage> and </JS Pre-Damage> including things such as variable changes is not actually performed "pre-damage" (before the damage)?
If so, is there a tag that would make this possible, so that the sequence of events happens before the damage is calculated? I'm using a variable in the damage calculation and I need to calculate its value before damage execution.
So is this the same for any command or just the "reserve common event" one?
For instance would:
<JS Pre-Damage>
$gameVariables.setValue(1, 0);
</JS Pre-Damage>
be run before damage or after?
it is only for the "reserve" type functions.
your example with the variables setvalue would be executed before the damage calculation.
and as said I know that yanfly wrote MV code to execute common events directly, without using the reserve slot function - but I don't know how visustella handled that.
Then I can't get the value of the variable to change before the damage calculation.
Is this the proper syntax?
<JS Pre-Damage>
$gameVariables.setValue(1, 0);
</JS Pre-Damage>
Then after that the variable is included in the damage formula using v[1].
Yup but it was to keep it simple here, the real code sets the value to 20000, sorry if I was unclear.
What happens is that the first use of that skill does 'normal' damage like 1000, and the second use of it a 20000+ damage, which means the tag was actually run after damage.
It's probably because you're using the variable in the damage formula and although pre-damage executes before the damage is applied, it doesn't actually recalculate the formula (which was evaluated before the notetag). You'd need to recalculate value.
Ah, I see.
Would there be a way to force a recalculation then?
value = yourformulahere
Or just change the variable in a <Pre-Apply> tag instead.
Just something like
Value = v[1]+a.atk-b.def;
?
Thanks. What do you mean by defences?
Variance can be simulated directly in the formula but would it still evaluate element resistance? (maybe that's what you mean by defences?)
Ah. That's technically a bit of a problem.
Might have to drop elements for that skill then (unless another solution is found).
I'm on phone now so I'll have to try it later. Thanks for the suggestion!
EDIT: Pre-Apply worked. Thank you!