Troop member positioning

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
My project uses full screen and higher resolution than default and i'm having difficulty moving the Enemy troop members into position. I have googled around and I can only find this plugin http://www.rpgmakercentral.com/topic/36768-enemy-positions/
Which is great unless you have more than one of the same enemy in your troop.

I have also found a bunch of other people requesting a plugin that can move enemies too but it seems like they never found a solution or they did but never posted what the solution was. eg. https://forums.rpgmakerweb.com/index.php?threads/enemies-battle-positioning.51567/#post-531421

After further searching I came across this older plugin http://himeworks.com/2013/04/enemy-re-position/
This sounds like this is along the right lines but it isn't for RPG Maker MV :(

Does anyone know of a way to position enemy troop members such as the plugin above, or if there is any other solution possible?
Any information would be greatly appreciated :))
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
14,078
Reaction score
7,769
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
Thanks for that LadyBaskerville!

Sorry for the late reply! I think your Enemy Placement plugin is exactly what i need although Im a little unsure about how to set it up to what i want. For the enemy troops in my game i never have more than 5 troop members but i can have less in a troop. Would i be able to set the default X position so that it centers the members?

For example if i have 1 enemy in the troop then it is shown at the center of the screen. And if i have 5 members in the troop then they are also centered on the screen.

Thanks! :)
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
645
Reaction score
498
First Language
German
Primarily Uses
RMMV
@Beau Lamb It should be possible with some math - I think the default formula in the Default X Position parameter already does something similar, although it doesn't center the enemies. Maybe that can give you a starting point? Keep in mind that you can use troopSize, screenWidth and index as variables in your formula.

Unfortunately, I'm out of country at the moment, so I can't work on it myself, but if you haven't solved it until I come back next week, I'll try to write something up for you.

EDIT: I think something like this should work:
Code:
screenSize/2 + (index - (troopSize-1)/2) * 64
The 64 at the end is just an estimate, you might need to change it to something bigger or smaller if the enemies are too close or too far away from each other. I'm also not sure which point of the graphic is used as the origin for positioning, so if all enemies are shifted to the left or right, that would need adjusting as well. Let me know how it looks when you try it!
 
Last edited:

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
@LadyBaskerville Thanks for the quick reply! :)
I gave that a go and it looks like its almost what i need :D (Although a little off to the right and the spacing needed be way bigger so i adjusted that) Ill post a bunch of images as it might be easier to explain..

This is what that looked like.. pretty close!
Suggested.png

So i made some changes... although Im not exactly sure what im doing (I could be doing this completely wrong)
But this got me super close! I feel like i shouldn't be dividing the screen width by 4 to get what i want though..... :p

Code:
screenWidth/4 + (index - (troopSize-1)/2) * 340
That got it looking like this :)
Troop5.png

And this what it looks like for the other amount of enemies in the troop.
BattleBoardActors.jpg
Troop2.png
Troop3.png
Troop4.png

Which is perfect for troops that have 1,3,5 enemies in. But for troops that have 2,4 they are centered... which is good but i would preferably like them in the position of the red boxes that i have in the images above. Im not sure if this is possible though as its pretty specific :/

Thanks again! Sorry for the long post.
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
645
Reaction score
498
First Language
German
Primarily Uses
RMMV
Hm... Instead of dividing the screen width by 4, you could probably just substract about 1/4 of the screen width at the end of the formula. That way, you have some better control over the exact position as well, and you could easily shift everything a few pixels to the right or left, if necessary.

If you want the cards in the 2 and 4 member troops in the red boxes you marked above, they would no longer be centered exactly, but be basically in the same positions as in the troops with an uneven number of members, correct? If so, try putting Math.floor(...) around the (troopSize-1)/2 part of the formula.
 

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
That works perfectly! :D Thank you very much for the help I really appreciate it. Now I dont have to deal with the annoying standard troop positioning :)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Having lots of fun using different PS brushes to add a lil' texture to the floors and walls in my maps.
Setup a system to cull enemies that are too far from the player to matter, and to spawn new ones just outside of view. Take that lag! :LZSexcite:
That trope is alive more than ever, not so much elemental Crystal's but gathering magical objects or doing "task" to unlock this oddly specific thing is everywhere, I saw it saw it in the IT 2 remake, avengers and every season of supernatural
It's raining...in winter :")

Forum statistics

Threads
93,716
Messages
914,883
Members
123,319
Latest member
chrisred801
Top