Positioning enemies in the battle screen before battle starts

ze1

Veteran
Veteran
Joined
Apr 19, 2012
Messages
32
Reaction score
4
Primarily Uses
I'm trying to make it so that enemies X and Y positions are calculated right before the battle starts. I need this because the enemy amount and positioning are determined before the battle starts, and not by using the Troop tab in the game database.
The problem is that to position enemies, I need to know their bitmap's width and height dimensions, which I can't figure out how to do thanks to how RMMV works (with async loading and all).
So, what I want to do is something like this:
1) a battle is triggered, screen fades out
2) during the transition, the game decides which and how many enemies are going to fight (this much I can do)
3) position the enemies in the battle scene (I can't do this because I don't know the bitmap dimensions...)
4) battle scene fades in

Any idea on how to do this?

----

I also considered getting all the enemies' sprites width and height before the game started and storing that info in the $dataEnemies array, but I have a similar problem as above...

I got this function here, which tries to save the bitmap width info in the enemy data


Code:
ZNT_Scene_Boot_start = Scene_Boot.prototype.start;



Scene_Boot.prototype.start = function() {

saveWidth = function(bitmap, _i) {

$dataEnemies[_i].bitmapWidth = bitmap.width

alert(" ok " + _i + " " + $dataEnemies[_i].name + " > " + $dataEnemies[_i].bitmapWidth)

}

for (var i=0; i<$dataEnemies.length;i++){

var enemy = $dataEnemies;

if (!enemy)

continue;

var bitmap = ImageManager.loadEnemy(enemy.battlerName, 0);

bitmap.addLoadListener(saveWidth.bind(this, bitmap, i))

}



ZNT_Scene_Boot_start.call(this);

};
But the problem is that when I'm trying to test a battle from the database, the info isn't available soon enough. I need it before the Game_Troop.setup function is called, but that doesn't happen.
 
Last edited:

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

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,038
Messages
1,018,466
Members
137,821
Latest member
Capterson
Top