MV Rolling dice

Hey all,
I'm working on a little thing based on the Arkham Horror board game. I'm trying to implement a dice roll system (nothing graphical, RNG behind the scenes is all I want, standard 6-sided die). Basically, the game has encounters, many of which require a dice roll as a check against various stats. So for instance, if I want to do a fight check with the character I have now, his Fight is 5, so that means he can roll 5 dice to get a single success. For most encounters, one die among the 5 being rolled in the check needs to land on a 5 or 6 to be a success. This gets further complicated by Blessed and Cursed - possessing a Blessed card makes 4, 5 and 6 a successful roll, whereas cursed makes only 6 a successful roll. Other things like enemy fights and some encounters may require more than a single success roll.

So I need to make a dice roll system where the number of dice is equal to the number of one of the six stats (speed, sneak, fight, will, lore and luck) plus or minus any modifiers by other items (ex. Fight stat alone is 5, when using a pistol that adds +4 for a total of 9, but perhaps some ailment removes 2 fight for a final total of 7), then be able to roll that number of dice (or a single die that number of times) in hopes of landing a success (5 or 6 unless Blessed or Cursed).

Is anyone able to help me figure this out? I feel a lot of variables coming on...
Depends a little on how those "cards" actually apply. Are they states? An item?

Can the player be cursed and blessed at the same time? Otherwise it's just conditional branches and a basic random variable roll.
Yes, the cards from the game would all be represented by skills/items/states, I think Blessing/Curse would be treated as states as they'll remain until a removal condition (which I have not yet implemented) is met...the board game has you roll each turn to keep the blessing (discard on 1, keep on 2-6) or discard the curse (discard on 1, keep on 2-6) but I don't plan on the project being turn-based as such so I'll figure out something for that. Can't have both at once. If you're blessed and draw a curse, you simply discard the blessing without being cursed. Likewise the other way around.

How would I tie the number of rolls to the stat? Ex. Fight of 5 would require up to 5 rolls (can stop once the required number of successes have been rolled).

Here's the first example I've set up in the project (each location will have many possible events in a random pool). You enter a diner, grab a bite and find a worm in it, you have a Fight +1 check to make to keep your lunch down. Failure costs 1 stamina (HP, essentially).

So we have a Fight stat of 5, a pistol that offers +4 if used, and the +1 from the event. 6-10 rolls there depending on whether or not that pistol is used.

With no blessing and no curse, a single roll of 5 or 6 among those 6-10 dice will resolve the event successfully while no 5 or 6 among those rolls will result in losing 1 stamina.
Again depends on what your fight stat actually is. If you're using an actor stat like attack for it, you can simply put it in a variable:
1761773536973.png


And then loop the whole dice rolling for that number of times or if a success is rolled before that.
That's what I'm doing, HP = Stamina, MP = Sanity, Attack = Fight, MAT = Lore (used for spells), MDF = Will, Agility = Speed, Luck = Luck, Eva = Sneak.

Gonna skip the blessed/cursed part for now.
So I've set up a variable for the dice roll with a random 1-6 range and included success (if Dice is greater/equal to 5). How do I make it roll the correct number of times based on that Fight variable?
With a loop. once you set your variable to the amount of fight, remove 1 from it, do the rolling business, if dice > 2 break loop else if fight = 0 break loop. Then do whatever is supposed to happen on either result.

If dice > 2 "Success!"
else
You failed!
I think I'm misunderstanding something here. I have 2 separate variables, one for the fight stat, another for the rolling of a die. I have a loop set up, but I'm still not clear on how to force it to re-roll the number of times the fight stat specifies.
Can't make it easier than that...
1761780528541.png
So my event was pretty close to yours already, I made a couple adjustments and brought it in line with what you posted and it seems to be working fine. I have run into another problem that I don't think is related to the rolling of the dice.

Prior to that check, player is given an option to use an item (in this case the pistol). Doing so grants +4 to attack. This change doesn't seem to register until AFTER the event completes. I put a dialog displaying the fight variable right before the dice roll happens and it only shows 6 instead of 10. After the dice roll, I can look at the status and see my character does indeed have the additional 4 points in attack, and I can see the variable in the debug menu has updated as well, so it seems like a timing thing somewhere maybe?
Is the pistols an equipment then, or an item? I don't see anything wrong looking at it, but I also don't got a blank project laying around to test if maybe due to the menu scene it doesn't get updated immediately. I've tested it by giving the player a weapon, then equipping it via event command and that worked fine.

You can also try calling the relevant menu directly. (Scene_Inventory, equipment and so on). Not sure if that would help, but it's all I can think about, having just woken up. 🙂
The pistol is an item, there won't be any equipment in the game. Pistol calls a common event, common event adds +4 to attack. I've tried calling by calling the item menu directly as well as the main menu and accessing items from there. Whether using main menu or going direct to item menu, the same issue persists. I even tried adding a wait command after the 'Use an item?' conditional to see if that would give it a nudge, but no luck.
@SGHarlekin I was able to work around this by putting everything AFTER the item menu opens into a separate event. For some reason it seems to be timed not to add that extra stat until the whole event wraps up.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/rolling-dice.180775/