RMMV Reflecting/Absorbing & conditional statements in Action Sequences

Helel257

Villager
Member
Joined
Aug 18, 2020
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hello, I'm trying to get a Yanfly Action Sequence to work in tandem with YEP_ElementCore.

I'm trying to accomplish a sequence after attacks where if the element is super-effective, then the user gains a status effect. However, if the element is blocked or nullified in any way then the opponent gains the status effect instead. This system is identical to the Smirk status from SMT IV.

However, I've so far been unable to get it to work as an action sequence and I suspect it's because I'm using the wrong functions/variables/whatever and structuring something wrong. If anybody knows what to fix about the action sequence below to achieve the desired effect, please tell me.

(my battle system is frontview rather than sideview, if that also clears up any questions)

Code:
<Target Action>

action animation

wait for animation

action effect

\\Check if attack is super-effective. If so add buff state to user.

if result.ElementRate > 1

animation 141: user, mirror

add state 7: user, show



\\Check if attack is blocked. If so add buff state to target.

else if result.ElementRate = 0

animation 141: target

add state 7: target, show



\\Check if attack is absorbed. If so add buff state to target.

else if obj.ElementAbsorb

animation 141: target

add state 7: target, show



\\Check if attack is reflected. If so add buff state to target.

else if obj.ElementReflect

animation 141: target

add state 7: target, show



\\If the attack hits normally, then nobody gets the buff.

else


end

death break

</Target Action>
 

Helel257

Villager
Member
Joined
Aug 18, 2020
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
I've done it!! I haven't got the patience right now to figure out how to put critical hits into the equation, and this doesn't work for the "Attack Element" if it fluctuates from character to character, but I've gotten it to work and that's alright for me!

Here's the code. Just replaces the element number, animation number and state number depending on what does what. This must go in the notetags of every skill you intend to have the smirk-like effect, which is likely all of them.


Code:
<Target Action>

immortal: targets, true

action animation

wait for animation

action effect

death break

</Target Action>
<follow action>

// if the attack is super-effective, you gain the status
if target.elementRate(INSERT ELEMENT NUMBER) > 1
immortal: targets, false
animation x: user
add state y: user, show

// if the attack is nullified, enemy gains the status
else if target.elementRate(INSERT ELEMENT NUMBER) == 0
immortal: targets, false
animation x: target
add state y: target, show

// if the attack is absorbed, enemy gains the status
else if target.isAbsorbElement(INSERT ELEMENT NUMBER)
immortal: targets, false
animation x: target
add state y: target, show

// if the attack is reflected, enemy gains the status
else if target.elementReflectRate(INSERT ELEMENT NUMBER)
immortal: targets, false
animation x: target
add state y: target, show

// if the attack is neutral, nobody gains the status
else
immortal: targets, false

</follow action>
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
554
Reaction score
229
First Language
english
Primarily Uses
RMMV
dont think you need the absorb line unless that state is different then the nullify state.
just need to change the nullify to being if less then or equal to 0
since element absorb is just a negative number it is less then 0
 

Helel257

Villager
Member
Joined
Aug 18, 2020
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
dont think you need the absorb line unless that state is different then the nullify state.
just need to change the nullify to being if less then or equal to 0
since element absorb is just a negative number it is less then 0
Ah, you're right about that. You can turn "==" into "<=" and remove the absorb section for the same effect. I've just been working on this for a whiiiiile so I just wanted to put this up as my own celebration. I'll be able to optimise it as I work more on my project :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top