Temporarily Seal 'Item' Command based on state/switch

Joined
Aug 6, 2016
Messages
95
Reaction score
5
First Language
English
Primarily Uses
Guys, I'd like to make a state where the one who is inflicted by it can't use items... Just like Embargo in Pokemon.


So the Item command should be  grayed or disappeared temporarily, then it can reappear later when the state wore off or when a switch is activated.


I prefer using state, but if it's too difficult then using switch is okay.


Please help.. Thanks in advance.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
In Window_ActorCommand, here's the method responsible for adding the 'Item' command to the list:


  #--------------------------------------------------------------------------
  # * Add Item Command to List
  #--------------------------------------------------------------------------
  def add_item_command
    add_command(Vocab::item, :item)
  end


The add_command method can be given a third parameter (normally defaults to "true" when there is no third parameter) which specifies the condition for enabling the command.


So you could do something like add_command(Vocab::item, :item, !$game_switches[12]) to say that the Item command should only be enabled when Switch #12 is OFF (remove the exclamation point if you want it to only be enabled when Switch #12 is ON instead).  Replace the original add_command line with that.


I think that @actor is also defined within this class, so you can probably handle it with a State with something like add_command(Vocab::item, :item, !(@actor.state?(15))) to disable the command when the actor trying to use it is affected with State #15.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,574
Latest member
nikisknight
Top