Spindaboy

Veteran
Veteran
Joined
Oct 14, 2015
Messages
116
Reaction score
9
First Language
English
Primarily Uses
RMMV
I'm looking for a plugin that will set an ability with a chance to backfire instead of functioning, causing it to instead hit the party.
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
63
Reaction score
28
First Language
Spanish
Primarily Uses
RMMV
Maybe you don't need a specific plugin at all. Only maybe Yanfly's DamageCore plugin for the big formula.


Here's my approach to the skill:


This skill has a 1/3 chance to backfire and EXPLODE into your party's face, playing animation 107 and dealing 1000 fixed damage.


<damage formula>
randomNumber=Math.randomInt(3)+1;
if (randomNumber !== 3) {
value = a.atk*4-b.def*2;
}
else {
for (var i = 0; i < $gameParty.members().length; ++i) {
$gameActors.actor(i+1).startAnimation(107);
$gameActors.actor(i+1).gainHp(-1000);
if($gameActors.actor(i+1)!==user) $gameActors.actor(i+1).startDamagePopup();
if ($gameActors.actor(i+1).isDead()) {
$gameActors.actor(i+1).performCollapse();
}
}
value = 0;
}
</damage formula>

randomNumber=Math.randomInt(3)+1;


   and


randomNumber !== 3

This first line generates a number between 1 and 3. It's pretty much like rolling a dice.


If you get a number different than 3, you will be just fine. If you get a 3, the skill will backfire.


You can change the change to 1/5 or 1/8 or whatever you like in the second line.

value = a.atk*4-b.def*2;

Your attack formula goes here. Do not delete the value thing.

$gameActors.actor(i+1).startAnimation(107);

Change the 107 for the animation you want to play in your party when the skill backfires.

$gameActors.actor(i+1).gainHp(-100);

Change the 100 for the damage you want to cause to your party. I think you can also use a formula here.

if($gameActors.actor(i+1)!==user) $gameActors.actor(i+1).startDamagePopup();

For a reaaaaally weird reason the popup plays twice on the caster. If you see the caster has no damagepopup, remove the if.


I hope I got your skill right man. If not, it's a really interesting skill. :D
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
63
Reaction score
28
First Language
Spanish
Primarily Uses
RMMV
Not a script. It's a damage formula. You put that into your skill's notebox. And the skill does stuff.
 

Spindaboy

Veteran
Veteran
Joined
Oct 14, 2015
Messages
116
Reaction score
9
First Language
English
Primarily Uses
RMMV
Not a script. It's a damage formula. You put that into your skill's notebox. And the skill does stuff.

Oh duh. Thanks again and I will let you know how it goes :)
 

Spindaboy

Veteran
Veteran
Joined
Oct 14, 2015
Messages
116
Reaction score
9
First Language
English
Primarily Uses
RMMV
Not a script. It's a damage formula. You put that into your skill's notebox. And the skill does stuff.

It seems to be working correctly, but it never backfires. Have you tested it?
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
63
Reaction score
28
First Language
Spanish
Primarily Uses
RMMV
I just tested it and it works, maybe you are very lucky. Did you change anything?
 

Spindaboy

Veteran
Veteran
Joined
Oct 14, 2015
Messages
116
Reaction score
9
First Language
English
Primarily Uses
RMMV
I just tested it and it works, maybe you are very lucky. Did you change anything?

Yes. Here is what my notebox looks like:


<Cast Animation: 135>


<damage formula>


randomNumber=Math.randomInt(4)+1;


if (randomNumber !== 4) {


value = 200 + a.mat * 3 - b.mdf * 2;


}


else {


for (var i = 0; i < $gameParty.members().length; ++i) {


$gameActors.actor(i+1).startAnimation(59);


$gameActors.actor(i+1).gainHp(a.hp / 4);


if($gameActors.actor(i+1)!==user) $gameActors.actor(i+1).startDamagePopup();


if ($gameActors.actor(i+1).isDead()) {


$gameActors.actor(i+1).performCollapse();


}


}


value = 0;


}


</damage formula>


Am I supposed to also put a damage formula where I would for a normal skill?
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
63
Reaction score
28
First Language
Spanish
Primarily Uses
RMMV
The skill works as intended, It's all luck really,  But while testing it I discovered two problems:


1. You are healing yourself in your skill, use  x.gainHp(-(a.hp / 4)) to lose HP. (I don't know if this was intented or not, but the poison animation makes it suspicious looking).


2. If you use a division in the gainHP() method, probably your characters HP will show decimal numbers and their HP bars will look REALLY weird. A solution could be changing that part to x.gainHp(-Math.round(a.hp / 4)).


Oh and you should leave in blank the original damage formula space.
 
Last edited by a moderator:

Spindaboy

Veteran
Veteran
Joined
Oct 14, 2015
Messages
116
Reaction score
9
First Language
English
Primarily Uses
RMMV
Oh and you should leave in blank the original damage formula space.

That must have been it as it is working now! Yet for some reason when it back fires it strikes all enemies and party members. What is your target set to?
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
63
Reaction score
28
First Language
Spanish
Primarily Uses
RMMV
I had it in "1 enemy".
 

Latest Threads

Latest Posts

Latest Profile Posts

My friend just gave me chocolate milk at lunch today! My day is now 1000x better. Yay, choco milky!! :kaojoy:
RivalRamen_Games wrote on jacobv1014's profile.
I really like your profile picture! Who is that in it? is she an OC?
Making his first game
This scene was suppose to be a test... but now, it's going in the game as official side/optional content. :kaosalute:

Forum statistics

Threads
115,331
Messages
1,089,067
Members
149,998
Latest member
MoonSandwich
Top