How to make a potion with a randomized effect?

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
Hey! So, I'm planning to make a potion that has one of many effects. I already know how to set it up:




It's just that I'm unsure what to do next. Thanks! :D
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ


Can't see picture.


Let's help you solve it though with just one punch! :p


So, you have to make a common event.


On start set a variable to a random number between let's say 1 to 10, if you wanna make 10 random different effects.


If you wanna make 5 random effects the variable should be set to a random value between 1 and 5.


Got it?


Then Create a conditional branch for each case.


If variable  = 1


then it will restore 100 hp to the user.


end of branch


If variable  = 2


then it will restore 100 mp to the user.


end of branch


You can always combine different effects in each condition, and make the random number gap bigger,


or just make two variables one let's say for a buff - debuff  effect


one for side effects like negative healing or negative mana, the options are countless here.


Explaining:


Effects (double click) > Other (select tab) > Common Event (choose radio button) > Select the common event you made.


Create a potion inside the database and make it doing nothing.


Make it available on battle and if you want on field or on battle only.


Make it call the common event.


End of story! :p
 
Last edited by a moderator:

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
I'm sorry! In the picture, it shows a control variable randomizing between 1-5. After it are conditional branches based on what number the variable lands on.


The true problem I have is that I can't put that it affects the user. If I were to use the change HP call, I can only do "Entire Party" or a specific actor.


Unless.... I'm missing something and being an idiot. ^^;


Also I love that reference there XD
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
Scope: The User.


(General settings of the item)


:)


Try using Scope the user.


If it will not solve your issue, you have to get the character ID into a variable


Change HP command has the option Actor: Variable.


Control Variables,  set a variable as Game Data, Party Member.


And here goes the problem with this approach. You can target a specific member of the party, but not the user.


Neither control variables or conditional branches help here. Wow.


If SCOPE doesn't solve the case, you might need a small script command.
 
Last edited by a moderator:

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
EDIT: Wait, the potion effects affect the entire party, even when I select The User for the item.


I still have a problem. ;u;
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
EDIT: Wait, the potion effects affect the entire party, even when I select The User for the item.


I still have a problem. ;u;


@Shaz any ideas? I think this will need one command to get the ID of the user into a variable, then a simple conditional branch can do the rest simply.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,692
Reaction score
13,978
First Language
English
Primarily Uses
RMMV
I would just use the damage formula to set a variable to the user's actor id.  This will get executed first, and then you can check the value of the variable in your common event.

Code:
$game_variables[x] = a.id; 0
The 0 just means no damage by default.  Change x to whatever variable id you want to use - don't use leading zeros.


Then, you can either do nested conditional branches to apply the effect to the correct actor based on the variable, or figure out what the appropriate script calls are, so you can just use a single script call for each effect and not have to worry about conditional branches at all.  To help you with that, though, we'd need to know exactly what effects you want for each of the random numbers.


You might also be able to use BattleManager.next_subject.actor to give you the user as an object.  Then you can do stuff like this:

Code:
Conditional Branch: Variable [0030: Iffy Potion] == 1
  Script: BattleManager.next_subject.actor.hp = BattleManager.next_subject.actor.max_hp
Branch End

Conditional Branch: Variable [0030: Iffy Potion] == 2
  Script: BattleManager.next_subject.actor.hp.add_state(3)
Branch End

...
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
Code:
$game_variables[x] = a.id; 0


Oh, MY GOD!


You actually thought of using the ready formula variables! Brilliant!


so a is always the user so you get the id and store it directly, lol that's fantastic!
 

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
I want the potion to heal 60% of the actor's HP, or silence, poison, blind, or make them sick (which is one of my custom states).


Also... uh... I'm gonna need a lot of help with the common event's setup, if that's alright with you. >-<
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,692
Reaction score
13,978
First Language
English
Primarily Uses
RMMV
Let's talk about the healing 60% a bit ...  do you mean you want to calculate what 60% of their max hp is and give that to them (so it could take them up to 100%), or just take them to 60% ONLY IF they are currently below 60%?


What are the state ids for silence, poison, blind and sick?
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
Wait. Listen up, you need no further help here. :)


Listen what you gotta do.


Go to the random potion on the database.


Inside the damage formula add the line:

