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.

Showing skill name in help window for ABS.

Hi guys I've been using a cool ABS lately, and wanted some help with something, I want that whenever someone casts a skill, a help window with the skill name appears on top of the screen, and disappears after a second or two.
I managed to have it show the skill name in the help window as I wanted, but I have 2 problems: one is that I can't seem t get rid of it, it either stays forever or disappears just after beeing created. ( I'm using both help_window.dispose and help_window.visible = false)
and the other problem is that after that window being shown (meaning a skill was cast)it gives me an error in scene save saying something like "no marshal_dump is defined for help_window class.
I don't know why it's making this, I've read that it means that a script is trying to save the help_window class itself, but that makes no sense, since I made the script and nowhere I told the game to save it when saving a gamefile...
this is the snippet I'm using to show the help window in battle:
Code:
 

    #@help_window = Window_Help.new

    #--------------------------------------------------------------------------

  # * Set Text

  #  text  : text string displayed in window

  #  align : alignment (0..flush left, 1..center, 2..flush right)

  #--------------------------------------------------------------------------

  #def set_text(text, align = 0)

    # If at least one part of text and alignment differ from last time

    #if text != @text or align != @align

      # Redraw text

      #self.contents.clear

      #self.contents.font.color = normal_color

      #self.contents.draw_text(4, 0, self.width - 40, 32, text, align)

     # @text = text

     # @align = align

     # @actor = nil

    #end

   # self.visible = true

  #end

    # Show skill name on help window

    #@help_window.set_text(skill.name, 1)
