Item useable both in menu and battle, but common event runs only in menu.

AkisaNemo

Overcaffeinated Artist
Member
Joined
Jan 28, 2017
Messages
15
Reaction score
2
First Language
Malaysia, ENG
Primarily Uses
RMVXA
I added a consumable item that can be used in both menu and battle. I made a common event that would run if the player uses it in the menu, but the common event also run during a battle.

melon menu.PNG
melon battle.PNG

I only want the common event to run in the menu and not during battle. Is there anyway I can do this? If a variable is needed to do this, I would like an explanation of it. (I'm not good with variables)
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,839
Reaction score
6,819
First Language
Indonesian
Primarily Uses
RMVXA
In your common event, put a conditional branch, set it to script, and write either
Code:
!$game_party.in_battle
or
Code:
!SceneManager.scene_is?(Scene_Battle)

Put all the events you want to run outside the battle inside the conditional branch.
 
  • Like
Reactions: BCj

AloneForLong

Seksy Catgirl
Member
Joined
Feb 15, 2020
Messages
27
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Like Theo said, you could do that, or you could also do the following:

(since I'm not sure which command_number the exit event processing command is, I will just say that it's easy to find if you go to the Game_Interpreter class and ctrl+f find the string "Exit Event Processing" and find the method name for the command)
Code:
command_[whatever number it is I cant remember] if $game_party.in_battle?

Basically it's the same thing, but it saves space and you don't need a conditional branch. It's one line of code that pretty much stops the common event if the party is in battle.
 

Latest Threads

Latest Profile Posts

I finally added my newly updated demo back to the website! It only took like 4 weeks of work...
Where is the "world-weary sigh" comment response when you need it? I need that one more than anything, but the closest we have is "wow" or "angry".
My apologies if it's out-of-place for my goyim-lookin' ass to be the one to say it, but the mythology of "Golems" is that they were created by Rabbis to protect Jewish villages from Anti-semetic attacks.
I'm moving on from RMXP finally. I've been stuck in a difficult decision between XP and MZ, and I've given up and moved on to MZ. Overall I'm really liking it, I wish tilesets were easier to setup like XP, but it's actually not that bad!
Have you ever gone full 'Ship of Theseus' while frankenspriting? Because I just did.

Forum statistics

Threads
107,775
Messages
1,032,063
Members
139,919
Latest member
cabanacatalogs
Top