Positioning enemies in the battle screen before battle starts

Status
Not open for further replies.

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[i];
        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
Code:
Game_Troop.setup
function is called, but that doesn't happen.
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,003
Reaction score
4,743
First Language
Dutch
Primarily Uses
RMXP

@ze1 Next time just report your post for it to be moved instead of opening a duplicate thread. I'm closing this one.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

My app store submission for Knight Bewitched 2 got rejected - I forgot that Google's not as fond of scantily clad girls as Steam is. I'll have to replace my cover art...
I have just restored the Pelican Town Community Center in Stardew Valley. Somehow I feel like I've completed a rite of passage as a gamer.
Just a heads-up that Slip into Ruby and Jump into Javascript might be a bit slow for now while I'm on the team porting the YEP plugins to VisuStella's MZ suite.
So I managed to build a teleport skill. You can see the progression in the development topic
https://forums.rpgmakerweb.com/index.php?threads/in-dev-multi-hit-target-selection.125049/

Here's how it looks:


But the real question is, can I pull off FF8?

I love these little slime battlers. Really wish I could find more animated ones :'(

Forum statistics

Threads
100,630
Messages
977,963
Members
132,249
Latest member
gothsorrowsuffer
Top