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

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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?
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,008
Reaction score
7,483
First Language
German
Primarily Uses
RMMV
use the modulo operator. modulo 2 will do what you want
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
294
Reaction score
440
First Language
German
Primarily Uses
RMMV
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
 
Last edited:

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,948
First Language
English
Primarily Uses
RMMV
Try "Battle Turns % 2 === 0" for even numbers and "Battle Turns % 2 !== 0" for odd ones.
 

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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.
ㅜ.ㅜ
 

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,008
Reaction score
7,483
First Language
German
Primarily Uses
RMMV
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.
 

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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!
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,008
Reaction score
7,483
First Language
German
Primarily Uses
RMMV
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.
 

Dehsalp

Veteran
Veteran
Joined
Oct 9, 2019
Messages
244
Reaction score
27
First Language
korean
Primarily Uses
RMMV
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.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

My pumpkin! Anyone like Fallout?

It's not terrible, but could be better. This thing took me over an hour to carve. :kaophew:

Dad's watching a WWII documentary while I work on some cool assets for my games. I just love RPG Maker!
Also Happy Halloween! Dad's friend won't be coming unfortunately, but Dad will still be taking me to Boxi Park to have some fun tonight! I'll be posting a video on my YouTube channel of the show, and I'll be sure to post a link here.
"Nightmares exist outside of logic and there's little fun to be had in explanations. They're antithetical to the poetry of fear. In a horror story the victim keeps asking why, but there can be no explanation and there shouldn't be one..." - Stephen King
I feel people seek explanation and demand it sometimes in games, but in the horror genre, well, maybe you shouldn't have one. Silent Hill 1 comes to mind...
Managed to implement QSprite.

Always double check your plugin order.


Finally! I've been puzzling over why it wasn't working for two days now. Turns out all of my calculations were correct, I just forgot to give some events hitboxes. :kaoswt: Now my randomly generated maps check for collision errors, and move stuff around in real time if they finds any. :LZSexcite:

Forum statistics

Threads
104,682
Messages
1,008,067
Members
136,171
Latest member
emcautley1
Top