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.

Having problems

Can someone fix this please?

Code:
    $game_battler.exp += $game_troop.enemies[0].exp
    
 $game_battler.actor_in_battle.push($game_party.actors[0].ident)

    $game_battler.make_level_enemy($game_battler.lv_poke_selv)

Here is the whole code just incase :):


Code:
==============================================================================
# â–  Scene_Battle 
#------------------------------------------------------------------------------

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  def main    
    
    #Variavel que guarda o party
    @map_party = []
    
    #Metodo para retirar os personagens do party e deixar so o primeiro
    make_party
    
    #Determina qual foi a ultima skill usada
    @last_skill = 0
    
    #Determina se o inimigo desmaiou
    @inimigo_desmaia = false
    
    #Determina se o personagem desmaiou
    @actor_desmaia = false
    
    #Determina o fundo do menu de batalha
    @background=Sprite.new
    @background.bitmap=RPG::Cache.picture("Batalha/Fundo_Batalha")
    @background.z = 3
    
    #Variavel que determina se esta em batalha
    $game_temp.in_battle = true
    
    #Variavel que determina em que turno esta na batalha
    $game_temp.battle_turn = 0
    
    #
    $game_temp.battle_event_flags.clear
    
    #Determina se a batalha pode ser abortada
    $game_temp.battle_abort = false
    
    #Determina se a batalha esta na faze principal
    $game_temp.battle_main_phase = false
    
    #Determina o nome da batteback
    $game_temp.battleback_name = $game_map.battleback_name
    
    #Determina se o ator esta forcado a executar uma acao
    $game_temp.forcing_battler = nil
    
    
    $game_system.battle_interpreter.setup(nil, 0)
    
    #Determina o id daturma de inimigos
    @troop_id = $game_temp.battle_troop_id
    
    #Coloca os inimigos em batalha
    $game_troop.setup(@troop_id)    
    
    #Adiciona a exp do inimigo a variavel
    $game_Battler.exp += $game_troop.enemies[0].exp
    
    #Adiciona o ident do actor ao contados de exp
    $game_Battler.actor_in_battle.push($game_party.actors[0].ident)

    #Determina o level dos pokemons na batalha
    $game_Battler.make_level_enemy($game_batalha.lv_poke_selv)

    #Comandos de batalha
    s1 = ""
    s2 = ""
    s3 = ""
    s4 = ""    
    
    #Chama a janela de comandos e determina suas propriedades
    @actor_command_window = Window_Command_Battle.new([s1, s2, s3, s4])
    @actor_command_window.x = 320 - 16
    @actor_command_window.y = 336 - 14
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    
    #Chama a janela de status dos personagens e determina suas propriedades
    @status_window = Window_ActorStatus.new
    @status_window.x = 310
    @status_window.y = 205
    @status_window.visible = false
    
    #Chama a janela de status dos inimigos e determina suas propriedades
    @status_enemy_window = Window_EnemyStatus.new($game_troop.enemies[0])
    @status_enemy_window.visible = false
    
    #Chama a janela de mensagens
    @message_window = Window_Message.new
    
    #Chama a janela de texto (ao lado da de comandos)
    @window_text = Window_Set_Text.new
    
    #Coloca uma picture como fundo de batalha
    @picture1 = Sprite.new
    @picture1.bitmap = RPG::Cache.battleback($game_temp.battleback_name + "_F")
    @picture1.z = 0
    
    #Cria os sprites da batalha (inimigos, personagens, battleback)
    @spriteset = Spriteset_Battle.new
    
    #Coloca o viewport dos inimigos e battleback todo a esquerda
    @spriteset.viewport1.ox = 640
    
    #Variavel que determina se a introducao terminou
    @finish_intro = false
    
    #Contador de loops da batalha
    @wait_count = 0
    
    #Trnsicao da batalha
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end      
    
    #Chama a animacao de inicio da batalha
    inicializacao
    
    #Inicia a fase 1
    start_phase1
    
    #Loop de acontecimentos da batalha
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    
    #Fim da batalha (retirando as janelas e atualizando o mapa)
    $game_map.refresh
    Graphics.freeze
    #@teste.dispose
    @actor_command_window.dispose
    @status_window.dispose
    @status_enemy_window.dispose
    @message_window.dispose
    @background.dispose
    @window_text.dispose
    if @picture1 != nil
      @picture1.dispose
    end   
    if @picture2 != nil
      @picture2.dispose
    end
    if @skill_window != nil
      @skill_window.dispose
      @skill_status.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @troca_party != nil
      @troca_party.dispose
    end    
    @spriteset.dispose
    
    #Se oscene for o titulo
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    
    #Se o scene for o battle test e nao for o game over
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  def make_party
    if $game_party.actors.size > 1
      for i in 1 ... $game_party.actors.size
        @map_party.push( $game_party.actors[i].id )
      end
      for i in @map_party
        $game_party.remove_actor(i)
      end 
    end
  end
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  def judge
    if $game_party.actors[0].hp == 0 and @map_party.size > 0
      @actor_desmaia = true
      @status_window.visible = false
      loop do
        Graphics.update
        @spriteset.update
        Input.update
        @window_text.clear
        text = $game_party.actors[0].name + " Fainted"
        @window_text.set_text(20, 20, text, 0)
        if Input.trigger?(Input::C)
          break
        end
      end  
      make_party_select(true)
    end
    
    if $game_troop.enemies[0].hp == 0
      @inimigo_desmaia = true
      @status_enemy_window.visible = false
      loop do
        Graphics.update
        @spriteset.update
        Input.update
        @window_text.clear
        text = $game_troop.enemies[0].name + " Fainted"
        @window_text.set_text(20, 20, text, 0)
        if Input.trigger?(Input::C)
          break
        end
      end      
    end
    
