Jump to content

Recommended Posts

So, I have a bomb skill. The scope of the skill is set to All Enemies, and the formula is this:

(112 * 2.25)/$game_troop.alive_members().length - b.def

However, if I target two enemies, for example skeletons, and Skeleton 1 dies before Skeleton 2 is hit, Skeleton 2 takes the same amount of damage as it would if it was the only one alive at the start of the skill. If the skeletons have 10 DEF and 120 HP, the first one takes 116 damage, and the second takes 242. With three skeletons, the skill works properly on the first hit - all skeletons take 74 damage - but on the second, after Skeleton 1 takes 74 damage again and dies, Skeleton 2 takes 116 damage, and Skeleton 3 takes 242.

 

How can I change this skill so that even if Skeleton 1 out of 3 dies, Skeletons 2 and 3 will still take 74 damage? Even if Skeleton 1 out of 2 dies, Skeleton 2 will still take 116 damage?

 

Edit: Fixed the b.def subtraction. I imagine this would have to be done with some other script call. Another gripe I have with the skill is that it plays the animation once per monster, instead of on all monsters at the same time, but I remember reading that that can be remedied with a notetag in Yanfly's Battle Engine. I'll test that after I get this fixed.

Edited by GigaOtomia

Share this post


Link to post
Share on other sites

BEFORE EDIT (If I can remember)
if b.hp <= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; v[x] += 1; b.hp -= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; end; (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def

 

This won't fit in the box, so what you have to do is make a blank page in ur script editor above main and below materials like usual. Then, put this:
BOMB = "if b.hp <= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; v[x] += 1; b.hp -= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; end; (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def"

To explain how this fomula woks...

if b.hp <= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; v[x] += 1; b.hp -= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; end; (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def

 

Alright. The green text is the condition branch written in damage formula. There is no need for an "else" which is why you don't see it there. The gold text increases the variable by one if target dies and the white text will deal damage equal to the amount alive, +1. So if you have 8 ppl and one die, it will divide by (7 + 1) instead of just 7 now that the one died. White text manually deducts the damage and the purple is like the white one except that it also shows the number of damage dealt.


AFTER EDIT
I will tell you ahead of time, that there is no way to check that. Unless you're willing to make 2 parts of a skill.

Skill 1: It does nothing and has no scope but plays a common event (you can call a common event by going to the "effects" section of the skill) that does this:

$game_variables[n] = $game_troop.alive_members().length

"n" is the variable ID. Then use "Force Action" to do 2nd skill with....

(112 * 2.25)/v[n] - b.def

 

"n" is variable ID


Make sure animation says "Screen" and not "center", "foot", or any other option about ur animation issue. I was overthinking it. If you don't want to use force action, u can try using follow up script
https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/follow-up-skills/

 

Edited by Lord Vectra
Didn't know he read the "before edit" version

Share this post


Link to post
Share on other sites

The first version of the formula has a syntax error somewhere in it, crashing the game when called. The second, simplified version of the formula works perfectly. It seems like this is a somewhat different way of using scripts and the damage formula box; it's very useful to know.

 

I've run into a problem, however. When the enemies would all die to bombs on the first turn, the variable goes up by one; when I attack a lone Skeleton, it does 242 damage, but displays 116. I then tested this with two throwaway debug enemies, which have 10 DEF and 110 HP, and the game showed them taking 76 damage, but dying. If I use the bombs on an enemy with more health, enough to survive the attack, it works fine; the solution to this, I assume, would be to only increase the variable after damage has been shown on screen, somehow.

 

Also, no, I'm not sure how to have the skill cost a common event, but I do know how to make the skill cost set the variable I'm using to 0. I'm using Yanfly's Skill Cost Manager, and these notetags:

 

<custom cost requirement>
$game_party.item_number($data_items[22]) >= 1
</custom cost requirement>
<custom cost perform>
$game_party.lose_item(($data_items[22]), 1);

$game_variables[89] == 0
</custom cost perform>

 

For clarity, I have the player equip a Bomb weapon, and change the default attack to this one when that weapon is equipped.

Also, about the animation - I'd like for it to be centered on the enemies, and only display as many explosions as there are enemies. Setting it to the "screen" setting makes the animation just play a single explosion, in the center of the screen, then do damage, which is nice, since the damage step happens quicker - but perhaps I should make multiple animations, and multiple skills, depending on how many enemies are being targeted, then change which skill is used depending on how many enemies there are?

Edited by GigaOtomia

Share this post


Link to post
Share on other sites

Ah, I think I know the issue. Your variance has to be 0 because if it's, for example, 20, and the base damage is 100, you can get into a situation where their HP is less than 100, thus increasing the variable, but maybe their HP is 90 and the damage only was 80. Also, do this formula instead....

Before
if b.hp <= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; v[x] += 1; b.hp -= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; end; (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def


After

if b.hp <= (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; v[x] += 1; (112 * 2.25)/($game_troop.alive_members().length + v[x] - 1) - b.def; else; (112 * 2.25)/($game_troop.alive_members().length + v[x]) - b.def; end

 

The bolded is what I changed. Let's say u use it on a skeleton out of 10. If it *would die* the formula dealt damage as if there was 11 alive (bc that skeleton hasn't died yet since his death comes AFTER the the variable increases by 1). With a (-1), it won't account for them dead until you hit the next enemy. Also, no need for b.hp because I used it before because of the complex version which you said had a syntax error, so no need for the b.hp anymore.

You can call a common event through the "effects" section of the skills. Make a common event to reset the variable to 0 so after the skill is used, the variable you used is set to 0 (resets).


Animations

Oh, I see what you mean... I think. Why not just use "center", then? It'll be tedious but you'll just have to edit the zoom of each frame (assuming you are using the "screen" animations to do what you're attempting to do.

Share this post


Link to post
Share on other sites
On 5/14/2018 at 3:40 PM, Lord Vectra said:

Ah, I think I know the issue. Your variance has to be 0 because if it's, for example, 20, and the base damage is 100, you can get into a situation where their HP is less than 100, thus increasing the variable, but maybe their HP is 90 and the damage only was 80.

 

No, I always set the variance on my skills to be 0. Personally, I prefer it that way - it makes it much easier for the end user to figure out what the actual damage formulas are, and thus much easier for them to figure out the best strategy.

 

Regardless, it seems to be working now, after I fiddled with it enough. Thank you very much, Vectra.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×