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.

Dividing actor's exp

Atoa

Member

If you not using any complex battle system, or battle end custom script, just paste this above main:
Code:
class Scene_Battle

  def start_phase5

    @phase = 5

    $game_system.me_play($game_system.battle_end_me)

    $game_system.bgm_play($game_temp.map_bgm)

    exp = 0

    gold = 0

    treasures = []

    for enemy in $game_troop.enemies

      unless enemy.hidden

        exp += enemy.exp

        gold += enemy.gold

        if rand(100) < enemy.treasure_prob

          if enemy.item_id > 0

            treasures.push($data_items[enemy.item_id])

          end

          if enemy.weapon_id > 0

            treasures.push($data_weapons[enemy.weapon_id])

          end

          if enemy.armor_id > 0

            treasures.push($data_armors[enemy.armor_id])

          end

        end

      end

    end

    treasures = treasures[0..5]

    actor_size = 0

    for actor in $game_party.actors

      actor_size += 1 unless actor.dead?

    end

    exp /= [actor_size, 1].max

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

      actor = $game_party.actors[i]

      if actor.cant_get_exp? == false

        last_level = actor.level

        actor.exp += exp

        if actor.level > last_level

          @status_window.level_up(i)

        end

      end

    end

    $game_party.gain_gold(gold)

    for item in treasures

      case item

      when RPG::Item

        $game_party.gain_item(item.id, 1)

      when RPG::Weapon

        $game_party.gain_weapon(item.id, 1)

      when RPG::Armor

        $game_party.gain_armor(item.id, 1)

      end

    end

    @result_window = Window_BattleResult.new(exp, gold, treasures)

    @phase5_wait_count = 100

  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