Track number of kills per map?

Hey folks!

So, I'm using @OpheliaEnigma Enemy Kill Counters plugin to track achievements and populate a bestiary. The total kills is tracked using variable #300.

Anyway, with or without that plugin, is there a simple way to use variables to track the number of kills on a per map basis?
It's been baking my noodle 🙁

At it's simplest, I need to create 20 variables for 20 maps, one per map obviously, and every time you defeat an enemy in battle that variable increases? I've thought about running a parallel process on each map, which updates a unique variable based on the difference between the total kill count prior to entering the map, and the total kill count ongoing whilst on the map, but I just can't seem to get it to work. (for example, variable #501 is set to equal v#300, the global kill counter. Then check using a parallel process when v#501=v#501+100).

I just can't seem to figure out the right steps to make this happen.

Is there something I'm missing, or is there an easier way?

Cheers!

Mat
I'll try to help you in terms of not using plugins!
I think you were on the right track with the 20 maps, and 20 variables part (1 per map).

I think it is generally easier to say "Okay you killed X enemies on Map X, and you killed Y enemies on Map Y" etc.
So that would meant to run a parallel process as you said, and with every enemy killed, make the variable count designated to that map increase by 1.

Now, it seems like you want a global thing right? A Total Enemy Kill count?
Incase I'm not mistaken, wouldn't it be easy to just add all 20 variables together, and store all of that data into another variable? (Variable #21, the Global Count).


At least, this is what I'm picturing!
I'll try to help you in terms of not using plugins!
I think you were on the right track with the 20 maps, and 20 variables part (1 per map).

I think it is generally easier to say "Okay you killed X enemies on Map X, and you killed Y enemies on Map Y" etc.
So that would meant to run a parallel process as you said, and with every enemy killed, make the variable count designated to that map increase by 1.

Now, it seems like you want a global thing right? A Total Enemy Kill count?
Incase I'm not mistaken, wouldn't it be easy to just add all 20 variables together, and store all of that data into another variable? (Variable #21, the Global Count).


At least, this is what I'm picturing!
I really appreciate the response, but it's kind of the opposite - I HAVE a global kill counter which works already, storing the kills in v#300. I'm trying to find a way to use that information (break it down or something similar) to ascertain the number of kills per map. Does that make sense?

What I can't figure out is how to track the kills on each map 🙁
I really appreciate the response, but it's kind of the opposite - I HAVE a global kill counter which works already, storing the kills in v#300. I'm trying to find a way to use that information (break it down or something similar) to ascertain the number of kills per map. Does that make sense?

What I can't figure out is how to track the kills on each map 🙁

Oooooh I see now.

Hmm, well the only problem there is that the information stored in the global variable is sort of stuck there, and you can't really break it down...(Unless maybe you try using variables to decrease some incremented value? But that's certainly going overboard).

I think your best option (in my opinion) is to go along with the idea of creating a parallel variable per map, and it increments once for every enemy killed on that particular map.
Because even while those variables are being incremented, the global variable is still incrementing as well. So you will then have all the information you seem to seek.

Example:
Condition branch, then add the variable +1.

If Enemy on map A is defeated:
{ Variable(A) +1 }

And have those separate variables for all the maps.
Oooooh I see now.

Hmm, well the only problem there is that the information stored in the global variable is sort of stuck there, and you can't really break it down...(Unless maybe you try using variables to decrease some incremented value? But that's certainly going overboard).

I think your best option (in my opinion) is to go along with the idea of creating a parallel variable per map, and it increments once for every enemy killed on that particular map.
Because even while those variables are being incremented, the global variable is still incrementing as well. So you will then have all the information you seem to seek.

Example:
Condition branch, then add the variable +1.

If Enemy on map A is defeated:
{ Variable(A) +1 }

And have those separate variables for all the maps.
Thank you again. I think you're right, that's the best way to do it. I don't suppose you have any idea how to track that data? :LZSangel:
Thank you again. I think you're right, that's the best way to do it. I don't suppose you have any idea how to track that data? :LZSangel:

Of course! We're here to help you make your game. Never feel bad about reaching out here. Someone will usually come to respond.


