Need help figuring out a Monster count gameplay feature (VX Ace)

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
Hi all,

Running into a snag in my game since I can't exactly figure out how to program a fairly central gameplay component of my game.

The game's areas involve defeating certain monsters in each area as part of a "checklist" of sorts. Each time you kill a monster, it's recorded as part of the checklist, but only for that specific monster. Killing two Blue Slimes would only check off 1 requirement in the area, in other words.

Think of it a little like Pokemon: Once you catch a Pokemon, it's registered and counts towards your total # of caught Pokemon. The issue here is that each monster needs to count as ONE addition to the variable, and only one. You can't just catch 30 Pikachus and have your Pokedex say "caught 30." Similarly, any number of a particular defeated monster must only count as 1.

So here's the thing; I literally have no idea how to set this up. The checklist is displayed as such: (number of defeated monsters) / (total species in the area), where the number of defeated monsters is how many SPECIES you've killed, and total species is simply the overall number of how species there are to kill. One way is to use a troop event and after an enemy is defeated, raise the "species killed" by 1, then activate a switch that prevents that process from being done again for that individual monst. The issue is that this uses way too many switches which I need for quests, items, and other processes - I also have way too many monsters in my game to use this method.

I know Bestiary scripts must use a similar mechanic: Once a monster is defeated, it's registered forever and added once to the total species killed #. What methods does that use? Could it be replicated for my own needs? I suppose that's more of a scripting question, but I'm willing to accept any solution to be quite honest. I just wish there was some sort of instance variable that would only activate once during the game.

Any help is much appreciated. Thanks in advance!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
Are your monsters all on the map or do you use random encounters? Do you allow escape from battle, and if you're defeated, is it game over?

It can be done via events (if your monsters are on the map) in most cases, but how depends on the above questions.
 

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
Yes, the monsters are on the map and the battles take place all inside events. Escape from battle is allowed, game overs have been replaced with battle aborts and transfers. Sorry for not clarifying.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
So you use Battle Processing and tick the box to continue even when losing?

Hmm ... so if you kill a new monster during a battle and then escape/abort/lose the battle, you would still want it to +1, but if you escape/abort/lose before killing any monsters you obviously wouldn't want to +1.

That makes it a bit harder, and you might actually have to look at doing it in troop events or using a script.
 

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
No kidding, I stumbled upon this thread and pretty much figured it all out:
https://forums.rpgmakerweb.com/index.php?threads/intermediate-advanced-game-variables.16541/

So in this case, I'd need two variables: One that holds an array that functions like a series of switches, and another that holds the total species killed. The array is as large as the number of species in the area, i.e. the second variable. So each monster on the map is assigned a position in the array, such as [0],[1],[2] and so on. To do this, you have to pick a variable and initiate it as an array whose total slots are equal to the total number of species:

Code:
$game_variables[1] = [0, 0, 0, 0, ...]
Then, you make a conditional branch with the following script line:

Code:
$game_variables[1][x] == [0]
If the conditions are met, then the following script is executed:

Code:
$game_variables[1][x] = [1]
This way, a particular value in the array cannot be greater than one. To find the total species killed # is pretty easy; all you do is use another variable to add up each value in the first variable's array, for example:

Code:
$game_variables[9] =
$game_variables[8][0] +
$game_variables [8][1] +
$game_variables [8][2] +
$game_variables [8][3] +
$game_variables [8][4] +
$game_variables [8][5] +
$game_variables [8][6] +
$game_variables [8][7] +
$game_variables [8][8] +
$game_variables [8][9] +
$game_variables [8][10] + $game_variables [8][11]
In this case, I have 12 total species in the given area. So when each array value equals 1, variable 9 will print 12, signifying that the area's conditions have been completed. The addition part can be called with a common event, but the steps involving array checking/adding will be done inside each monster's event box. Turns out this saves me about 500+ switches I was about to use and now I only have to use two variables for each area - pretty awesome.

Leaving this here for anyone who might be wondering how to do something similar.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
The question is, where do you put that? If you put it in the battle command's "on win" result, you won't count any that you killed prior to escaping the battle. If you put it into the troop event to do it when each enemy's HP reaches 0, it won't do it for the last enemy (troop events don't run when the last enemy is killed, unless you have an extra script to allow it), so it won't work for troops that only contain one enemy, or that contain several types, if the last enemy you kill is a new type.
 

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
Hmm I didn't get that far haha. Truth be told, I'm using a ton of scripts as is, many of which alter turn order and death protocol, so that might be the hardest part yet. Using a common event on death script seems possible, but finding one that fits in my project would probably be the hardest challenge of all.

I think that sort of goes back to the bestiary mention; I wish there was a way to check if a monster has been defeated (ever, regardless of quantity). That'll be my next search I suppose.

Edit: I suppose a more bs workaround would be to negate quest/species kills if the party escapes from battle. Like some unexplained in-game lore or gameplay aspect. It's not the worst restriction out there, but I'd only turn to it if I hit another dead end here.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,050
Messages
1,018,548
Members
137,835
Latest member
yetisteven
Top