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.

Gaining EXP outside of battle

Okay I'm wondering how I would make some of my party member outside of battle gain EXP along with the Main Party when they win a battle. To try and clear this out, I'll explain in this format:

1. Main Party team has Member A, B and C. Member D and E are not in the team.

2. Member A, B and C wins a battle and gains EXP. Member D and E are not in the team so they do not gain EXP initially by RMXP.

What I want is Member D and E to gain EXP along with the Main Party when the battle finishes. May sound complicated to do but I'm hoping there would be an answer to this. Thank you.
 
Well there is an change EXP event command, so you should use that. In the troops tab you can make an event, make it so everyone you can have gains the xp you want to give them, also the ones who just fought. Dont use the entire party option, as only the guys who are in the party gain xp. In the enemy tab, leave the EXP option 0, so you dont gain extra xp on that.

Hopes that is clear, didnt test it however. But it should work :smoke:

~Smiff
 
This script will initialize all actors at the beginning of a game, and add EXP to all actors at the end of battle.

Paste Above Main

Code:
 

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

# ** Game_Party

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

#  This class handles the party. It includes information on amount of gold 

#  and items. Refer to "$game_party" for the instance of this class.

#  Load all actors on Scene_Title, not just the starting party. - BREW

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

 

class Game_Party

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

  # * Initial Party Setup

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

  def setup_starting_members

    @actors = []

    @reserve = []

    for i in 1..$data_actors.size

      if $data_system.party_members.include?(i)

        @actors.push($game_actors[i])

      else

        #this only forces loading of all actors in $game_actors

        @reserve.push($game_actors[i])

      end

    end

  end

end

 

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

# ** Scene_Battle (part 2)

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

#  This class performs battle screen processing.

#  All Actors get EXP, not just the active party.

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

 

class Scene_Battle

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

  # * Start After Battle Phase

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

  def start_phase5

    # Shift to phase 5

    @phase = 5

    # Play battle end ME

    $game_system.me_play($game_system.battle_end_me)

    # Return to BGM before battle started

    $game_system.bgm_play($game_temp.map_bgm)

    # Initialize EXP, amount of gold, and treasure

    exp = 0

    gold = 0

    treasures = []

    # Loop

    for enemy in $game_troop.enemies

      # If enemy is not hidden

      unless enemy.hidden

        # Add EXP and amount of gold obtained

        exp += enemy.exp

        gold += enemy.gold

        # Determine if treasure appears

        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

    # Treasure is limited to a maximum of 6 items

    treasures = treasures[0..5]

    # Obtaining EXP   ### Modified to give EXP to non-party actors too

    last_level = []

    for i in 1..($data_actors.size - 1)

      actor = $game_actors[i]

      print actor.name

      if actor.cant_get_exp? == false

        last_level[i] = actor.level

        actor.exp += exp

      end

    end

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

      actor = $game_party.actors[i]

      if actor.level > last_level[actor.id]

        @status_window.level_up(i)

      end

    end

    # Obtaining gold

    $game_party.gain_gold(gold)

    # Obtaining treasure

    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

    # Make battle result window

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

    # Set wait count

    @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