A team of unlikely heroes has come together to fight evil. Conveniently, each hero fill a different role in the party’s needs. Nick the Ninja is great at taking down individual enemies, marking them with a curse and then dealing terrible damage.
Double-post today! The Hunter’s Mark ability has existed in some permutation for generations of games, in various different forms. It involves sacrificing a turn, or time, or MP, or something else to reduce an enemy’s defenses. Sometimes this works only for the marker, sometimes for all of the marker’s friends.
Reddit user PieHardLoL wanted his assassin to mark an enemy and deal more damage to that enemy. He wanted this to work for all of the assassin’s skills, but not for anyone else in the party. So let’s do it!
We’ll first need to create a state. I named mine “Marked.” Handle the removal timing as you see fit, and give a clever message for when an enemy is marked (“(target name) is Marked for Death!” Don’t include any features at all – this state is just a placeholder for us to check for. Make a note of the state ID – the number next to the state in your database.
We’ll also need to know our ninja’s (we’ll call him Nick) Actor ID. You can get that from the Actor page.
Nick needs to know the skill Mark for Death, so he can apply the state, so go ahead and make that as well. Make sure Nick knows it!
The bulk of our work happens in the skills menu, specifically in the “Formula” bar. That bar determines the damage dealt by an attack, and uses two letters – a and b – to signify the attacker and target, respectively. So the default attack formula, “a.atk * 4 – b.def * 2”, means that the attack will deal attacker’s attack stat * 2, minus target’s defense stat * 2.
We can do so much more with this bar. We can include if/then statements, ternary operators, and much more. We’re going to be using a ternary operator for this, which looks a little something like:
x > y ? 1 : 2
This may just be a bunch of symbols, let’s break it down. Before the question mark we’re asking, well, a question. You can read x > y ? as “is x greater than y?” After the question mark are the results for yes and no. So, is x greater than y? If yes, the result is “1”; if no, the result is “2”. Simple!
So now we know, we can ask a question in the damage formula box, and we can produce two different results depending. Splendid! So let’s take a look at an attack I just made for Nick, “Ninja Attack.” No one else will be able to use it except Nick. It attacks twice, but as with all of Nick’s attacks, we want it to do more damage if the target is marked. So the damage side of our equation might look something like
a.atk*8 – b.def*3 : a.atk*4 – b.def*2
That is, if our question is answered “yes”, do a lot more damage; if it’s answered “no”, do standard damage.
But what’s our question? Whether the enemy has the Mark state! My Mark state id is “25”, so I would write:
b.state?(25) ? (a.atk*8 – b.def*3) : (a.atk*4 – b.def*2)
b.state? asks if the target has a state (as you guessed, a.state? asks if the attacker has one). I put our attack values in parens for easier reading. So now we’ve got our Ninja Attack!
But wait! We want Nick’s regular Attack to do more damage to marked targets as well. But he shares the regular attack skill with everyone else. So we need to ask a better question – does target have the marked state, and is the attacker Nick? Remember when I said to note Nick’s actor ID? We need it here:
a.id == 4
That asks if the attacker’s actor id is 4. So now, our basic attack skill looks like this:
Voila, Nick’s Marked for Death now works for his attack and his special skill, Ninja Attack. Don’t forget, the ternary needs to be in every damage formula that Nick has access to for this to work.
Marcy Mage has a slightly different mark she applies. Any damage the enemy takes by any of Marcy’s friends (or Marcy herself) will be measured against that enemy’s magic defense – even physical damage. How do we do that in the formula bar?
Marcy Mage just leveled up her mark. Now, any damage the enemy takes is does fire damage, such that it considers the target’s fire resistance or weakness (great against those stupid ice imps). How do we do that in the formula bar?
Check back in a few weeks for the solutions!