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.

[REQ] Exp by % of damage Script.

Script Request (perhaps new, perhaps old, i dunno if there is one yet)
For RPG maker XP

Name of script: Exp by % of damage

Hey Scriptorz!!!
I am looking for a Script to enhance the battles, by not giving everyone a same amount of Exp, but Exp divided by amount of damage done.

What does it do?
It divides the exp gained per actor by the amount of damage done on the monster.
Actor 1 does 75% of the damage, And gets 75% of Exp of pre-set monster exp rate.
Actor 2 does 8% of the damage, And gets 8% of Exp of pre-set monster exp rate.
Actor 3 does 17% of the damage, And gets 17% of Exp of pre-set monster exp rate.
What scripts are in use? (in order)
* Scene_Shop. (Moghunter)
* Treasure name.(Moghunter)
* Custom game over (Winkio)
* Collapsing CMS. (Ryex)
* Foreign language (Seph)
* World map sprites. (Unknown)
* Enemy Detection System. (Gubid)
* F12 Pause. (Zeriab)
* Skill Shop (G_G)
* Tons of Addons (Blizzard)
* Blizz-ABS (Blizzard)
* Chaos Project Debug System. (Blizzard)
* Stat Distribute system (Blizzard)

Last thing, i need it to be full compatible with the Blizz-ABS V2.57 (and higher in the future)

Frequently asked question(s):
Q: How will healers lvl up if they dont do damage?
A: Not, i want it to be that only people who attack get XP, defence does not count.

Q: Will users ever want buffs?
A: I think a person wants more buffs, to increase attack power, to do more dmg, to get more XP.

Q: bump?
A: BUMP!!!!
 

Atoa

Member

This script do something like this. (don't worry about the coments on portuguese, since this script is plug and play)

Credits to RTH.
Code:
#==============================================================================

# Divisão Justa de EXP

# por Renan Tsuneo Hangai Junior

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

# Divide a experiência conforme o desempenho de cada herói 

# na batalha

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

 

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

# Game_Party

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

class Game_Party

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

  def total_hit_count

    tt = 0

    for actor in @actors

      tt += actor.hit_count

    end

    return tt

  end

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

  def clear_hit_count

    for actor in @actors

      actor.clear_hit_count

    end

  end

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

end

    

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

# Game_Actor

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

class Game_Actor < Game_Battler 

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

  attr_accessor :hit_count

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

  alias rth_divide_exp_gactor_setup setup

  alias rth_divide_exp_gactor_exp= exp=

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

  def setup(*args)

    rth_divide_exp_gactor_setup(*args)

    clear_hit_count

  end

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

  def clear_hit_count

    @hit_count = 0

  end

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

end

 

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

# Game_Enemy

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

class Game_Enemy < Game_Battler

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

  alias rth_divide_exp_genemy_attack_effect attack_effect

  alias rth_divide_exp_genemy_skill_effect skill_effect

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

  def attack_effect(attacker)

    pre_hp = @hp

    valor = rth_divide_exp_genemy_attack_effect(attacker)

    if attacker.is_a?(Game_Actor)

      attacker.hit_count += [[self.damage, 0].max, pre_hp].min if self.damage.is_a?(Numeric)

    end

    return valor

  end

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

  def skill_effect(user, skill)

    pre_hp = @hp

    valor = rth_divide_exp_genemy_skill_effect(user, skill)

    if user.is_a?(Game_Actor)

      user.hit_count += [[self.damage, 0].max, pre_hp].min if self.damage.is_a?(Numeric)

    end

    return valor

  end

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

end

 

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

# Window_BattleResult

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

class Window_BattleResult < Window_Base

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

  def initialize(exp, gold, treasures)

    @exp = exp

    @gold = gold

    @treasures = treasures

    super(160, 0, 320, @treasures.size * 32 + 64 + ($game_party.actors.size * 32))

    self.contents = Bitmap.new(width - 32, height - 32)

    self.y = 160 - height / 2

    self.back_opacity = 160

    self.visible = false

    refresh

  end

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

  def refresh

    self.contents.clear

    x = 4

    total_damage = 0

    for actor in $game_party.actors

      total_damage += actor.hit_count

    end

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

      actor = $game_party.actors[i]

      gexp = @exp.to_f * actor.hit_count.to_f / total_damage.to_f

      txt = "#{actor.name} ganhou #{gexp.ceil} "

      self.contents.font.color = normal_color

      cx = contents.text_size(txt).width

      self.contents.draw_text(x, i * 32, cx, 32, txt)

      x += cx

      self.contents.font.color = system_color

      cx = contents.text_size("EXP").width

      self.contents.draw_text(x, i * 32, cx, 32, "EXP")

      x = 4

    end

    y = ($game_party.actors.size * 32)

    self.contents.font.color = normal_color

    cx = contents.text_size(@gold.to_s).width

    self.contents.draw_text(x, y, cx, 32, @gold.to_s)

    x += cx + 4

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 128, 32, $data_system.words.gold)

    for item in @treasures

      y += 32

      draw_item_name(item, 4, y)

    end

  end

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

end

 

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

# Scene_Battle

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

class Scene_Battle

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

  alias rth_divide_exp_scbattle_main main

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

  def main

    rth_divide_exp_scbattle_main

    $game_party.clear_hit_count

  end

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

  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]

    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 += (actor.hit_count.to_f * exp.to_f / $game_party.total_hit_count.to_f).ceil

        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