Ruth Studio

Veteran
Veteran
Joined
Oct 19, 2017
Messages
61
Reaction score
24
First Language
English
Primarily Uses
RMMV
I am having fun with the engine, coming up with a Clue style game. I am having 6 murder weapons, so I am designating each NPC member a "card".

I created an if statement to check if the variables match. If any of the variables match then it will loop until it has its own individual number.

However, when I input the if condition for NPC 6 the variable will match another's NPC's variable #.

There is 6 "or" statements to 1 condition, which I am not sure the engine is able to process 6 or statements. If so, I will just have to change the murder weapons to 6 to 5 along with the person and rooms.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,697
Reaction score
9,865
First Language
German
Primarily Uses
RMMV
indefinitely
However, when I input the if condition for NPC 6 the variable will match another's NPC's variable #.
that means that you made a mistake in your event logic, it has nothing to do with an OR limit as the engine can handle as many ORs as you can fit into the line
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,789
Reaction score
15,918
First Language
English
Primarily Uses
RMMV
To figure out what you did wrong, we would need to see your event. You would also have to copy and paste the condition (do not retype it, as you might add or miss typos - we need to see it exactly as you have it).
 

Warilized

Random Encounter
Veteran
Joined
Mar 19, 2018
Messages
80
Reaction score
20
First Language
Indonesia
Primarily Uses
RMMV
Needs screenshot to understand more.


If you use IF/ELSE with six IFs, you can also try omitting the else to make a pseudo-switchcase (much more neater and less prone to error) and only the last IF must contain ELSE.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
715
Reaction score
307
First Language
English
Primarily Uses
RMMV
If you need a switch-case statement you can also use my SwitchCommand plugin.
 

Warilized

Random Encounter
Veteran
Joined
Mar 19, 2018
Messages
80
Reaction score
20
First Language
Indonesia
Primarily Uses
RMMV
If you need a switch-case statement you can also use my SwitchCommand plugin.
I'm interested in that plugin. Mind sharing the link? I'm in trouble finding it :aswt:
 

Ruth Studio

Veteran
Veteran
Joined
Oct 19, 2017
Messages
61
Reaction score
24
First Language
English
Primarily Uses
RMMV
Here is my code to assign a random number to NPC 6.

1625416069819.png



1625416094139.png
 

Warilized

Random Encounter
Veteran
Joined
Mar 19, 2018
Messages
80
Reaction score
20
First Language
Indonesia
Primarily Uses
RMMV
Here is my code to assign a random number to NPC 6.

The loop is unbreakable, and will loop forever, add condition to break the loop first. Self-switch doesn't end loop afaik.

I suggest using common event to assign unique random number to NPC is much more reliable.

The structure I can think is like this:
Control Var: var 1 = rand. 1..6
Loop
_Control Var: var 2 = rand. 1..6
_If var 2 !== var 1;
__Break loop
_End if
Repeat above
Loop
_Control Var: var 3 = rand. 1..6
_If var 3 !== var 1 || var 2;
__Break loop
_End if
Repeat above
...etc
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
715
Reaction score
307
First Language
English
Primarily Uses
RMMV
I'm interested in that plugin. Mind sharing the link? I'm in trouble finding it :aswt:
It's in my signature, but since I don't know if the forum allows you to hide signatures, here.
 

Warilized

Random Encounter
Veteran
Joined
Mar 19, 2018
Messages
80
Reaction score
20
First Language
Indonesia
Primarily Uses
RMMV
It's in my signature, but since I don't know if the forum allows you to hide signatures, here.
I'm on mobile so that's probably why I can't see your signature. Thanks!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,697
Reaction score
9,865
First Language
German
Primarily Uses
RMMV
Here is my code to assign a random number to NPC 6.
you never check for variable 2, is that intentional?

and your first problem is that you should have structured your script line with () to make it better readable for both the computer and yourself.

The second problem however is that this loop is extremely badly designed, because the last randomizer might loop hundred of times before getting the last variable.

A much better way would be to create an array with one element of each number, then choose a random position of the array, copy the element value and remove the element, then loop.
no need to check for doubles at all and after six calls the array is empty.
 

Ruth Studio

Veteran
Veteran
Joined
Oct 19, 2017
Messages
61
Reaction score
24
First Language
English
Primarily Uses
RMMV
I agree the loop is badly designed. It could hypothetically loop a hundred and one times. I’ll look into arrays as it will probably look cleaner but be more efficient for the computer to assign the murder weapon.

After some brainstorming I figured it out. I’m an idiot. The last loop was getting stuck because it wasn’t able to assign itself a number since all were taken. If there is 6 murder weapons then only 5 NPCs can provide clues to the real murder weapon.
 

Latest Threads

Latest Posts

Latest Profile Posts

Just laid down a sick nasty new post in the MagiCats! Infinite Sadness thread! Lemme give ya a big ol' hug for it.

bg6.jpg
Wheel of Attacks.png

MORE GAMBLING THEMED ATTACKS!

I AM UNABLE TO STOP!
Is it ok to repost stuff that i've posted to threads in the status feed?
If so, here's art of Shiloh, the main protagonist of the game i'm making:20220807_181702.jpg
They are meant to be ambiguous in gender, like Frisk from Undertale or Gogo from FFVI. I haven't decided what their age will be yet. Any ideas?
Please comment what you think about the art and design!
ScreenShot_8_10_2022_7_15_21.png
Looks like Mike's got a new party member in Robbi...

Calf survival story with a happy ending.

Forum statistics

Threads
124,461
Messages
1,163,837
Members
163,282
Latest member
Wintt
Top