The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: &&&&&&&&&&&&& on October 17, 2006, 12:56:59 PM

Title: [RESOLVED] death toll
Post by: &&&&&&&&&&&&& on October 17, 2006, 12:56:59 PM
Can someoen make a scrip to show how many enemies you killed. I'm using the normal turn-based battle and I want it to say how many you killed...

Title: Re: death toll
Post by: Blizzard on October 18, 2006, 07:10:49 AM
Code: [Select]
ID = 26

class Scene_Battle

  alias main_dt_later main
  def main
    @td_flag = 0
    main_dt_later
  end
 
  alias upd_dt_later update
  def update
    @td_flag = $game_troop.enemies.size if @td_flag == 0
    upd_dt_later
  end
 
  alias battle_end_td_later battle_end
  def battle_end(result)
    battle_end_td_later(result)
    count = 0
    for enemy in $game_troop.enemies
      count += 1 unless enemy.exist?
    end
    $game_variables[ID] += @td_flag - count
  end

end

Set ID to the variable ID you want to use to store the number of killed enemies. Tell me if it works. I'm in a college lesson right now and made that out of my head, but it should work. To show the number just use in a message \v[X] where X is the same number as you set ID.
Title: Re: death toll
Post by: &&&&&&&&&&&&& on October 26, 2006, 03:31:46 AM
Thanks!