[XP] Individual Enemy Kill Counter for Blizz ABS

Started by nathmatt, November 03, 2010, 12:21:26 pm

Previous topic - Next topic

nathmatt

November 03, 2010, 12:21:26 pm Last Edit: June 20, 2011, 08:36:43 pm by nathmatt
Individual Enemy Kill Counter for Blizz ABS
Authors: Nathmatt
Version: 2.0
Type: Enemy Counter
Key Term: Blizz-ABS Plugin



Introduction

keeps individual counters for each enemy


Features


  • Can create more than 1 counter for the same enemy
  • Keeps as many counts as you want
  • Keeps track of all enemies killed



Screenshots

no screen shot


Demo

No Demo


Script

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Individual Enemy Kill Counter for Blizz ABS by Nathmatt
# Version: 2.0
# Type: Enemy Counter
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Script Calls:
#
#   $game_player.start_counter(id,enemy_id)   creates a new counter for enemy_id
#
#   $game_player.get_counter(id)              gets the ammount on that counter
#
#   $game_player.stop_counter(id)             clears and stops id's counts
#
#   $game_player.total_killed                 returns the total amount of enemies
#                                             killed
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Player < Map_Actor
 
 attr_accessor :counters,:total_killed
 
 alias counter_initialize initialize
 def initialize
   counter_initialize
   @counters = {}
   @total_killed = 0
 end
 
 def start_counter(id,enemy_id)
   @counters[id] = Enemy_Counter.new(enemy_id)
 end
 
 def get_counter(id)
   return if !@counters[id].is_a?(Enemy_Counter)
   return @counters[id].count
 end
 
 def stop_counter(id)
   @counters[id] = nil
 end
 
end
   
class Enemy_Counter
 
 attr_accessor :count
 attr_reader   :enemy
 
 def initialize(enemy)
   @enemy = enemy
   @count = 0
 end

end

class BlizzABS::Processor
 
 alias counter_remove_enemy remove_enemy
 def remove_enemy(enemy)
   counter_remove_enemy(enemy)
   return if enemy.execute || enemy.erased || enemy.body != nil
   check_counter(enemy.real_enemy.id)
   $game_player.total_killed += 1
 end
 
 def check_counter(enemy_id)
   $game_player.counters.each_value{|counter|
   counter.count += 1 if counter.enemy == enemy_id}
 end

end

class Map_Enemy < Map_Battler
 
 def real_enemy
   return @enemy
 end
 
end



RMX-OS Plugin

Spoiler: ShowHide
if !defined?(RMXOS) || RMXOS::VERSION < 1.09
 raise 'ERROR: The "Blizz-ABS Controller" requires RMX-OS 1.09 or higher.'
end
module RMXOS
 module Options
   SAVE_DATA[Game_Player].push('@counters')
   SAVE_DATA[Game_Player].push('@total_killed')
 end
end



Instructions

in the script



Compatibility

no compatibility issues known


Credits and Thanks


  • Nathmatt



Author's Notes

if you have any issues or suggestions post here

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


keyonne

Quick question, as I'm still learning basic scripting. What code should I use to activate a switch when a certain monster ID reaches a desired number?
$game_player.enemy[id] should be used somewhere I'm assuming. I apologize for my noobishness, but I'm more of a designer and artist than scripter. :/

Wizered67

Do a conditional branch

if $game_player.enemy[id] == X
Turn on switch.

nathmatt

first you want to turn the enemies counter on using this
$game_player.enemy_trigger[id] = true
then in a condition branch you could turn on a switch or just use a condition script as
$game_player.enemy[id] >= x
x being the amount needed to kill after so you will want to use
$game_player.enemy_reset(id)
to reset it back to 0 and
$game_player.enemy_trigger[id] = false
to turn it off so that it will be ready for the next quest that needs you to kill it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Wizered67


nathmatt

November 08, 2010, 07:30:25 pm #5 Last Edit: November 08, 2010, 07:33:41 pm by nathmatt
i don't see y it wouldn't but it would need the save data configured

edit: just use the newly added plug-in place it below this script 
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Dweller

I was looking to a script like this one. Using now and working fine. Thanks nathmatt (lvl up)
Dwellercoc
Spoiler: ShowHide

Ryex

December 01, 2010, 06:14:34 pm #7 Last Edit: December 01, 2010, 06:17:42 pm by Ryexander
why the hell was this never moved? *moved to database after adding the [XP] tag to the title*
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

nathmatt

The xp tag was probably the reason it didn't get moved
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

pssh, it's not like it take more than ten seconds to add the tag, lazy other mods.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Nathmatt's been doing that a couple of times so I just decided not to fix his post this one time as a lesson. :P
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

i have to admit i didn't even notice it wasn't in the database until you mentioned it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


WhiteRose

Quote from: Ryex on December 02, 2010, 04:34:21 am
pssh, it's not like it take more than ten seconds to add the tag, lazy other mods.


I plead innocent; I'm not a mod over this section.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Dweller

I´m having a problem using this script on my game. After killing an enemy if I use a Custom Event Triggers the $game_player.enemy[id] variable count +14 enemies killed instead +1. (I tested too on a new Blizz-ABS game with only Individual Enemy Kill Counter for Blizz ABS script and got the same error)
Dwellercoc
Spoiler: ShowHide

nathmatt

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Dweller

Dwellercoc
Spoiler: ShowHide

nathmatt

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Dweller

Dwellercoc
Spoiler: ShowHide