Hi everyone, haven't been here in a while. Got back to making my game after a pretty long hiatus :<
Anyways!
I'm trying to make a boss that uses the following combo:
1 - The boss uses a powerful single-target move. If it inflicts Death, then a Variable is increased.
2 - The boss uses a multi-target attack. It deals damage based on the formula, which would be a.atk * (3 + (2 * $game_variables[1])) - b.def * 2, And then a Common event sets the variable to 0.
What I'm having trouble with is writing the formula for the first move. How would I check if the move succesfully applies a state, and how would I up a variable by one incase the state application is true?
I've done this for characters rather than bosses, but I think the implementation is the same. There are several ways to do this but I'll stick with the one that requires the least scripting:
In the single-target skill's damage formula, set another variable equal to the current "number of alive members" of the party - $game_party.alive_members.size - before proceeding with the damage formula (if you don't know the syntax for this, check out tutorials on damage formula; they are linked all over the place). Have the skill run a Common Event, where now that the attack has been completed, you subtract the current "number of alive members" of the party from that variable, and if the result is greater than 0, you increase the "Kills inflicted with this skill" variable by 1.
Note that if you ever make the skill a multi-target skill, it gets a bit more complicated - you would need to only set the variable on the first target by checking to see whether the "alive members" variable is currently 0, and then reset that variable to 0 at the end of the Common Event. But since it's a single-target skill for you, you can stick with the above.
I'm really unsure how to work with this.. How would I be able to get a variable equal to the current amount of live party members? How do I get it set up in a common event? Is the $game_party.alive_members.size a variable i have to declare aswell, or is it purely in the formula? I've tried some different syntaxes on my single target skill according to guides but i only get nulls instead of damage.
I'm going to need an ELI5 for all this ;-;
Bumpity bump. Still stuck figuring this out.
Well, actually what Wavelength said is correct and you don't need to use game variables at all to store the value of alive party members, you only need it to store the number of times the skill has been used. You can just do it like this:
r=$game_party.alive_members.size; b.add_state(1); r-$game_party.alive_members.size==1 ? v[60]+=1 : 0The target is killed and the variable increases by 1 (I used variable[60] but you can change it to increase the variable you intend to use).
And you don't need a common event since you can just add v[60]=0 in the second skill formula.
Note that if you are not familiar with ruby that formula is the same as:
r=$game_party.alive_members.size; b.add_state(1); if r-$game_party.alive_members.size==1 v[60]+=1; endYou can use the 1st one or the second one, they should both work.
Then your second formula should look like this:
r=a.atk*(3+2*v[60])-b.def*2; v[60]=0; r(The variable r is set just because every time I put something after the damage value of a formula it doesn't work)
Of course you could just use
a.atk*(3+2*v[60])-b.def*2and let a common event set v[60]=0 but using a common event for something that fits perfectly in your formula box would be a shame.
EDIT: I am not sure that the second formula for the skill that applies death will fit the formula box. It is 1 character longer than the 1st one and is also pretty long. The first one fits for sure, I just copied it from my project after testing it.
I've tried what you said, Heirukuchi, and I appreciate the help! But I've got two issues;
One, is it possible to chance the first skill into an a.atk*5-b.def variant instead of add.state?
And second, killing a party member doesn't seem to increase the damage or variable, but that might be related to reviving.
Well, of course you can change the add_state(1) with your formula but you should use a script for that since it won't fit the formula box.
Note that the formula checks the size of alive party members before applying death and then checks it after applying it. In my project it worked fine. Are you sure you are checking the variable correctly? The second skill sets the variable to 0 so if you use it when variable is 1 and then kill another party member and use the aoe skill again it deals the same damage.
If you want it to increase its damage every time you should remove the v[60]=0 part.
So I got everything to work now; Skill kills someone, second skill deals more damage. But the second skill only deals more damage to the first(leftmost) target hit before it removes the variable to 0, so I instead used a common event to set the variable to 0.
I tried to change the first skill's formula so it deals damage. r=$game_party.alive_members.size; r-$game_party.alive_members.size==1 ? v[60]+=1 : 0;a.atk*5-b.def allows it to deal damage but does not increase the variable, while r=$game_party.alive_members.size; a.atk*5-b.def; r-$game_party.alive_members.size==1 ? v[60]+=1 : 0 gives null. I've removed some spaces to make place and I hope removing spaces does not mess with the formula, so if it is not possible changing the formula itself how would I go about doing this with scripts?
You are right, I forgot that was a AoE skill. Anyway how did you set the common event? You should always remember that if you set it wrong you could have troubles using that variable in the future.
For what concerns the script it should contain the same things you would like to put in the formula box. The difference is that you have all the characters you want.
I am not home and I have no access to my computer right now. If you can wait a bit I will send you a copy of that script as soon as I can via private message.