(Solved)Help using Lunatic Pack - Passive Condition Cases (YEP)

Hi !

I want to give the enemy a special passive.

This ability is only capable of acting once on an odd turn, but acting twice on an even turn.

From Lunatic Pack-Passive Condition Cases (YEP)

<Passive Condition Cases>
Battle Turns = or> or <...
</Passive Condition Cases>

I know this script can be changed to work only on a specific turn.

However, there is no way to check for odd or even numbers. Is there a way to enable it?

Can you help me?
use the modulo operator. modulo 2 will do what you want
use the modulo operator. modulo 2 will do what you want


what is 'modulo operator' mean?

I didn't understand.
modulo is a mathematic operator symbolized with "%".

It basically works like division, but it will output the leftover from that division (if the division leaves you with a decimal number.
Sorry it kind of is difficult to explain modulo in english.

Example:
If you divide 7 by 2 (7 / 2) you will get 3.5
If you modulo 7 by 2 (7 % 2) you will get 3 and leftover 1 (the final result will be 1)

Basically:

1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1

So if you put X % 2 like Andar suggested,
you will get a 1 whenever the turn (X) is odd and a 0 whenever the turn (X) is even
modulo is a mathematic operator symbolized with "%".

It basically works like division, but it will output the leftover from that division (if the division leaves you with a decimal number.
Sorry it kind of is difficult to explain modulo in english.

Basically:

1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1

So if you put X % 2 you will get a 1 whenever the turn (X) is odd and a 0 whenever the turn (X) is 1

It is a pity that it is difficult to explain.

I roughly understood what it meant.
But how do I apply it to this script?

<Passive Condition Cases>
Battle Turns = x
</Passive Condition Cases>

The "x" part must contain a modulo-calculated number, but I'm not sure how to replace the calculation formula with a script.
Try "Battle Turns % 2 === 0" for even numbers and "Battle Turns % 2 !== 0" for odd ones.
Try "Battle Turns % 2 === 0" for even numbers and "Battle Turns % 2 !== 0" for odd ones.

Hmm...
"Battle Turns% 2 == 0" and "Battle Turns% 2 !== 0"
No, neither of them work.
ㅜ.ㅜ
Try "Battle Turns % 2 === 0" for even numbers and "Battle Turns % 2 !== 0" for odd ones.

Oh wait...
Battle Turns % 2 == 0 not this one.
Battle Turns % 2 = 0 this one....

hahaha...

In case you have used == used in scripts, not the == used in scripts.

It now works.

thx to help!
just as an added info: modulo is also available in the control variables command, the "mod" operation listed there. That is why I assumed most people know this, because that is used for a number of event operations or skills.
modulo is a mathematic operator symbolized with "%".

It basically works like division, but it will output the leftover from that division (if the division leaves you with a decimal number.
Sorry it kind of is difficult to explain modulo in english.

Example:
If you divide 7 by 2 (7 / 2) you will get 3.5
If you modulo 7 by 2 (7 % 2) you will get 3 and leftover 1 (the final result will be 1)

Basically:

1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1

So if you put X % 2 like Andar suggested,
you will get a 1 whenever the turn (X) is odd and a 0 whenever the turn (X) is even


Now, I'm taking a closer look and using it, but something is odd.

<Passive Condition Cases>
Battle Turns % 2 = 0
</Passive Condition Cases>

I am using a script like this.
But for some reason it doesn't work properly except for the first turn.

I know that the first turn in rpg maker mv is treated as 0.

So 0% 2 = 0, so the first turn seems to work fine.
In the third turn, 2% 2 = has a value of 2, shouldn't the rest be 0? But it doesn't work.
Naturally, it didn't work on the second, fourth, or fifth turn.

I don't know why.


Edit)

Nevermind guys !

Code:
<Custom Passive Condition>
if ($gameTroop.turnCount() % 2 == 0) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


I applied what you taught me and applied it.

Using it like this works fine!
But for some reason it doesn't work properly
That is because
=
==
and
===
are three different things in javascript code.
You can't simply ignore the added ='s because leaving one of them will change what the code does.
That is because
=
==
and
===
are three different things in javascript code.
You can't simply ignore the added ='s because leaving one of them will change what the code does.

But when I used === it didn't work at all.
That's why I adopted a different method.

Original thread: https://forums.rpgmakerweb.com/threads/solved-help-using-lunatic-pack-passive-condition-cases-yep.124925/