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
540
Reaction score
219
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

Just finished composing a boss battle theme!
Scripted a multi-variable weather system that randomizes wind speed, cloudiness, rain, fogginess, etc, while attempting to realistically account for interactions between them (e.g. wind speed affects fogginess, cloudiness affects rain, etc), the current weather pattern, and the player's biome e.g. swamp, beach, etc. Now I "just" have to tie visuals and sounds to the variables so stuff actually happens...
I'm having a headache balancing the combat using flat defense so I'm gonna use percentual armor, in this pic, Simon has 16 on Defense which means all the incoming damage will be reduced by 16% this will ease my burden a bit.
!Have a nice day everybody¡
SO glad they patched outer worlds for switch! I can finally play it! Weird that other peeps are still having issues. I know it was really chugging on my lite when it first came out.

Forum statistics

Threads
105,555
Messages
1,014,620
Members
137,231
Latest member
anjing_gila
Top