Bounty kill count script

All of the characters in my game learn there skills through different methods. One character Has to kill enemies and add to her kill count enough. Is there a script that tracks skill counts of "ONE" specific actor and then allows you to do a condition in which you can check to see if that actor has killed x amount before running an event?

So to simplify or at least attempt lol what I just said is there a script that can track one actors kill count and also allow me to create a condition in which how many kills they have achieved is checked before proceeding with an event?
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
oh ok i somehow always post in the wrong category even when i think its the correct one lol
We're considering the best way to make that easier.  Don't worry about it too much 🙂
Here:

http://forums.rpgmakerweb.com/index.php?/topic/13640-tales-of-graces-title-system
um? how does this script help me? please point out if im missing something from what im reading i dont know if this does what I needed it to do. IS that the correct link? I needed a script that tracks a specified actors kills and allows me to check number of kills as a condition before my specified event will allow them to learn a skill. 

In my game I have a man who you bring the bounty hunter to he will check your number of kills if they are at a specified number he teaches you a new skill.

Hope I was more clear that time.
Here you go.  In a new slot below materials.  Put below all other scripts.

Use Control Variables with the Script box, and say 

$game_actors[actor_id].kills - this will give you total kills (all enemies) for that actor id

$game_actors[actor_id].kills(enemy_id) - this will give you total kills of that enemy id for that actor id

$game_actors[actor_id].kills([enemy_id1, enemy_id2, enemy_id3]) - this will give you total kills of all the listed enemy ids (say, you're in an area and they're only interested in a bounty on enemies with ids 5, 7 and 13.

actor_id and enemy_id should be written without leading zeros (so 15 instead of 015).

Spoiler
class Game_Actor < Game_Battler  #--------------------------------------------------------------------------  # * Setup  #--------------------------------------------------------------------------  alias shaz_kills_game_actor_setup setup  def setup(actor_id)    shaz_kills_game_actor_setup(actor_id)    @kills = Array.new($data_enemies.size + 1, 0)  end  #--------------------------------------------------------------------------  # * Kill Count  #     id: enemy id to count  #         - when nil (not passed), gives total of all enemies killed  #         - when a single value, gives total of that enemy id killed  #         - when an array, gives total of each enemy id killed  #--------------------------------------------------------------------------  def kills(id = nil)    tot = 0    if id.nil?      tot = @kills.inject🙂+)    elsif id.is_a?(Array)      @kills.each_index { |i| tot += @kills if id.include?(i) }    else      tot = @kills[id]    end    tot  end  #--------------------------------------------------------------------------  # * Add Kill  #     id: enemy id killed  #--------------------------------------------------------------------------  def kill(id)    @kills ||= Array.new($data_enemies.size + 1, 0) # init for saved games    @kills[id] += 1  endend class Game_Enemy < Game_Battler  #--------------------------------------------------------------------------  # * Apply Effect of Skill/Item  #--------------------------------------------------------------------------  def item_apply(user, item)    was_dead = dead?    super(user, item)    user.kill(@enemy_id) if dead? && !was_dead  endend  


Um ... do you want to be able to reset it to 0 at any point so they have to start over?
hmm wow thanks shaz im not 100% sure how to use this if you could help me that would be great. So in my event i have it set up so i talk to the guy and i want him to check to see if my actor 5 has killed X amount of enemies before he will teach he a skill then afterwards he would no longer check for the old x amount he would check for the new x amount for the next skill etc. As for the "TYPE" of enemy that is irrelevant to me thats a great add on though do you or can you helpe explain how i would go about doing this?
Alright - if you want him to check for the new amount and not include the old amount, we'll need to be able to reset them.

So use this script instead (same as last, just a little more added):

Spoiler
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- alias shaz_kills_game_actor_setup setup def setup(actor_id) shaz_kills_game_actor_setup(actor_id) @kills = Array.new($data_enemies.size + 1, 0) end #-------------------------------------------------------------------------- # * Kill Count # id: enemy id to count # - when nil (not passed), gives total of all enemies killed # - when a single value, gives total of that enemy id killed # - when an array, gives total of each enemy id killed #-------------------------------------------------------------------------- def kills(id = nil) tot = 0 if id.nil? tot = @kills.inject🙂+) elsif id.is_a?(Array) @kills.each_index { |i| tot += @kills if id.include?(i) } else tot = @kills[id] end tot end #-------------------------------------------------------------------------- # * Reset Kills # id: enemy id to count # - when nil (not passed), gives resets all counts to 0 # - when a single value, resets count for that enemy to 0 # - when an array, resets count for each enemy in array #-------------------------------------------------------------------------- def reset_kills(id = nil) if id.nil? @kills = Array.new($data_enemies.size + 1, 0) elsif id.is_a?(Array) @kills.each_index { |i| @kills = 0 if id.include?(i) } else @kills[id] = 0 end end #-------------------------------------------------------------------------- # * Add Kill # id: enemy id killed #-------------------------------------------------------------------------- def kill(id) @kills ||= Array.new($data_enemies.size + 1, 0) # init for saved games @kills[id] += 1 endend class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) was_dead = dead? super(user, item) user.kill(@enemy_id) if dead? && !was_dead endend
And to use it, let's say the guy wants you to kill 10 enemies, NOT counting anything you've killed up until now. So first you have to reset all enemies, then he'll check the totals from then on. After you've killed 10 enemies, he'll ask you to kill 20 more. We'll use a self switch to control active pages for each "quest" and give you a little reward for each one.

Spoiler
Page 1No conditions

Show Text: If you kill 10 enemies, I'll give you 50 gold coinsScript: $game_actors[5].reset_killsControl Self Switches A = ONPage 2Conditioned by self switch A

Show Text: Have you killed 10 enemies yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].kills (put $game_actors[5].kills into the Script option at the bottom of Control Variables)Conditional Branch: Variable [0001: Enemies Killed] >= 10 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 50 Show Text: Say, if you're up for it, I'll give you 100 gold if you kill 20 more! $game_actors[5].reset_kills Control Self Switches B = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 10.Branch EndPage 3Conditioned by self switch B

