Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Enemy count can be gotten from $gameMap._enemies.length

To set a variable using script call, the code is $gameVariables.setValue(id, value) where id is the variable ID and value is the value to set it to.

eg: $gameVariables.setValue(1, $gameMap._enemies.length) will set the variable 1 to the total number of enemies.

To get the total number of living enemies, you need to filter the array:

$gameMap._enemies.filter(map_enemy => !!map_enemy._battler.isAlive()).length will give the number of enemies that are alive

(+1)

Oh, I see! All this time, I was doing script calls through Control Variables. It didn't occur to me that using a normal script call would be the answer to my problem. Thanks for the advice!

You should be able to use a script as well.

Oh, didn't know I could put all those characters in a single line through Control Variables. Sorry about that, my scripting knowledge isn't all that great.