How to: "if condition" status effect?

BrunoDeSN

Villager
Member
Joined
Dec 1, 2019
Messages
9
Reaction score
5
First Language
PT-BR
Primarily Uses
RMMV
Hi everyone!

To try and explain what I'm planning to do:

In my game, there will be alcoholic beverages that heal MP, with a chance of a status effect that leaves the character drunk, what I wanted to do is: if the character aldready has the "drunk" status effect, there would be a small chance that this drunkeness could develop in a worse status (something like "Confusion" or "Sleep") if the player chooses (or gambles the worthiness of the MP recovery) to drink another alcoholic beverage

I've tried making it through a common event, I've managed the "if the character has the state drunk" but I got stumped at the item part, where the "if" status only considers if the party has the item, not if it was used


Can I solve it just through the engine or would I need a plugin for that?
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
646
Reaction score
278
First Language
english
Primarily Uses
RMMV
have the item apply a "target" state and run a common event
event:
set variable: RNG: random 1-100
if actor 1 is state "target"
> if actor is state "drunk"
>> if RNG <= X
>>> add state: actor 1 "sleep"
>> if RNG > Y
>>> add state: actor 1 "confusion"
> add state: actor 1 "drunk"
end
if actor 2 is state "target"
> ....
....
last line remove state: everyone "target"

change everything in bold.
"names" change to the ID of those states
X and Y are the odds of getting the additional state
if you use <=30 (less/equal than 30) and >70 (more than 70)
it would be a 40% chance to not get an additional state (RNG = 31-70)
with 60% chance of getting either sleep (RNG = 1-30 = 30%) or confusion (RNG = 71-100 = 30%)

this common event can get rather large depending on how many actors are in your game.
the "target" state can also be useful for other skills/items that trigger common events,
just make sure to always have the common events remove the target states.

want the drunk state to be added through the common event instead of the item effects here so the event knows if they were not drunk before the event.
 
Last edited:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,399
Reaction score
644
First Language
indonesian
Hi everyone!

To try and explain what I'm planning to do:

In my game, there will be alcoholic beverages that heal MP, with a chance of a status effect that leaves the character drunk, what I wanted to do is: if the character aldready has the "drunk" status effect, there would be a small chance that this drunkeness could develop in a worse status (something like "Confusion" or "Sleep") if the player chooses (or gambles the worthiness of the MP recovery) to drink another alcoholic beverage

I've tried making it through a common event, I've managed the "if the character has the state drunk" but I got stumped at the item part, where the "if" status only considers if the party has the item, not if it was used


Can I solve it just through the engine or would I need a plugin for that?
you can utilize the item formula box for that... might need to learn how to add / remove state using the formula box though...

try learning from this tutorial...
and i think you can ask too in that thread about formula...

hope this help.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
646
Reaction score
278
First Language
english
Primarily Uses
RMMV
i would recommend damage formula if it was only 1 possible state. but since wanted sleep and confusion to both be possible its easier to do with common event
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
785
Reaction score
400
First Language
German
Primarily Uses
RMMV
I think you should be able to ask about the User's Action
(and if its an item or a skill)
-> also which item or skill is used..

..here an Example with Used Skill on an User's Action:
(i didnt tested that with using items because i wasnt sure how to force an Action with using an Item in order to put the right Action in the console and find out the exact code that is used)
-but i think something similar should be possible with using Items instead of a Skill

Code:
user._actions[0]._item._itemId;
this should return the ID of the current Skill which is used in the Action from user
=> "user" should be replaced with the code for ,actor ,battler, groupmember,.. or whatever you are using

This code ask about the DataClass of the Action Item that is used:
(in my case that returns "skill" in the console f8)
=>thats because of the forced action which i used here to find that code & which uses a Skill

Code:
user._actions[0]._item._dataClass;

-also perhaps this thread can be helpfull, there is shown some code for using items,making actions ect:
Force/Simulate Item Effect/Use (on map/in main menu)

Edit
to use these codes in if conditions you could use following codes for example:

JavaScript:
user._actions[0]._item._itemId == 1;

//(will return true or false depending on if Action "skill"-ID_1 is used or not)

user._actions[0]._item._dataClass == "skill";

//(will return true or false depending on if used Action dataClass is "skill" or not)

// perhaps this might work with "item" instead of "skill" aswell..
 
Last edited:

BrunoDeSN

Villager
Member
Joined
Dec 1, 2019
Messages
9
Reaction score
5
First Language
PT-BR
Primarily Uses
RMMV
have the item apply a "target" state and run a common event
event:
set variable: RNG: random 1-100
if actor 1 is state "target"
> if actor is state "drunk"
>> if RNG <= X
>>> add state: actor 1 "sleep"
>> if RNG > Y
>>> add state: actor 1 "confusion"
> add state: actor 1 "drunk"
end
if actor 2 is state "target"
> ....
....
last line remove state: everyone "target"

change everything in bold.
"names" change to the ID of those states
X and Y are the odds of getting the additional state
if you use <=30 (less/equal than 30) and >70 (more than 70)
it would be a 40% chance to not get an additional state (RNG = 31-70)
with 60% chance of getting either sleep (RNG = 1-30 = 30%) or confusion (RNG = 71-100 = 30%)

this common event can get rather large depending on how many actors are in your game.
the "target" state can also be useful for other skills/items that trigger common events,
just make sure to always have the common events remove the target states.

want the drunk state to be added through the common event instead of the item effects here so the event knows if they were not drunk before the event.

That's perfect! You've made it better than I could ever think of hahahah I thought I would have to make an event for every instance of alcoholic item. Thank you so much!

And thanks everyone for the replies!
I'll search on these new terms to see if I can use them in other instances of the game!
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,399
Reaction score
644
First Language
indonesian
i would recommend damage formula if it was only 1 possible state. but since wanted sleep and confusion to both be possible its easier to do with common event
yeah... maybe using common event might be easier than damage formula. also adding 'target' state is a good workaround :D... the ONLY downside is IF the player have lots of actor (makin suikoden fan game for example :D:D)... that means lots of conditional brach (can be copy paste though). in that case using damage formula might be better... it's situational :D.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

I've decided to delay work on the Shadowstar Trilogy until we know more about MLP G5. And I've also decided to make "Attack on Equestria", the sequel, take place in the G5 world.
In case you're wondering, Shadowstar and the other Alicorn Guardians are immortal. They gave it up for some reason, I'm not spoiling why. But until G5 is out, I'll work on Magi in Ponyland instead.
We're Vtubers today! :D
treele.jpg
I've updated the background!
My first test playthrough of my game clocked in at 1 hour and 15 minutes. Once the opening and ending are properly implemented, I'd expect a blind playthrough to last around 2 hours.
This time introducing INDIVIDUAL terrain lights feature for upcoming MAJOR UPDATE for all of my MZ plugins.

Forum statistics

Threads
108,859
Messages
1,040,125
Members
141,305
Latest member
Windows1800s
Top