SergeofBIBEK

Villager
Member
Joined
May 8, 2017
Messages
6
Reaction score
42
First Language
English
Primarily Uses
RMMV
Action Sequence Nested IF 1.00
SergeofBIBEK

Hey everyone! I made a plugin that I think would be useful to hardcore action sequence makers!

**Introduction**

This is a really simple plugin. It allows you to nest IF statements in action sequences.

**How to Set Up**

Place this plugin below YEP_BattleEngineCore.

**How to use IF in Action Sequences**

To start an IF, use the following command:
Code:
     IF condition
The condition is whatever you would put in a normal JS IF statement.

Then end the IF with the following command:
Code:
     END
Here is an example:
Code:
     <Target Action>
     if user.mp > 100
     animation 5: target
     wait for animation
     action effect
     mp -100: user, show
     wait: 10
     end
     </Target Action>
You can also still use else and else if like this:
Code:
     ELSE
     ELSE IF condition
The condition follows all the same rules as the IF conditions
Code:
     <Target Action>
     if user.mp > 100
     animation 5: target
     wait for animation
     action effect
     mp -100: user, show
     wait: 10
     else
     animation 3: user
     wait for animation
     mp +50: user, show
     end
     </Target Action>
But Wait! There's more!
Now you can nest your if statements!
Code:
     <Target Action>
     
     if user.mp > 100
     animation 5: target
     wait for animation
     action effect
     mp -100: user, show
     wait: 10
     
     if user.hp > 100
     animation 3: user
     wait for animation
     action effect
     hp -100: user, show
     end
     
     end
     </Target Action>
In this example the user will do damage if their mp is OVER 100,
then do damage again if their hp is OVER 100. If their mp is
is UNDER 100 then nothing will happen. EVEN if their HP is 101+.

Since that if is inside the other if, it won't happen unless the
first IF's conditions are met. Nest IFs, just like JS!

**Script**

*You can get the latest version here:*
[Action Sequence Nested IF](https://www.dropbox.com/s/z4tvqmc2u9mmtn8/SergeofBIBEKActionSequenceNestedIf.js?dl=0)

**Credit and Thanks**

SergeofBIBEK (me!)

Yanfly: You couldn't even nest IFs in Action Sequences without Yanfly's amazing Action Sequences plugins!!

**License:**

Free for any use, do whatever you want. Don't even have to credit me anywhere!
 

Neo Soul Gamer

Veteran
Veteran
Joined
Aug 10, 2012
Messages
663
Reaction score
412
First Language
English
Primarily Uses
N/A
I'm not a big Action Sequence user, so excuse my ignorance... But isn't this already a feature in Yanfly's plugin? What's the difference between the included feature and your addon?

From the help file:


Code:
=============================================================================
IF ... ELSE STATEMENTS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
For those familiar with programming, you can use if...else statements to
perform different actions based on different conditions. Use 'if' to
specify a block of code to be executed, if a specified condition is true.
Use 'else'  to specify a block of code to be executed, if the same
condition is false. Use 'else if' to specify a new condition to test, if
the first condition is false. Use 'end' to specify where the conditions
are to end.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example:
    if $gameSwitches.value(1)
        action effect
    else if $gameSwitches.value(2)
        action effect
        action effect
    else
        action effect
        action effect
        action effect
    end

*Note: You do not have to indent the code in between to work. It just
looks better that way in your action sequences.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
943
Reaction score
593
First Language
English
Primarily Uses
RMMV
You couldn't nest if statements in the action sequences before using this plugin. The plugin was designed such that the first 'end' that it reads would close all if statements, instead of the current one.
Code:
if (something)
 stuff
 if (something else)
  optional stuff
 end
 more stuff
end
That above sequence would originally only do stuff, and possibly optional stuff, but never more stuff... If that makes sense.
 

Neo Soul Gamer

Veteran
Veteran
Joined
Aug 10, 2012
Messages
663
Reaction score
412
First Language
English
Primarily Uses
N/A
@ramza

Makes perfect sense. Like I said, I'm not a big Action Sequence user, so I've never attempted to nest IF statements with them. I had to ask to make sure. Thanks!
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Just a note for anyone using SRD's Timed Attack Core plugin (and any of the add-ons for it), you have to place this plugin above those otherwise it seems to make them not function at all.

Edit:
No intention of Necro-posting. This is a very handy plugin!
 

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
274
Reaction score
44
First Language
English Spanish
Primarily Uses
RMMV
OMG, I lost two days of my life and a great deal of hair not knowing Yanfly Action Sequences does not support nesting. I F*** love you for this plug in.
 

Person1

Angra
Member
Joined
Jan 23, 2019
Messages
5
Reaction score
1
First Language
Portugues
Primarily Uses
RMMV
So from what I understand, you can set conditions on your action sequences. So can I make so if the character is going to land a critical hit, it does a different animation? For example, the way it works on Chrono Trigger and Persona 4 where the MC does a normal slash but on critical hit, the MC jumps into the enemy and does multiple slashes. Can this plug in do that?
 

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
274
Reaction score
44
First Language
English Spanish
Primarily Uses
RMMV
Hmm I dont know how to check if the hit will be critical so it does another animation. what you can do is your own critical system in your attack skill and then in that case is possible. Like:

random numer between 1 and 100
if its 4 or less
do critical animation
else
do normal attack anmation
 

Latest Threads

Latest Posts

Latest Profile Posts

I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!
Creating 3D CGs for Cutscenes. :kaosalute:

I keep wanting to post every song I make for the game and have to hold back on that because at this rate, I'll have spoiled all the really good stuff lol..
DerniBorges wrote on TSR's profile.
Is there any way this plugin works with the big character, and the QSprite plugin? Using RTP chars, everything works fine, but the big ones, with QSprite, it's like that in the image, it doesn't reflect right. And there is, in the settings, an option to fix it. Thanks.
bug2.png

Forum statistics

Threads
115,902
Messages
1,093,842
Members
151,151
Latest member
ManuelElis20
Top