Hi all. I would like to create skills that deal more damage when the targets have been afflicted with a status, for instance, an attack that doubles in damage if the target is burning. I would also like to have skills that deal more damage when the player is afflicted by a status, such as being in stealth. I figure there would be some kind of 'If' statement involved within the formula, but i'm not really sure how to write it. My previous experiences with coding are in Twine, where you'd just write something like (if: _enemyisburning is 1)[blah blah] (else:)[blah]. Anyway, any help would be appreciated.
Dealing more damage to targets with a status effect in play
Answers
A formula could be something like t.status.includes(status => status.id === 1) ? u.atk * 2 : u.atk
Replace 1 by the ID of the status. Not tested but I guess it works?
@wano Hi, thanks for your response! I was wondering if you could break down what the formula means, so I can understand and use it better? I know that t = target,and u would be the user, and the user's attack. I just want to understand the rest of it. Sorry for being a pain
Sure! The syntax is myCondition ? thenResult : elseResult. The complete code means : IF target status list includes the status id 1, THEN return user atk value multiple by 2, ELSE return user atk value.
@wano Hi! I finally had a chance to try out this code, but it appears only to make a skill that attacks when the status is in effect, and only does the 'else' part of the equation. Is there something I am missing? the only thing I changed was the ID of the staus
Please share screenshot of the effects. If I understand correctly you want a skill that first has a chance to inflict a status (burning), and after that it deals damage that is double if burning?
@wano I've attached a screenshot of the skill 'test' as it currently looks (
) I tried adding an additional 'damage to hp' line, but that didn't change the result. I would like to create skills that deal extra damage when there is already a status (like burning) on the target, but will still damage the target if there is no status. Currently, it only deals regular attack to a target if they are (burning), and does no attack at all if they aren't. I wouldn't be surprised if I've just missed something out though as the first few times I tested this out, I forgot to set the target, and to make it available in battle >_<
I did have it set up differently, with this code in the formula box, not script, but that resulted in a crash.
It should be a formula in damage part, not "Script". What is the ecrash error?
@wano this is what came up
Oooh... what about t.status?.includes?.(status => status.id === 1) ? u.atk * 2 : u.atk
@wano that did fix the crashing, but unfortunately does not result in doing extra damage when the status is in play. (attaching skill's effect in case it's a user error)
Sorry my bad I was probably a bit tired when writting it, the whole time I used "includes" function but it's not this one.... Try t.status?.some?.(status => status.id === 3) ? u.atk * 2 : u.atk
@wano Ah that works! Thanks so much :)