Hmm, well based on what you're asking for, I assume this is some sort of "View your statistics" event? Like, when players beat the game, and the game lets you know how many enemies you killed, kind of like Resident Evil 4. That's what I'm assuming at the least.


I think it all really boils down to what exactly you're doing in your game though. I mean, are you going to use this data just for stats like I assumed above? Or will you use them for conditional branches to trigger alternate endings, or even alternate dialogue/pathways? There's possibly endless ways to use data using parallel events + variable counts and conditional branches.
Of course! We're here to help you make your game. Never feel bad about reaching out here. Someone will usually come to respond.


Hmm, well based on what you're asking for, I assume this is some sort of "View your statistics" event? Like, when players beat the game, and the game lets you know how many enemies you killed, kind of like Resident Evil 4. That's what I'm assuming at the least.


I think it all really boils down to what exactly you're doing in your game though. I mean, are you going to use this data just for stats like I assumed above? Or will you use them for conditional branches to trigger alternate endings, or even alternate dialogue/pathways? There's possibly endless ways to use data using parallel events + variable counts and conditional branches.
I'm using them for an in-game challenge system (similar to achievements), and I want people to be able to unlock a trophy for clearing monsters in certain areas.

Thank you for the help 🙂
Thank you so much for using my plugin, it means a lot to me! Sorry for answering so late, but there are some things I would like to suggest. Doing this with a parallel process is a good solution and will work. However, it deteriorates the game's performance, and would not be the ideal solution, in my opinion. If it works for you and you don't have many other parallel processes, then just stick with it, however, if it is causing any problem, or someone else wishes to do this in another way, I leave here another solution.

Remember this paragraph on my plugin's description:

The plugin has only a single parameter. This parameter is to be set to a number of a variable id. This variable (let's use 100 for example porpuses) will hold the total number of enemies defeated. Then, the game variable right next to that one (in our example's case, 100 + 1) will hold the number of enemies defeated with the database id 1; the game variable equal to 100 + 2 will hold the number of enemies defeated with the database id 2; And so forth.

With this in mind, you can know how many of each individual enemy were killed. This also means that you can make separate database entries for the enemies on each map and so, know immediately how many of each enemy were killed on each map.

As an example, imagine you want to count how many enemies were killed on map 19. Let's assume, on that map, 3 enemies can be killed, a bat, a rat, and a slime.

First, let's count the bat. If the bat only shows up on map 19, awesome, we only need to get the variable responsible for tracking the kill count for that enemy throughout the whole game. But, what if the bat can also be killed on another map? Then, I suggest making a different database entry with an identical bat! By doing this, you can have map 19 only have a bat with a certain id, while another map has a bat with another id, thus, you can easily know how many bats were killed on map 19.

We do the same for the other enemies, sum the count, and that's how many enemies were killed on map 19. You can even know how many of these enemies were bats, slimes, rats, etc, and use that information to make specific achievements like: killed 9 rats in the desert!
Hi @OpheliaEnigma and thank you for getting back to me.

That's an almost ideal solution you present... I like it! For me, however, there is one small caveat: I'm using it in combination with @casper667 's plugin for the bestiary and encyclopaedia, so it would look pretty weird having multiple entries for what seem to be, to the player, identical enemies. I can hide certain encyclopaedia entries, but then it could cause confusion if, say, someone killed a 'variant' of the enemy that wasn't shown in the bestiary afterwards.

BUT THIS IS OK!

I'm going to use a version of your solution, but slightly alter the names and stats of the enemies, so they are unique to each region. I mean, every game has pallet swaps with more powerful versions of the same enemies later on, so it doesn't really hurt!

So that way, as an example, 'forest' rats could be different from 'sewer' rats.

In short, I'll have unique enemies on each set of maps where I need to count the kills.

Thank you so much for creating this wonderful plugin and thank you again for responding!
I'm really glad my solution could help you, even if with that caveat 🙂. If you have any other questions don't hesitate to ask, good luck!
This thread can now be marked as RESOLVED.

Thank you everyone!

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/track-number-of-kills-per-map.139702/