Jump to content
Axio Belmot

Metronome-Like Attack?

Recommended Posts

I'm trying to make an attack like Metronome from the Pokemon series. For those who don't know, metronome takes all the moves in the game, randomly chooses one, and uses it. How would I accomplish this in an RPG?

Share this post


Link to post
Share on other sites

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  
  METRONOME_SKILL_ID            = 10      # Skill ID for Metronome
  ONLY_ACTORS_CAN_USE_METRONOME = true    # Only Actors can use this Skill? Enemies won't have their skill 
                                          # changed if they selected this specific skill ID
  
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias dp3_scn_battle_useitem_18j      use_item
  #--------------------------------------------------------------------------
  def use_item
    if @subject.current_action.item.is_a?(RPG::Skill)
      metronome_bool = @subject.current_action.item.id == METRONOME_SKILL_ID
      metronome_bool = metronome_bool && @subject.is_a?(Game_Actor) if ONLY_ACTORS_CAN_USE_METRONOME
      @subject.dp3_set_current_action(rand($data_skills.size - 1) + 1) if metronome_bool
    end
    dp3_scn_battle_useitem_18j() # Call Original Method
  end
end


#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class 
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Get Current Action
  #--------------------------------------------------------------------------
  def dp3_set_current_action( skill_id )
    @actions[0].set_skill(skill_id)
  end
end

This'll do it :)

Edited by DP3

Share this post


Link to post
Share on other sites

@Axio Belmot

 

Sorry, I misunderstood you.

 

I'm not sure what move would have access to the skills class. I will let you know if I come across the script. :P

 

Edit:

 

Okay, someone already posted a script for you! ^^

Edited by Apple3.14

Share this post


Link to post
Share on other sites

 

Ignore this ^^^ just me derping :P

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  
  METRONOME_SKILL_ID            = 10      # Skill ID for Metronome
  ONLY_ACTORS_CAN_USE_METRONOME = true    # Only Actors can use this Skill? Enemies won't have their skill 
                                          # changed if they selected this specific skill ID
  
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias dp3_scn_battle_useitem_18j      use_item
  #--------------------------------------------------------------------------
  def use_item
    if @subject.current_action.item.is_a?(RPG::Skill)
      metronome_bool = @subject.current_action.item.id == METRONOME_SKILL_ID
      metronome_bool = metronome_bool && @subject.is_a?(Game_Actor) if ONLY_ACTORS_CAN_USE_METRONOME
      @subject.dp3_set_current_action(rand($data_skills.size - 1) + 1) if metronome_bool
    end
    dp3_scn_battle_useitem_18j() # Call Original Method
  end
end


#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class 
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Get Current Action
  #--------------------------------------------------------------------------
  def dp3_set_current_action( skill_id )
    @actions[0].set_skill(skill_id)
  end
end

This'll do it :)

How do you set this up? I tried to use it, but it misses, and does nothing :/

Edited by Max Campbell

Share this post


Link to post
Share on other sites

See where it says 'METRONOME_SKILL_ID = 10'

Basically That is Skill ID 10 (at the moment anyway). In the database, skill ID 10 is 'Shock'.

Rename the Shock Skill name to Metronome and use it in battle, tada, metronome.

 

Otherwise you can edit the Skill ID to something else and have that Skill Become Metronome Instead.

Share this post


Link to post
Share on other sites

No it's not required.

Your skill can be called whatever you want it to be called, Leave everything in the script alone except the Skill ID (the number, not the name) and the true/false statement on the 'only actors can use the skill'.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×