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

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

MZ plugins

MNKR Hz Random List MZ - MNKR_HzRandomListMZ.js

Plugin desc : You can create a random list of values without duplicates.

License : MIT License

Author : munokura

Website : http://x.com/munokura

Desc page : https://raw.githubusercontent.com/munokura/MNKR-MZ-plugins/master/MNKR_HzRandomListMZ.js

File name : MNKR_HzRandomListMZ.js

Help of plugin :

@target MZ
@url https://raw.githubusercontent.com/munokura/MNKR-MZ-plugins/master/MNKR_HzRandomListMZ.js
@plugindesc You can create a random list of values without duplicates.
@author munokura
@license MIT License

@help
You can create unique random values within a specific integer range and
retrieve them one by one.
For example, if you create random values from 1 to 6,
you can retrieve values from 1 to 6 in a random order without any duplicates.
This can be used for things like lotteries at night stalls, where you’ll
eventually win if you keep drawing (as long as the vendor isn’t cheating),
or when you want to use random values but want to avoid duplicate values.
* The state of the random values is saved to a save file.

Plugin Command:
hzrandomCreate id min max loop
# Creates a random number list with ID [id] from min to max (including max).
# The loop setting is optional. (1: LOOP ON; otherwise: LOOP OFF)

hzrandomNext id varNo
# Retrieves the next element from the random number list with ID [id] and sets it to variable [varNo].
# When all elements of the random number list have been retrieved,
# If LOOP ON, restarts from the first element.
# If LOOP OFF, shuffles the random number list.

hzrandomShuffle id
# Shuffle the random number list for ID [id].

Usage example)
hzrandomCreate 1 1 3 false
-> Create a random number list (ID=1) from 1 to 3 (LOOP OFF)
Example) [3, 1, 2]

hzrandomNext 1 1
-> Get the next element of the random number list (3 in the above example) and
assign it to variable 1
hzrandomNext 1 1

-> Get the next element of the random number list (1 in the above example) and
assign it to variable 1
hzrandomNext 1 1

-> Get the next element of the random number list (2 in the above example) and
assign it to variable 1
hzrandomNext 1 1

-> Now that all elements of the random number list have been obtained, shuffle
the random number list.
Example) [2, 1, 3]
Get the next element of the random number list (2 in the above example) and
assign it to variable 1

hzrandomNext 1 1
-> Get the next element in the random number list (1 in the example above) and
assign it to variable 1.

hzrandomShuffle 1
-> Shuffle the random number list.
Example: [1, 3, 2]

hzrandomNext 1 1
-> Get the next element in the random number list (1 in the example above) and
assign it to variable 1.

# Contact Information
This is a plugin originally created for RPG Maker MV that has been adapted for
MZ.
Please contact the modifier for any inquiries.

# Terms of Use
MIT License.
http://opensource.org/licenses/mit-license.php
You may modify and redistribute this without permission, and there are no
restrictions on its use (commercial, 18+, etc.).

@command hzrandomCreate
@text Create a random number list
@desc Create a random number list.
@arg id
@text Random Number List ID
@desc Specify the ID that manages the random number list.
@type Number
@default 1
@arg min
@text Minimum
@desc Specifies the minimum value in the random number list.
@type Number
@default 1
@arg max
@text Maximum
@desc Specifies the maximum value in the random number list.
@type Number
@default 3
@arg loop
@text loop
@desc After the entire list of random numbers has been drawn, start over.
@type boolean
@on Loop
@off Don’t loop
@default false

@command hzrandomNext
@text Get random number
@desc Get a random number from a list and assign it to a variable.
@arg id
@text Random Number List ID
@desc Specify the ID that manages the random number list.
@type Number
@default 1
@arg varNo
@text Variable ID
@desc Specify the variable to which the subtracted value will be assigned.
@type variable
@default 0

@command hzrandomShuffle
@text shuffle
@desc Shuffles a list of random numbers.
@arg id
@text Random Number List ID
@desc Specify the ID that manages the random number list.
@type Number
@default 1

スポンサードリンク

-MZ plugins

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