(ignore the #'s it's just so I can save the game without crashing it)
I hope you can help me how to properly get rid of the help window where it should AND help me fix the problem in scene save.
btw this is the script for the abs:
Code:
#===============================================================================

# FFXII - Game_Character - Attack

#-------------------------------------------------------------------------------

# Criador: RTH

#===============================================================================

 

class Game_Character

      

  #-----------------------------------------------------------------------------

  # Attacks a target

  #-----------------------------------------------------------------------------

    

  def attack(target)

    return false unless FFXII.valid_attack?(self, target)

    @animation_type = 0

    target.battler.attack_effect(self.battler)

    if target.enemy?

      target.agressivity = 1

    end

    target.setup_damage

    target.animation_id = @battler.animation2_id

    return true

  end

                

  #-----------------------------------------------------------------------------

  # Uses a skill on a target

  #-----------------------------------------------------------------------------

    

  def skill(skill, target)

    return false unless FFXII.valid_attack?(self, target)

    return false if skill.nil?

    return false if @battler.sp < skill.sp_cost

    if skill.allsp?

      @battler.sp = @battler.sp - @battler.maxsp

    else

      @battler.sp = @battler.sp - skill.sp_cost

    end

    if skill.quickening?

      quickening(skill, target)

      return

    end

    #delete from here------------------------------------------------------------- 

    #@help_window = Window_Help.new

    #--------------------------------------------------------------------------

  # * Set Text

  #  text  : text string displayed in window

  #  align : alignment (0..flush left, 1..center, 2..flush right)

  #--------------------------------------------------------------------------

  #def set_text(text, align = 0)

    # If at least one part of text and alignment differ from last time

    #if text != @text or align != @align

      # Redraw text

      #self.contents.clear

      #self.contents.font.color = normal_color

      #self.contents.draw_text(4, 0, self.width - 40, 32, text, align)

     # @text = text

     # @align = align

     # @actor = nil

    #end

   # self.visible = true

  #end

    # Show skill name on help window

    #@help_window.set_text(skill.name, 1)

    #to here

    #-------------------------------------------------------------------------

    @animation_id = skill.animation1_id

    animation = $data_animations[@animation_id]

    counter_max = 1

    if animation != nil

      counter_max = (Graphics.frame_rate * animation.frame_max / 20.0).to_i

    end

    @animation_type = 1

    @skill_id = skill.id

    @last_skill_id = skill.id

    @last_skill_target = target

    @last_skill_damage_count = counter_max

     if @last_skill_damage_count >= 0

      skill_damage(skill, target)

  end

  end

 

    def skill_damage(skill, target)

    @last_skill_id = 0

    @last_skill_target = nil

    @last_skill_damage_count = 0

    targets = [target]

    if skill.raio > 0

      if self.enemy?

        for i in 0...FFXII::MAX_ACTORS

          next if $game_party.actors[i].nil? or $game_party.actors[i].dead?

          if i == $game_player.main_actor

            actor = $game_player

          else

            actor = $game_train_actors[$game_party.actors[i].id]

          end

          next if actor == target

          if target.inside_real_raio?(actor, skill.raio)

            targets.push(actor)

          end

        end

      else

        case skill.scope

        when 1..2

          for event in $game_map.screen_events.values

            next if event.nil? or event.battler.nil? or event.battler.dead?

            next if event == target

            if skill.scope == 2

              targets.push(event)

              next

            end

            if target.inside_real_raio?(event, skill.raio)

              targets.push(event)

            end

          end

        when 3..6

          for i in 0...$game_pacty.actors.size

            next if $game_pacty.actors[i].nil?

            next unless $game_pacty.actors[i].active

            next if (skill.scope <= 4 ? $game_pacty.actors[i].dead? : (!$game_pacty.actors[i].dead?))

            actor = (i == $game_player.main_actor ? $game_player : $game_train_actors[$game_pacty.actors[i].id])

            if [4, 6].include?(skill.scope)

              targets.push($actor) unless targets.include?(actor)

              next

            end

            if target.inside_real_raio?(actor, skill.raio)

              targets.push($actor) unless targets.include?(actor)

            end

          end

        end

      end

    end

    $game_temp.in_battle = true

    animation_2 = $data_animations[skill.animation2_id]

    if animation_2.nil?

      all_animation = true

    elsif animation_2.position == 3

      all_animation = false

    else

      all_animation = true

    end

    if all_animation == false

      target.animation_id = skill.animation2_id

    end

    for t in targets

      next if t.nil?

      next if t.battler.nil?

      t.battler.skill_effect(self.battler, skill)

      if t.enemy?

        t.agressivity = 1

     end

      t.setup_damage

      t.animation_id = skill.animation2_id if all_animation

    end

     $game_temp.in_battle = false

    return true

  end

 

  #-----------------------------------------------------------------------------

  # Using quickening

  #-----------------------------------------------------------------------------

    

  def quickening(skill, target)

    targets = [target]

    if skill.raio > 0

      if self.enemy?

        for i in 0...FFXII::MAX_ACTORS

          next if $game_party.actors[i].nil? or $game_party.actors[i].dead?

          if i == $game_player.main_actor

            actor = $game_player

          else

            actor = $game_train_actors[$game_party.actors[i].id]

          end

          next if actor == target

          if target.inside_real_raio?(actor, skill.raio)

            targets.push(actor)

          end

        end

      else

        for event in $game_map.screen_events.values

          next if event.nil? or event.battler.nil? or event.battler.dead?

          next if event == target

          if target.inside_real_raio?(event, skill.raio)

            targets.push(event)

          end

        end

      end

    end

    $game_temp.quickening_player = self

    $game_temp.quickening_targets = targets

    $game_temp.quickening_skill_id = skill.id

  end

                

  #-----------------------------------------------------------------------------

  # Using item on a target

  #-----------------------------------------------------------------------------

    

  def item(item, target)

    return false unless FFXII.valid_attack?(self, target)

    return false if item.nil?

    return false if $game_party.item_number(item.id) <= 0

    $game_party.lose_item(item.id, 1)

    @animation_id = item.animation1_id

    animation = $data_animations[@animation_id]

    if animation != nil and $scene.instance_of?(Scene_Map)

      counter_max = (Graphics.frame_rate * animation.frame_max / 20.0).to_i

      for i in 0...counter_max 

        Graphics.update

        Input.update

        $scene.action_update

      end

    end

    targets = [target]

    $game_temp.in_battle = true

    for t in targets

      next if t.nil?

      t.battler.item_effect(item)

      t.setup_damage

      if t.enemy?

        t.agressivity = 1

      end

      t.animation_id = item.animation2_id

    end

    $game_temp.in_battle = false

    return true

  end

                

  #-----------------------------------------------------------------------------

  # updates damage

  #-----------------------------------------------------------------------------

 

  def setup_damage

    @damage = @battler.damage

    @critical = @battler.critical

  end

                

  #-----------------------------------------------------------------------------

  # executes the action

  #-----------------------------------------------------------------------------

 

  def make_action

    if @target.is_a?(Game_Train_Actor)

      unless $game_party.actors[$game_player.main_actor].nil?

        if @target.id == $game_party.actors[$game_player.main_actor].id

          self.target = $game_player

        end

      end

    end

    if @battler.attacking?

      attack(@target)

      self.target = nil

    elsif @battler.skilling?

      skill($data_skills[@battler.current_action.skill_id], @target)

      self.target = nil

    elsif @battler.iteming?

      item($data_items[@battler.current_action.item_id], @target)

      self.target = nil

    end

    @battler.current_action.clear

  end

                

  #-----------------------------------------------------------------------------

  # starts the attack

  #-----------------------------------------------------------------------------

 

  def start_attack(target)

    return if @battler.nil? or target.nil? or target.battler.nil?

    @battler.current_action.kind = 0

    @battler.current_action.basic = 0

    @battler.current_action.setup_action_speed

    self.target = target

  end

  

  #-----------------------------------------------------------------------------

  # starts the skill

  #-----------------------------------------------------------------------------

 

  def start_skill(skill_id, target)

    return if @battler.nil? or target.nil? or target.battler.nil?

    $game_temp.in_battle = true

    unless @battler.skill_can_use?(skill_id)

      $game_temp.in_battle = false

      return 

    end

    $game_temp.in_battle = false

    @battler.current_action.kind = 1

    @battler.current_action.skill_id = skill_id

    @battler.current_action.basic = 0

    @battler.current_action.setup_action_speed

    self.target = target

  end

                

  #-----------------------------------------------------------------------------

  # starts the item

  #-----------------------------------------------------------------------------

 

  def start_item(item_id, target)

    return if @battler.nil? or target.nil? or target.battler.nil?

    @battler.current_action.kind = 2

    @battler.current_action.item_id = item_id

    @battler.current_action.basic = 0

    @battler.current_action.setup_action_speed

    self.target = target

  end

                

  #-----------------------------------------------------------------------------

  # cleans action

  #-----------------------------------------------------------------------------

 

  def clear_action

   self.target = nil

    return if @battler.nil?

    @battler.current_action.clear

  end

  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