How to skip target selection for skills?

Discussion in 'RGSS Script Requests' started by mucka33, Jul 12, 2019.

  1. mucka33

    mucka33 Villager Member

    Messages:
    7
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hi guys. I'm working on a concept similar to Yume Nikki where the player can change their appearance/gain new abilities by using skills from the menu. Essentially what happens is the player uses a skill from the Skills menu, that skill applies a State to them, and that State gives them abilities for its duration.

    However, because you only play as one character, it seems tedious to have to select your character every time you use a skill from the menu. What I mean is this, the target select screen:
    [​IMG]
    I've found the Scene_Skill script and there are sections that seem promising, but with my limited knowledge of RGSS, I'm not entirely sure what to move/change/remove.

    Thanks!
     
    #1
  2. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,321
    Likes Received:
    3,959
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP
    Since this can only be done using a script, I've moved this to Script Requests.
     
    #2
  3. DerVVulfman

    DerVVulfman Resident Werewolf Veteran

    Messages:
    249
    Likes Received:
    120
    First Language:
    English
    Primarily Uses:
    RMXP
    Ooookay.
    In the menu only, not in the battlesystem. Check.
    Wanting it to occur when only one member in party. Check.
    Wanting no Target Window to happen, immediately run. Check.

    This scriptette attaches an option when you choose a skill in the Skill Menu. It checks to see if you have only one member in your party, and then branches to its own 'custom' method that performs the skill without bringing up the target window. It assumes that the target is the lead hero.

    Code:
    #==============================================================================
    # ** Scene_Skill
    #------------------------------------------------------------------------------
    #  This class performs skill screen processing.
    #==============================================================================
    
    class Scene_Skill
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias update_skill_skip_targeting update_skill
      #--------------------------------------------------------------------------
      # * Frame Update (if skill window is active)
      #--------------------------------------------------------------------------
      def update_skill
        # If C button was pressed
        if Input.trigger?(Input::C)
          # Get currently selected data on the skill window
          @skill = @skill_window.skill
          # If unable to use
          if @skill == nil or not @actor.skill_can_use?(@skill.id)
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          if $game_party.actors.size == 1
            if @skill.scope >= 3
              update_skip_targeting
              return
            end
          end
        end
        # The original call
        update_skill_skip_targeting
      end
      #--------------------------------------------------------------------------
      # * Frame Update (when skill window is still active - one party member)
      #--------------------------------------------------------------------------
      def update_skip_targeting
        # Apply skill use effects to target actor
        target  = $game_party.actors[0]
        used    = target.skill_effect(@actor, @skill)
        # If skill was used
        if used
          # Play skill use SE
          $game_system.se_play(@skill.menu_se)
          # Use up SP
          @actor.sp -= @skill.sp_cost
          # Remake each window content
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          # If entire party is dead
          if $game_party.all_dead?
            # Switch to game over screen
            $scene = Scene_Gameover.new
            return
          end
          # If command event ID is valid
          if @skill.common_event_id > 0
            # Command event call reservation
            $game_temp.common_event_id = @skill.common_event_id
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        # If skill wasn't used
        unless used
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      end
    end
     
    #3
  4. mucka33

    mucka33 Villager Member

    Messages:
    7
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    That works beautifully. Thank you so much!
     
    #4

Share This Page