Treza

Warper
Member
Joined
Mar 31, 2023
Messages
3
Reaction score
2
First Language
English
Primarily Uses
RMMZ
I want the potion to just be named a color until the player uses it. Then it's name changes to what type of potion it is. I'm trying
to make a rougelike so I want the potion effects randomized until the player tries it.
My problem is I don't know how to make it random while checking if the potion type is already taken by another color. I tried to have it check if the random number attached to the color is attached to any other color and if so re-roll the variable for that color and loop until it has a unique number.
I have the color potion item trigger the common event and it does produce a random effect, and replaces the color potion with the name of the type of potion.
 

Attachments

  • Potions1.png
    Potions1.png
    153.6 KB · Views: 8
  • Potions2.png
    Potions2.png
    158.2 KB · Views: 8

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
38,487
Reaction score
10,906
First Language
German
Primarily Uses
RMMV
This is one of the few cases where even I would suggest a scripted/plugin approach instead of trying to handle this by events.
And you should split it into two parts.

First, search for a plugin that enables a dynamic database.
Use that to setup the database to use generic names and no effects at the beginning, and add in the effects after first use only. You'll basically have to have each potion twice in the database, with only one of each pair active at any time. And the first is calling a common event on use that handles the randomness before changing the numbers to the second variant.

Second, you should use an array to store the possibilities and remove one element each time randomly. Javascript has commands that make handling a limited element group by array much easier than trying to do this by events.
 

SGHarlekin

Orc Jester
Veteran
Joined
Jun 29, 2020
Messages
1,146
Reaction score
1,422
First Language
German
Primarily Uses
RMMV
Hm.... I get a feeling this might not be soooo hard.

Thinking you could potentially make a single ??? potion item that calls a common event on use.
That common even then rolls a random variable "potion unlocker" between 0 and X, where X is the amount of effects you have.

Then you could use a conditional branch like this:
if variable "potion unlocker" = 0
if switch "potion effect1" = OFF
turn switch "potion effect1" = ON
else
roll the random variable again

This would potentially unlock a new potion effect with each use.

The way to actually get the discovered potions to the player via chest would then be a whole bunch of conditional branches like:

Change variable "potion randomizer" 0-X where X is the amount of of potion types you have.

if potion randomizer = 0
if switch potion effect1 = ON
Give player this specific type of potion

Repeat that for all potion types.

You can also just roll an additional variable 0-1 and use that to determine whether or not the game rolls for an already discovered potion or give an unkown one.

It's servicable and can be expanded upon too. But a plugin could definitely make this easier.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,891
Reaction score
6,695
First Language
English
Primarily Uses
RMMV
SGHarlekin's approach would work. I agree doing some of it via code would make your events less cumbersome.

Just putting it out there: Roguelike. Rouge is makeup.
 

Treza

Warper
Member
Joined
Mar 31, 2023
Messages
3
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Thanks everyone. Sounds like the plugin route is best in the long run. I did find a dynamic database plugin I think. I'll have to learn some javascript but that's part of the point of me making this game.

Just putting it out there: Roguelike. Rouge is makeup.

Fair point. Not the first or last time I make that mistake sadly.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
541
Reaction score
455
First Language
English
Primarily Uses
RMMV
If your items are organized in a way where the identified versions of each unidentified item are grouped together in the database, you can use a common event to award the player with a random element from a specific group.


1680310739815.png

All of the possible rewards from an 'Unidentified Treasure' are items 1912 - 1930

You could have multiple identifying events to have multiple sets of rewards.

-EDIT-
I guess I didn't read your post well enough initially, and I see this isn't exactly what you were looking for but maybe it could help anyway.
 
Last edited:

Treza

Warper
Member
Joined
Mar 31, 2023
Messages
3
Reaction score
2
First Language
English
Primarily Uses
RMMZ
That does help actually, thanks. I was thinking about adding random equipment as well and that seems simpler then going through an array since it's OK to have repeats of those.
 

Latest Threads

Latest Profile Posts

Hamburger!? Yeeah.
I love it when the approval queue is 80% spammers. Makes it so fast to power through!
I found some inspiration and have started work on a Point and Click style exploration game in a dead mall. I am hopefully going to push MZ in some unexpected directions. I always love seeing the engine do things that folks might not expect. Its good to have found some direction. Thanks for the support a few weeks back when the writers blog was hitting heavy.
Don't you want your heroes or monsters to lose some of their MAXHP or MAXMP? Don't you?
Really, why wouldn't you? :p
Yeah, it's gonna get worse after every hit they take, but so what?
Aren't they courageous fighters? Or stupidly brute mobsters?

Forum statistics

Threads
131,730
Messages
1,222,700
Members
173,475
Latest member
georgino15
Top