Code:
$game_variables[x] = a.id; 0


INSTEAD OF X YOU SHOULD PUT A VARIABLE ID


When you select a variable it has an ID to its left, starting wit 0001 and goes on.


Variables by default are 20 but you can add more and will be shown into sets of 20.


You choose a variable and name it USER_ID let's say the variable is 0019.


So it will be


$game_variables[19] = a.id; 0


Inside the common event:


Now make a variable as random from 1 to 5. This variable will be named RND_EFFECT and let's say it is 0018


Conditional Branch:


IF Varriable 0019:RND_EFFECT  = 1


____Set a command CHANGE HP.


____Acrtor: Set radio button to Variable, and choose Varriable 0019:USER_ID


END BRANCH


IF Varriable 0019:RND_EFFECT  = 2


____Set a command CHANGE STATE


____Acrtor: Set radio button to Variable, and choose Varriable 0019:USER_ID


____ here you choose a state to add...


END BRANCH


and so on.


Note that this way the five cases have equal possibility. Different possibilities can happen but you need another thread.


Let's first make sure you solve THIS case first.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,692
Reaction score
13,978
First Language
English
Primarily Uses
RMMV
Ah - I'd completely forgotten that the actor commands let you use a variable for the actor's id!  That's perfect!  So no script calls necessary.
 

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
EDIT: Oops, needed to refresh. >_<


Okay, I'm going to test! Be back in a bit. :)
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,086
Reaction score
2,677
First Language
Greek
Primarily Uses
RMMZ
....


Call Common Event:


(NAME IT RANDOM_POTION)


Inside it, set a variable with ID let's say = 0020 to Random between 1 and 5. Okay? Name this variable RANDOM_EFFECT


As you are there manipulating variable 0020, change the variable 19 name to USER_ID


CONDITIONAL BRANCH


VARIABLE RANDOM_EFFECT = 1               <--- We want this to be HP+


CHANGE HP


Target is Actor (select Variable USER_ID)


ADD HP


END


CONDITIONAL BRANCH


VARIABLE RANDOM_EFFECT = 2         <--- We want poison


CHANGE STATE ADD Poison            <--- you set target using the same variable USER_ID


END


========================================================================


Forget about 60% hp, focus on making this work, then you tweak it more.
 
Last edited by a moderator:

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
I'm really sorry, @Dreadshadow, I didn't get your message until after I refreshed... ^^; Me derp.


That solution works perfectly! Thanks so very much, both of you (Also, I'll just have the potion have a set HP raise, since this was already a ton of trouble :p). :)


By the way, is the User scope supposed to lock you on the first party member once you go to choose, or is that another script I have interfering?
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,692
Reaction score
13,978
First Language
English
Primarily Uses
RMMV
User scope is whoever's turn it currently is.
 

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
I meant out of battle but it's alright ;u; 


Thanks guys.  :D :D
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,692
Reaction score
13,978
First Language
English
Primarily Uses
RMMV
There is no 'user' out of battle, so you're best to avoid using that scope for items that can be used out of battle.  Instead, make the scope One Ally.


If this is for the above item, and you can use it both in and out of battle, you're better off setting the scope to One Ally, and then your formula will have b.id instead of a.id - it just means when you use it in battle, you'll get the actor list and can use it on the current actor or any of the other battlers.
 

FishStickMystic

The Nerdiest Nerd
Veteran
Joined
Dec 25, 2014
Messages
32
Reaction score
30
First Language
English
Primarily Uses
RMVXA
Ohh, alright! Well, that fixes that little problem then. ^^;


Thanks again! :)
 
Last edited by a moderator:

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

Latest Threads

Latest Profile Posts

aww these times when you feel alone, abandonned and lack the self awareness you don't even read anymore your favorite of all forum. Sorry all!
Oh wow, just got word the police are looking for an armed suspect within a 2 block radius of my office. Super glad I'm not there right now. :kaoswt:
Sheila Nagase

same caption as before. :3
"Be as honest as you possibly can as often as you can. It makes your lies much easier to believe."
Each new game means new ways to survive and you need to adapt when you have 10 different stores with lots of items for your adventure

Forum statistics

Threads
107,378
Messages
1,029,215
Members
139,474
Latest member
neotek7
Top