Trying to step forward to a specific position during battle for all my battlers

Hi, trying to make battle step forward go to the middle of the screen during skill selection instead of just go forward x amount. Found these code but I don't know how to tell the code move x amount for team member 1 and move x amount for team member number 2 and so on. This code moves them forward 48 pixels from their ready position only.

Sprite_Actor.prototype.stepForward = function() {
this.startMove(-48, 0, 12);
};

I believe should be something like below but not sure what is the right code.

if (team member 1)
Sprite_Actor.prototype.stepForward = function() { this.startMove(x, y, 12); };

if(team member 2)
Sprite_Actor.prototype.stepForward = function() { this.startMove(x+48, y-48, 12); };
Well you need to use math to express where you want them to go in relation to where they currently are. If you want them to all go to the same middle of the screen position, that's pretty simple.

If they are currently standing at X, Y and you want them to go to (for example) 408, 312 then you would simply tell each battler to go to X-408, Y-312.

Thus, this.startMove(this.x-408, this.y-312, 12);
In theory your formula makes sense. But I can't seem to get it to work. Also, when it worked, each battler still moved to the wrong position. Battler one still move to x and battler 2 still move to x + 48. I must be doing something wrong.

1668682086855.png


Hi, trying to make battle step forward go to the middle of the screen during skill selection instead of just go forward x amount. Found these code but I don't know how to tell the code move x amount for team member 1 and move x amount for team member number 2 and so on. This code moves them forward 48 pixels from their ready position only.

Sprite_Actor.prototype.stepForward = function() {
this.startMove(-48, 0, 12);
};

I believe should be something like below but not sure what is the right code.

if (team member 1)
Sprite_Actor.prototype.stepForward = function() { this.startMove(x, y, 12); };

if(team member 2)
Sprite_Actor.prototype.stepForward = function() { this.startMove(x+48, y-48, 12); };
I must be doing something wrong.
Yeah, you're putting this whole thing in a script box in a troop event. That is the wrong way to implement code changes.

Copy the code into a text file, save it as a *.js file and add it as a plugin.
I did that initially and it had the same results. I then tried switching the code a bit

this.startMove(408-this.x, 312-this.y, 12);

And this time, the character moved to the right position but now my character is going front then going back then going front again in a loop. Such a strange reaction. Everyone of them will do that and then it will not proceed when fight action starts.

1668740125899.png


Yeah, you're putting this whole thing in a script box in a troop event. That is the wrong way to implement code changes.

Copy the code into a text file, save it as a *.js file and add it as a plugin.
You're correct about reversing the subtraction, it wants relative coordinates, not absolute.

I don't know why it's rubber banding like that - I don't immediately see anyplace where it's being called recursively or anything like that. Hopefully someone else will have some ideas, or I'll try to poke at it later.
@limsoonchiong what is the span set to? If it's set to moment, thats your issue. It will just keep repeating that motion. You will likely have to do what @ATT_Turan said and put it in a js as it won't work correctly otherwise.

I just tested it with a message code I have in one of my troop fights. It will just spam the message.
what is the span set to?
This is not related to a troop event - it's a plugin that's modifying the base code of MZ.

I duplicated the OP's bug on my side, but I'm not sure why it's happening - it doesn't look like the function is called recursively.
Oh sorry I didn't see that they put it into a js file it sounded like they were still using the troop events.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-step-forward-to-a-specific-position-during-battle-for-all-my-battlers.152712/