public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Setting a Variable to a "random" integer w. a Variable as the maximum

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Setting a Variable to a "random" integer w. a Variable as the maximum
  • Original author: Robert-Developer_of_Bis
  • Original date: August 7, 2017
  • Source thread: https://forums.rpgmakerweb.com/threads/setting-a-variable-to-a-random-integer-w-a-variable-as-the-maximum.82457/
  • Source forum path: Game Development Engines > Legacy Engine Support > RPG Maker VXAce Support

Summary

Edit 3: Updated Image Hello! Normally, I like to keep my open threads to one at a time, but my one in Script Support is taking far too long. Sorry! I'm designing a survival game with mechanisms to prevent players from screwing around for too long. The longer the game plays, the higher "difficulty" gets, until the game is downright unfair. Part of this is the current area I'm designing, wherein NPCs leave after a certain period of time. The game reads the number of NPCs remaining as a variable,...

Archived First Post

Edit 3: Updated Image
Hello! Normally, I like to keep my open threads to one at a time, but my one in Script Support is taking far too long. Sorry!

I'm designing a survival game with mechanisms to prevent players from screwing around for too long. The longer the game plays, the higher "difficulty" gets, until the game is downright unfair. Part of this is the current area I'm designing, wherein NPCs leave after a certain period of time. The game reads the number of NPCs remaining as a variable, and uses that to determine with a coin flip which group of NPCs is subtracted from.

To put it more simply:
You have, for example, Group A with 10 members, and Group B with 5. The game tracks these both as variables. It adds them as 15, and chooses a random number from 1-15. If the number picked is 10 or lower, Group A loses a member, and vise versa. I want the maximum value to always reflect the number of remaining NPCs.

The problem is that this doesn't seem possible. When you set a variable to a random number, it seems you can only choose a whole number (I'm aware you can use letters, and there's even arrays, but I'm not that advanced yet.), rather than equating the minimum or maximum to another variable. I've thought of several ways around this, but all so far would ruin the accuracy of the proposed way. The only other way I see to do it is to create a Conditional for every possible maximum value, which would be extremely tedious, and difficult to adjust. Does anyone know a way around this restriction?

Protected download

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

Referenced Images / Attachments

Random Variable Maximum.png
Random Variable Maximum.png
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#vxace-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar