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.

Battle Info System

Instructions
say an enemy ghost uses skill "greater darkness" on Aluxes
, then a help window will apear when the ghost uses it and say:

Ghost used Greater Darkness on aluxes

you can customise which commands to display it on (Attack, Guard/Defend, Skill, Item, Escape) .

V1.0
Code:
#=============================================================================
#// Battle Infomation System - 1.0
#// by Euromaster
#// --------------------------------------------------------------------------
#// Prints Infomation about Enemy and Party Commands.
#//
#// History -:
#// 
#// 1.0
#// ---
#// o Inital Release
#// ==========================================================================

# === Configuration ===
SHOW_ATTACK_INFO = true
SHOW_GUARD_INFO = true
SHOW_SKILL_INFO = true
SHOW_ITEM_INFO = true
SHOW_ESCAPE_INFO = true

#/////////////////////////////////////////////////////////////////////////////
#--       !!!! DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOUR DOING !!!!      --
#////////////////////////////////////////////////////////////////////////////
class Scene_Battle
def make_basic_action_result
    # If attack
    if @active_battler.current_action.basic == 0
      # Set anaimation ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # If action battler is enemy
      if @active_battler.is_a?(Game_Enemy)
        if @active_battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # If action battler is actor
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # Set array of targeted battlers
      @target_battlers = [target]
      # Display Attack infomation
      if SHOW_ATTACK_INFO
        @help_window.set_text(@active_battler.name+" "+$data_system.words.attack+"s "+@target_battlers[0].name+".", 1)
      end
      # Apply normal attack results
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end
    # If guard
    if @active_battler.current_action.basic == 1
      # Show guard Info
      if SHOW_GUARD_INFO
        @help_window.set_text(@active_battler.name+" "+$data_system.words.guard+"s", 1)
      end
      return
    end
    # If escape
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # Show Escape Info
      if SHOW_ESCAPE_INFO
      @help_window.set_text("Party trying to Escape", 1)
      end
      # Escape
      @active_battler.escape
      return
    end
    # If doing nothing
    if @active_battler.current_action.basic == 3
      # Clear battler being forced into action
      $game_temp.forcing_battler = nil
      # Shift to step 1
      @phase4_step = 1
      return
    end
  end
  
    def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
target.skill_effect(@active_battler, @skill)
    # Show skill info
    if SHOW_SKILL_INFO
      if @target_battlers.size > 1 and @active_battler == @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@skill.name+ " on their Party.", 1)
      elsif @target_battlers.size > 1 and @active_battler != @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@skill.name+ " on "+@target_battlers[0].name+"'s Party.", 1)
      elsif @active_battler == @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@skill.name+ " on themself.", 1)
      elsif @active_battler != @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@skill.name+ " on "+@target_battlers[0].name+".", 1)
      end
    end
    end
  end
  
  def make_item_action_result
    # Get item
    @item = $data_items[@active_battler.current_action.item_id]
    # If unable to use due to items running out
    unless $game_party.item_can_use?(@item.id)
      # Shift to step 1
      @phase4_step = 1
      return
    end
    # If consumable
    if @item.consumable
      # Decrease used item by 1
      $game_party.lose_item(@item.id, 1)
    end
    # Display item name on help window
    @help_window.set_text(@item.name, 1)
    # Set animation ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # Set common event ID
    @common_event_id = @item.common_event_id
    # Decide on target
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # Set targeted battlers
    set_target_battlers(@item.scope)
    # Apply item effect
    for target in @target_battlers
      target.item_effect(@item)
      if SHOW_ITEM_INFO
      if @target_battlers.size > 1 and @active_battler == @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@item.name+ " on their Party.", 1)
      elsif @target_battlers.size > 1 and @active_battler != @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@item.name+ " on "+@target_battlers[0].name+"'s Party.", 1)
      elsif @active_battler == @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@item.name+ " on themself.", 1)
      elsif @active_battler != @target_battlers[0]
        @help_window.set_text(@active_battler.name+" uses "+@item.name+ " on "+@target_battlers[0].name+".", 1)
      end
    end
    end
  end
end
RTAB-VERSION
Code:
#=============================================================================
#// Battle Infomation System RTAB - 1.0
#// by Euromaster
#// --------------------------------------------------------------------------
#// Prints Infomation about Enemy and Party Commands.
#//
#// History -:
#// 
#// 1.0:
#// o Inital Release
#// ==========================================================================

# === Configuration ===
SHOW_ATTACK_INFO = true
SHOW_GUARD_INFO = true
SHOW_SKILL_INFO = true
SHOW_ITEM_INFO = true
SHOW_ESCAPE_INFO = true

#/////////////////////////////////////////////////////////////////////////////
#--       !!!! DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOUR DOING !!!!      --
#////////////////////////////////////////////////////////////////////////////
class Scene_Battle
  
def make_basic_action_result(battler = @active_battler)
    # In case of attack
    if battler.current_action.basic == 0
      # Setting animation ID
      battler.anime1 = battler.animation1_id
      battler.anime2 = battler.animation2_id
      # When the conduct side battler is the enemy
      if battler.is_a?(Game_Enemy)
        if battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # When the conduct side battler is the actor
      if battler.is_a?(Game_Actor)
        if battler.restriction == 3
          target = $game_party.random_target_actor
        elsif battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # Setting the arrangement of the object side battler
      battler.target = [target]
      # Display Attack infomation
      if SHOW_ATTACK_INFO
        @help_window.set_text(battler.name+" "+$data_system.words.attack+"s "+battler.target[0].name+".", 1)
      end
      # Applying the effect of normality attack
      for target in battler.target
        target.attack_effect(battler)
      end
      return
    end
    # In case of defense 
    if battler.current_action.basic == 1
      # Show guard Info
      if SHOW_GUARD_INFO
        @help_window.set_text(battler.name+" "+$data_system.words.guard+"s", 1)
      end
      return
    end
    # When escapes and is
    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
      # Show Escape Info
      if SHOW_ESCAPE_INFO
      @help_window.set_text("Party trying to Escape", 1)
      end
      return
    end
    # When what is not and is
    if battler.current_action.basic == 3
      # It moves to step 6
      battler.phase = 6
      return
    end
end
  
def make_skill_action_result(battler  = @active_battler)
    # Acquiring skill
    @skill = $data_skills[battler.current_action.skill_id]
    # Verification whether or not it is cooperation skill,
    speller = synthe?(battler)
    # If it is not forced action
    unless battler.current_action.forcing
      # When with SP and so on is cut off and it becomes not be able to use
      if speller == nil
        unless battler.skill_can_use?(@skill.id)
          # It moves to step 6
          battler.phase = 6
         return
        end
      end
    end
    # SP consumption
    temp = false
    if speller != nil
      for spell in speller
        if spell.current_action.spell_id == 0
          spell.sp -= @skill.sp_cost
        else
          spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
        end
        # Refreshing the status window
        status_refresh(spell)
      end
    else
      battler.sp -= @skill.sp_cost
      # Refreshing the status window
      status_refresh(battler)
    end
    # Setting animation ID
    battler.anime1 = @skill.animation1_id
    battler.anime2 = @skill.animation2_id
    # Setting common event ID 
    battler.event = @skill.common_event_id
    # Setting the object side battler
    set_target_battlers(@skill.scope, battler)
    # Applying the effect of skill
    for target in battler.target
      if SHOW_SKILL_INFO
      if battler.target.size > 1 and battler ==  battler.target[0]
        @help_window.set_text(battler.name+" uses "+@skill.name+ " on their Party.", 1)
      elsif battler.target.size > 1 and battler !=  battler.target[0]
        @help_window.set_text(battler.name+" uses "+@skill.name+ " on "+battler.target[0].name+"'s Party.", 1)
      elsif battler ==  battler.target[0]
        @help_window.set_text(battler.name+" uses "+@skill.name+ " on themself.", 1)
      elsif battler !=  battler.target[0]
        @help_window.set_text(battler.name+" uses "+@skill.name+ " on "+battler.target[0].name+".", 1)
      end
      end
      if speller != nil
        damage = 0
        d_result = false
        effective = false
        state_p = []
        state_m = []
        for spell in speller
          if spell.current_action.spell_id != 0
            @skill = $data_skills[spell.current_action.spell_id]
          end
          effective |= target.skill_effect(spell, @skill)
          if target.damage[spell].class != String
            d_result = true
            damage += target.damage[spell]
          elsif effective
            effect = target.damage[spell]
          end
          state_p += target.state_p[spell]
          state_m += target.state_m[spell]
          target.damage.delete(spell)
          target.state_p.delete(spell)
          target.state_m.delete(spell)
        end
        if d_result
          target.damage[battler] = damage
        elsif effective
          target.damage[battler] = effect
        else
          target.damage[battler] = 0
        end
        target.state_p[battler] = state_p
        target.state_m[battler] = state_m
      else
        target.skill_effect(battler, @skill)
      end
    end
  end
  
  def make_item_action_result(battler = @active_battler)
    # Acquiring the item
    @item = $data_items[battler.current_action.item_id]
    # When with the item and so on is cut off and it becomes not be able to use
    unless $game_party.item_can_use?(@item.id)
      # It moves to step 6
      battler.phase = 6
      return
    end
    # In case of consumable
    if @item.consumable
      # The item which you use is decreased 1
      $game_party.lose_item(@item.id, 1)
    end
    # Setting animation ID
    battler.anime1 = @item.animation1_id
    battler.anime2 = @item.animation2_id
    # Setting common event ID
    battler.event = @item.common_event_id
    # Deciding the object
    index = battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # Setting the object side battler
    set_target_battlers(@item.scope, battler)
    # Applying the effect of the item
    for target in battler.target
      if SHOW_ITEM_INFO
      if battler.target.size > 1 and battler == battler.target[0]
        @help_window.set_text(battler.name+" uses "+@item.name+ " on their Party.", 1)
      elsif battler.target.size > 1 and battler != battler.target[0]
        @help_window.set_text(battler.name+" uses "+@item.name+ " on "+battler.target[0].name+"'s Party.", 1)
      elsif battler == battler.target[0]
        @help_window.set_text(battler.name+" uses "+@item.name+ " on themself.", 1)
      elsif battler != battler.target[0]
        @help_window.set_text(battler.name+" uses "+@item.name+ " on "+battler.target[0].name+".", 1)
      end
    end
      target.item_effect(@item, battler)
    end
  end
end
p.s this overwrites a few scene battle parts so put it after any other scripts that replace any part of the class.

planned features


  • Damage/heal Info
  • Game Over Info
  • Status info
  • Add a readying system for ATB systems
  • Clear-Up code
  • Status Icon Support
  • Add support for single actors trying to escape and Enemys trying to escape
  • scrolable help window when more than one thing happerns at once
  • limitbreak support
  • Fix bugs in RTAB version
  • Add Option to print stuff to help system by events
 
say an enemy ghost uses skill "greater darkness" on Aluxes

then a help window will apear when the ghost uses it and say:

ghost used Greater Darkness on aluxes
 
A New RTAB version has been released, I hope to combine both versions of the script at a later date.
Script is in my first post.

P.S I know about the bug in the RTAB version where the info shows up normaly but then gets replaced by the usual stuff you'd see before this script is added in and the one where help window dosn't disappear when attacking.
 

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