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 Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top