I am planning to make an NPC where players can choose to combine 4 different type of items in any order and guess the formula but I don't know how to do it better without putting too many if conditions.
Example:
Materials available for combination
Apple
Red Herb
Grapes
Bottle
Formula example:
Apple Juice: Red Herb, Bottle, Apple, Apple (can be in any order)
Grape Juice: Red Herb, Bottle, Grapes, Grapes
Now what I want is if player chose materials even if it's not in order, the NPC will recognize it if it's the similar with the secret formula. Due to my limited knowledge in scripting the only way I know how to do it is by adding if's condition like:
if ( .@mat1 == 507 && .@mat2 == 713 && .@mat3 == 512 && .@mat4 == 512 ) {
mes "Success, you found a formula!";
mes "Apple Juice Formula";
close;
}
if ( .@mat1 == 713 && .@mat2 == 507 && .@mat3 == 512 && .@mat4 == 512 ) {
mes "Success, you found a formula!";
mes "Apple Juice Formula";
close;
}
and so on and so forth...
I want to learn how I can do it efficiently where regardless of order the NPC can recognize that the player found the correct formula without repeating that "if condition" too much because I am planning to add at least 50 hidden formula. Hope someone can give me an example or idea on how to do it efficiently. Thank you!