Jump to content
Rubinblau

Attack that repeats when enemy is killed

Recommended Posts

Hello, I am planning to have one of my characters use an attack that does heavy damage to an enemy.

Should the enemy be killed, the character will use another attack (shortened, slightly weakened) version of it on another enemy.

Should that attack kill the second enemy, the character will use this attack on a third and so forth.

 

How could I achieve this? My main problem is checking if the attack kills an enemy, the rest should be fine.

Share this post


Link to post
Share on other sites

One way to check is to do a conditional based on HP.

 

For example, if the damage formula is a.atk * 5 - b.def * 2.5

 

then the full damage formula including the conditional will say

 

if b.hp <= a.atk * 5 - b.def * 25; [add what happens here]; a.atk * 5 - b.def * 2.5; else; [whatever happens if not true]; a.atk * 5 - b.def * 2.5; end

 

if that doesn't work
 

if b.hp <= a.atk * 5 - b.def * 25; [add what happens here]; else; [whatever happens if not true]; end; a.atk * 5 - b.def * 2.5


You WILL need 0 variance if you are to do this.
 
If the skill is an element that can possibly be null against certain monsters you have (ex. fire spells against a fire demon), then you'll need to add b.element_rate(x) after a.atk * 5 -- b.def * 25 like this...
 
(a.atk * 5 - b.def * 25) * element_rate(x)
PARENTHESIS MATTER! And ONLY do that for the conditional. For example, it'll look like this:
 
if b.hp <= (a.atk * 5 - b.def * 25) * element_rate(x); [add what happens here]; a.atk * 5 - b.def * 2.5; else; [whatever happens if not true]; a.atk * 5 - b.def * 2.5; end
 
Replace "x" with the element ID of the skill.
 
If that is too big, you should go to script editor, create a new one. Then, while its black, put something like...

VECTRAISGREAT = "if b.hp <= (a.atk * 5 - b.def * 25) * element_rate(x); [add what happens here]; a.atk * 5 - b.def * 2.5; else; [whatever happens if not true]; a.atk * 5 - b.def * 2.5; end"
 
QUOTATIONS MATTER!

And then in the damage formula, put...
 
eval(VECTRAISGREAT)
  • Like 1

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.

×
Top ArrowTop Arrow Highlighted