Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Calling an Item menu(s) to the Battle option during battle

I have a pokemon battle system and everything works but the item part. I just need to know how to call the item menu to the battle during the actual battle.
 
Well, you need to look for the part in teh battle script where the player needs to input the action (attack, skill...ect).
Now heres a bit of the default battle script:

Code:
    if Input.trigger?(Input::C)
      # Branch by actor command window cursor position
      case @actor_command_window.index
      when 0  # attack
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        # Start enemy selection
        start_enemy_select
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 1
        # Start skill selection
        start_skill_select
      when 2  # guard
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # Go to command input for next actor
        phase3_next_actor
     [COLOR=Red] when 3  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 2
        # Start item selection
        start_item_select
      end
      return
    end[/COLOR]  end

Now, here, it tells the system what to do when 0 (attack), 1 (skill), 2 (Defend), or 3 (item) is selected. As you can see, when item is selected, it tells it to run "start_item_select" which was earlier defined as...:

Code:
def start_item_select
    # Make item window
    @item_window = Window_Item.new
    # Associate help window
    @item_window.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end

So, look for the part in your battle system where it defines what to do when something is selected and after the "item" part, replace it with the code i put just above this. this should run the item screen.

Note: If you dont know much about scripting, look for that part in your script and post it here. I don't want something to go wrong :-/

-chuchan :D
 
def pbItemMenu(index)
pbShowWindow(BLANK)
# Fade out battle scene
visiblesprites=pbFadeOutAndHide(@sprites)
item=0 # item returned from custom item screen
#
# Call custom item screen here
#
# Fade in battle scene
pbFadeInAndShow(@sprites,visiblesprites)
return item
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top