An open library of RPG Maker MZ plugins, powered by the community.

PGMZ - The Community-Driven Plugin Library for RPG Maker MZ

MZ plugins

NRP Troop Random Formation - NRP_TroopRandomFormation.js

Plugin desc : v1.091 Place enemy groups automatically and randomly.

License :
・Copyright: Retained
・Commercial Use: Allowed
・Modification: Allowed
・Redistribution: Allowed
・Details: See Download Page / In-plugin documentation

Author : Takeshi Sunagawa (http://newrpg.seesaa.net/)

Website : https://github.com/NewRPGProject/MZMV_Plugin/blob/main/NRP_TroopRandomFormation.js

Desc page : http://newrpg.seesaa.net/article/475049887.html

Download Page : https://raw.githubusercontent.com/NewRPGProject/MZMV_Plugin/main/NRP_TroopRandomFormation.js

File name : NRP_TroopRandomFormation.js

Help of plugin :

Place enemy groups automatically and randomly.
 * When the group name corresponds to the set condition,
 * enemies will be automatically placed.
 * 
 * By default, if the group name starts with a '#',
 * it will be subject to automatic placement.
 * 
 * -------------------------------------------------------------------
 * [Specification of automatic placement]
 * -------------------------------------------------------------------
 * 1. Enemies will be randomly placed within the specified range.
 * 2. Examine the coordinates on a grid-by-grid basis,
 *    and if the appropriate spacing can be secured, finalize the placement.
 * 3. If you can't get the spacing, repeat the placement over and over again.
 *    Then, pick out the best placement.
 * 4. If there is only one enemy, place it in the center.
 * 
 * Basically, it's for side view, but it's also for front view in passing.
 * 
 * For more information, please see below.
 * http://newrpg.seesaa.net/article/475049887.html
 * 
 * -------------------------------------------------------------------
 * [Terms]
 * -------------------------------------------------------------------
 * There are no restrictions.
 * Modification, redistribution freedom, commercial availability,
 * and rights indication are also optional.
 * The author is not responsible,
 * but we will respond to defects as far as possible.
 * 
 * @------------------------------------------------------------------
 * @ Plugin Parameters
 * @------------------------------------------------------------------
 * 
 * @param <Valid Condition>
 * 
 * @param condition
 * @parent <Valid Condition>
 * @type string
 * @default name.startsWith("#")
 * @desc Conditions for automatic placement. (blank: always execute.)
 * ex.: name.startsWith("#"); group name starts with #.
 * 
 * @param exclusionCondition
 * @parent <Valid Condition>
 * @type string
 * @desc The condition is that automatic placement is not executed.
 * It takes precedence over "condition".
 * 
 * @param <Formation Range>
 * 
 * @param startX
 * @text startX(left)
 * @parent <Formation Range>
 * @type string
 * @default 20
 * @desc X-coordinate to start placing the enemy.
 * 
 * @param endX
 * @text endX(right)
 * @parent <Formation Range>
 * @type string
 * @default 500
 * @desc X-coordinate to end the enemy's placement.
 * 
 * @param startHeadY
 * @text startHeadY(up)
 * @parent <Formation Range>
 * @type string
 * @default 0
 * @desc Y-coordinate at the head of the enemy's starting position.
 * This will adjust to prevent taller enemies from hiding.
 * 
 * @param startFootY
 * @text startFootY(up)
 * @parent <Formation Range>
 * @type string
 * @default 250
 * @desc Y-coordinate at the foot of the enemy's starting position.
 * 
 * @param endY
 * @text endY(down)
 * @parent <Formation Range>
 * @type string
 * @default 420
 * @desc Y-coordinate to end the enemy's placement.
 * 
 * @param gridSize
 * @parent <Formation Range>
 * @type number
 * @default 32
 * @desc The unit of coordinates for automatic placement.
 * 0 -> 32 -> 64... and so on.
 * 
 * @param addFloat
 * @parent <Formation Range>
 * @type boolean
 * @default true
 * @desc Include the float value by NRP_ShadowAndLevitate.js in the height of the enemy character.
 * 
 * @param <Enemy Sort>
 * 
 * @param sameRowBorder
 * @parent <Enemy Sort>
 * @type number
 * @default 64
 * @desc If the difference of X of each other is within the range, it is regarded as the same column and numbered.
 * 
 * @param sortBaseX
 * @parent <Enemy Sort>
 * @type select
 * @option 0:Center of image @value 0
 * @option 1:Right of image @value 1
 * @default 1
 * @desc X-coordinate to be used as a standard for sorting.
 * 
 * @param <Single Enemy Setting>
 * 
 * @param singleEnemyPosition
 * @parent <Single Enemy Setting>
 * @type select
 * @option 0:Random @value 0
 * @option 1:Specified Coordinates @value 1
 * @default 1
 * @desc How to place it when the enemy is a unit.
 * When "Specified Coordinates", the following settings are enabled.
 * 
 * @param singleEnemyX
 * @parent <Single Enemy Setting>
 * @type string
 * @default (startX + endX) / 2
 * @desc The X in the case of "Specified Coordinates".
 * The default value is the center of the placement range.
 * 
 * @param singleEnemyY
 * @parent <Single Enemy Setting>
 * @type string
 * @default ((startHeadY + startFootY) / 2 + endY) / 2 + a.height/2
 * @desc The Y in the case of "Specified Coordinates".
 * The default value is the center of the placement range.
 * 
 * @param <Algorithm>
 * 
 * @param algorithmType
 * @parent <Algorithm>
 * @type select
 * @option 0:Brute Force(recommended) @value 0
 * @option 1:Repeat Random @value 1
 * @default 0
 * @desc An algorithm that does automatic placement.
 * Basically, "0:Brute Force" is recommended.
 * 
 * @param maxTryNoForTroop
 * @parent <Algorithm>
 * @type number
 * @default 20
 * @desc The maximum number of times per troop to repeat the placement.
 * 
 * @param maxTryNoForEnemy
 * @parent <Algorithm>
 * @type number
 * @default 50
 * @desc The maximum number of times per unit to repeat the placement.
 * This is not used in the case of "Brute Force".
 * 
 * @param distanceBorder
 * @parent <Algorithm>
 * @type string
 * @default 0
 * @desc The distance evaluation value that confirms the attempt. The larger the value, the more spacing is ensured.

スポンサードリンク

-MZ plugins

Copyright© PGMZ - The Community-Driven Plugin Library for RPG Maker MZ , 2026 All Rights Reserved.