Show Text: Have you killed 20 more enemies yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].killsConditional Branch: Variable [0001: Enemies Killed] >= 20 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 100 Control Self Switches C = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 20.Branch EndPage 4Conditioned by self switch C

Show Text: Thanks for getting rid of all those enemies.
Hopefully that's pretty easy to follow.

Now, if you wanted to do it by enemy id instead of just saying ALL enemies, you'd pass the id of the enemy into the kill functions. So let's say you can kill several types of enemies, but this guy is only bothered by spiders (enemy id 4), so will only give you gold if you kill 10, then 20 spiders. The above would then be written like this (note the only difference is that I'm calling $game_actor[5].kills and $game_actor[5].reset_kills and passing in a parameter this time). It doesn't pay any attention to how many OTHER types of enemies you've killed:

Spoiler
Page 1No conditions

Show Text: If you kill 10 spiders, I'll give you 50 gold coinsScript: $game_actors[5].reset_kills(4)Control Self Switches A = ONPage 2Conditioned by self switch A

Show Text: Have you killed 10 spiders yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].kills(4) Conditional Branch: Variable [0001: Enemies Killed] >= 10 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 50 Show Text: Say, if you're up for it, I'll give you 100 gold if you kill 20 more! $game_actors[5].reset_kills(4) Control Self Switches B = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 10.Branch EndPage 3Conditioned by self switch B

Show Text: Have you killed 20 more spiders yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].kills(4)Conditional Branch: Variable [0001: Enemies Killed] >= 20 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 100 Control Self Switches C = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 20.Branch EndPage 4Conditioned by self switch C

Show Text: Thanks for getting rid of all those spiders.
And then, if he wants you to kill spiders (enemy id 4) AND bats (enemy id 2), instead of passing in a single value, you pass in an array (note, this just requires 10 in total, not 10 spiders AND 10 bats - if that were the case, you'd have to use 2 variables and a nested conditional branch to see if they're both 10 or more):

Spoiler
Page 1No conditions

Show Text: If you kill 10 spiders and bats, I'll give you 50 gold coinsScript: $game_actors[5].reset_kills([2, 4])Control Self Switches A = ONPage 2Conditioned by self switch A

Show Text: Have you killed 10 spiders and bats yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].kills([2, 4]) Conditional Branch: Variable [0001: Enemies Killed] >= 10 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 50 Show Text: Say, if you're up for it, I'll give you 100 gold if you kill 20 more! $game_actors[5].reset_kills([2, 4]) Control Self Switches B = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 10.Branch EndPage 3Conditioned by self switch B

Show Text: Have you killed 20 more spiders and bats yet?Control Variables: [0001: Enemies Killed] = $game_actors[5].kills([2, 4])Conditional Branch: Variable [0001: Enemies Killed] >= 20 Show Text: Yes, I have. Where's my gold? Show Text: Great job! Here's your gold, as promised. Change Gold + 100 Control Self Switches C = ONElse Show Text: No, not yet. I'll keep working on it. Show Text: Come back when you've killed 20.Branch EndPage 4Conditioned by self switch C

Code:
Show Text: Thanks for getting rid of all those spiders and bats.
wow ok it makes alot of sense thanks shaz ill try it out im adding alot of event based things just finished alot of graphical edits with gimp so tired lol
sorry for the late reply.

The titles system allows actors to obtain skills, states, and parameters based on actions done in battle. What actually is important is the arbitrary records that keeps track of the actions. If you are able to call up from the arbitrary records as triggers or comparison variables, you'll have higher flexibility for the skill learning events. The problem then is how to call up the variables in the records. 
I'm going to assume this has been resolved, so This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/bounty-kill-count-script.21908/