MZ FF Dia inspired spell

Hello,

I'm currently working on a custom skill for my game that heals allies but deals damage to targets with the Undead state.

I don't know how to write JS and I've tried for hours piecing things from forums and chatgpt.

This is what I've been able to come up with so far -

diaspell.png


The skill plays this Common Event which checks if state 603 is active, but then this is where it becomes a mess...

From my observation it's still failing to target correctly before anything else is applied.

Any assistance would greatly be appreciated.
why common event as user.atk can be invalid.

YEP has plugin and actionsec to place that inside the skill notetag.
for actorId 1 or just the actor that uses the skill (if you want different
effect per actor, you can define it there).

what your condition does is weird, what does that even mean?
not to mention, the else handler?!

that one makes no sense at all and DO NOT USE "ChatGPT"!
why common event as user.atk can be invalid.

YEP has plugin and actionsec to place that inside the skill notetag.
for actorId 1 or just the actor that uses the skill (if you want different
effect per actor, you can define it there).

what your condition does is weird, what does that even mean?
not to mention, the else handler?!

that one makes no sense at all and DO NOT USE "ChatGPT"!

I'll explain as someone who doesn't understand JS.

It's a if statement that checks if the target has an active state, if so it applies the damage formula, else it applies the healing formula.
I know JS, but instead of YEP, it needs VisuStella plugins as you
use MZ (so my bad there).

adding formula for skills, you can probably add it directly inside the
damage formula when execute the skill, so no common event.

as you reading again this is what you want.

Skill heals your allies (but possible enemies without the undead state)
deals damage to enemies with the undead states?

because if you don't want to heal enemies that aren't undead, you need
to take this into account as well.
Exactly!

The end product is going to be a spell that deals holy-element damage, but I've also included the <Target: Ally or Enemy> notetag to allow me to select any single unit on the battlefield, the only missing component is the logic for the skill to determine if the target is undead or not then apply a separate damage formula if so.
place this inside the skill formula attack and see if it works
JavaScript:
target.isStateAffected(603) ? user.atk * 4 - target.def * 2 : target.hp + (200 + a.mat)
I cannot test it as I don't own MZ, but it might do the trick.
I cannot test it as I don't own MZ, but it might do the trick.
you might have to use a <JS Pre-Damage> to set the damage after its calculated. iirc if a skill is set to heal, any negative result for the damage formula evaluation is going to be replaced with 0.
place this inside the skill formula attack and see if it works
JavaScript:
target.isStateAffected(603) ? user.atk * 4 - target.def * 2 : target.hp + (200 + a.mat)
I cannot test it as I don't own MZ, but it might do the trick.
After testing, looks like it does about ~2277 damage to an enemy target with state 603, but is also doing damage to allies.

Is this what's causing the issue?

this.png
it might be, but as it deals HP damage like you want to the target
that has that state.

but like Robro33 said, if you have Visustella plugins, you need to use
the notetag field with <JS Pre-Damage> an probably others, but I cannot
help you on that part.
You want a holy skill that heals the living and damages undead, do I understand this righ?

I'm not sure if this works out of the box, but can you give the undead staye a negative value for holy damage? This means holy damage now heals them, and holy healing would damage them.

Assuming undead is a state and holy is an element.

I have no idea if this works without a plugin, and I'm in the bus so I can't try it out myself. (Idk if rog maker allowed negative sensitivity to elements, like -100%)
You want a holy skill that heals the living and damages undead, do I understand this righ?

I'm not sure if this works out of the box, but can you give the undead staye a negative value for holy damage? This means holy damage now heals them, and holy healing would damage them.

Assuming undead is a state and holy is an element.

I have no idea if this works without a plugin, and I'm in the bus so I can't try it out myself. (Idk if rog maker allowed negative sensitivity to elements, like -100%)
It appears I can only set the values for element rates between 0-999%, can't do negative unfortunately.
Still stuck on this.

It's looking more like I'll need to figure out the correct notetag setup and custom action sequence for Visustella to get this to properly work.
Still stuck on this.
you might have to use a <JS Pre-Damage> to set the damage after its calculated
you shouldnt need an action sequence. the battle core notetag i mentioned should be enough.
Code:
<JS Pre-Damage>
if (target.isStateAffected(603))
  value = 200 + user.mat*2
</JS Pre-Damage>
if the target doesnt have the state, the notetag does nothing and the skill functions as normal. if they do have it, they take damage equal to the formula you mentioned before.

It appears I can only set the values for element rates between 0-999%, can't do negative unfortunately.
as you saw, the editor doesnt let you do that, but even if you used a plugin like visustellas element core to make a battlers rate for that element negative there may be another issue. a similar one to the one i mentioned.
iirc if a skill is set to heal, any negative result for the damage formula evaluation is going to be replaced with 0.
if its written the same as yanfly's, then damage taken from a skill that the battler has a negative rate to will never cause damage. an heal inverted by the element rate formula will just result in 0 damage
you shouldnt need an action sequence. the battle core notetag i mentioned should be enough.
Code:
<JS Pre-Damage>
if (target.isStateAffected(603))
  value = 200 + user.mat*2
</JS Pre-Damage>
if the target doesnt have the state, the notetag does nothing and the skill functions as normal. if they do have it, they take damage equal to the formula you mentioned before.


as you saw, the editor doesnt let you do that, but even if you used a plugin like visustellas element core to make a battlers rate for that element negative there may be another issue. a similar one to the one i mentioned.

if its written the same as yanfly's, then damage taken from a skill that the battler has a negative rate to will never cause damage. an heal inverted by the element rate formula will just result in 0 damage

After plugging things in it looks like the spell is only healing.

Here are some pics to see what I have wrong -

This is the notetag on the enemy target:
enemy.png


And this is the notetag in the skill:
skill.png
After plugging things in it looks like the spell is only healing.
just making sure. did you save the project since then? plugin and notebox changes arent saved until then.
just making sure. did you save the project since then? plugin and notebox changes arent saved until then.
yep always do
oh. should have asked this one first. is it healing the amount that would have been caused by the damage formula, or is it healing the amount that would have caused by the healing one?

i can never remember when healing is supposed to be negative or not. try making the number negative
oh. should have asked this one first. is it healing the amount that would have been caused by the damage formula, or is it healing the amount that would have caused by the healing one?

i can never remember when healing is supposed to be negative or not. try making the number negative

Switched the damage formula to this and still getting positive number healing on enemy target.

update.png
just tried it in the visustella test project. damage in that notetag is positive, even then the skill is an hp recovery skill. the first notetag i gave you should have worked. it works just fine on my end.

youre not testing on an old save, right? youre either using "New Game" or are using a battle test?
is state 603 a passive state? the code needed to check those in VS is different.

Spoiler: screenshots
1741097256554.png

1741097291301.png

1741097317665.png
just tried it in the visustella test project. damage in that notetag is positive, even then the skill is an hp recovery skill. the first notetag i gave you should have worked. it works just fine on my end.

youre not testing on an old save, right? youre either using "New Game" or are using a battle test?
is state 603 a passive state? the code needed to check those in VS are different.

Yes, I'm using passive states for the undead enemies that will be vulnerable to this spell.

Original thread: https://forums.rpgmakerweb.com/threads/ff-dia-inspired-spell.175942/