=begin
    if $game_party.all_dead? or $game_party.actors.size == 0
      if $game_temp.battle_can_lose
        $game_system.bgm_play($game_temp.map_bgm)
        battle_end(2)
        return true
      end
      return false
    end
=end
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    start_phase5
    return true
  end
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  def battle_end(result)
    $game_temp.in_battle = false
    $game_party.clear_actions
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    $game_troop.enemies.clear
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
    $scene = Scene_Map.new
    $game_batalha.clear
  end
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  def setup_battle_event
    if $game_system.battle_interpreter.running?
      return
    end
    for index in 0...$data_troops[@troop_id].pages.size
      page = $data_troops[@troop_id].pages[index]
      c = page.condition
      unless c.turn_valid or c.enemy_valid or
             c.actor_valid or c.switch_valid
        next
      end
      if $game_temp.battle_event_flags[index]
        next
      end
      if c.turn_valid
        n = $game_temp.battle_turn
        a = c.turn_a
        b = c.turn_b
        if (b == 0 and n != a) or
           (b > 0 and (n < 1 or n < a or n % b != a % b))
          next
        end
      end
      if c.enemy_valid
        enemy = $game_troop.enemies[c.enemy_index]
        if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
          next
        end
      end
      if c.actor_valid
        actor = $game_actors[c.actor_id]
        if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
          next
        end
      end
      if c.switch_valid
        if $game_switches[c.switch_id] == false
          next
        end
      end
      $game_system.battle_interpreter.setup(page.list, 0)
      if page.span <= 1
        $game_temp.battle_event_flags[index] = true
      end
      return
    end
  end

  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------
  
  def update
    if $game_system.battle_interpreter.running?
      $game_system.battle_interpreter.update
      if $game_temp.forcing_battler == nil
        unless $game_system.battle_interpreter.running?
          unless judge
            setup_battle_event
          end
        end
        if @phase != 5
          @status_window.refresh
          @status_enemy_window.refresh
        end
      end
    end
    $game_system.update
    $game_screen.update
    if $game_system.timer_working and $game_system.timer == 0
      $game_temp.battle_abort = true
    end
    if @skill_window != nil and @skill_window.visible
      @skill_window.refresh
      @skill_status.refresh(@active_battler, @skill_window.skill, @skill_window.index)
    end
    if @actor_command_window != nil and @actor_command_window.visible
      @actor_command_window.update
      @actor_command_window.refresh
    end
    if @troca_party != nil and @troca_party.active
      @troca_party.update_troca_party
      @troca_party.refresh
    elsif @troca_party != nil and @troca_party.visible
      @troca_party.refresh
    end
    if @sub_troca_party != nil and @sub_troca_party.active
      @sub_troca_party.update
      @sub_troca_party.refresh
    end    
    @message_window.update  
    @spriteset.viewport2.visible = true
    @spriteset.update
    if !@inimigo_desmaia      
      @status_enemy_window.visible = true
    end 
    if !@actor_desmaia
      @status_window.visible = true
    end    
    if $game_temp.transition_processing
      $game_temp.transition_processing = false
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    if $game_temp.message_window_showing
      return
    end
    if @spriteset.effect?
      return
    end
    if $game_temp.gameover
      $scene = Scene_Gameover.new
      return
    end
    if $game_temp.to_title
      $scene = Scene_Title.new
      return
    end
    if $game_temp.battle_abort
      $game_system.bgm_play($game_temp.map_bgm)
      battle_end(1)
      return
    end
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    case @phase
    when 1
      update_phase1
    when 2
      update_phase2
    when 3
      update_phase3
    when 4 
      update_phase4
    when 5 
      update_phase5
    end
  end
end



Yup if someone can help please!
 

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