- Joined
- Feb 28, 2012
- Messages
- 8,139
- Reaction score
- 11,034
- First Language
- English
- Primarily Uses
- RMMZ
That seems the most efficient. Make an array of the card IDs in the first place and use one random number based on the length of that array.Selection of 1 card only needs 1 random roll...store deck card IDs in an array and splice them out when drawn.
What modifications would you need help implementing?Great tutorial. I was able to get a standard poker draw going with this which will replace a plugin that has sadly been abandoned. Not to mention that what I have isn't as flexible as it relies on mouse controls which are impractical for my Xbox port. All I need now is for someone to help me with the payout logic and I should be good to go.
Also, does anyone have any ideas on how to modify this for Blackjack?
Drawing the first two cards, then drawing the next card if you choose to until you hit 21 or go over (aka hand bust). I would also need a mechanism for saving two individual cards if you hand split. And an automatic stop to the game if you draw a perfect hand at the start.What modifications would you need help implementing?
I can only speak for myself, but honestly I would approach this from the opposite end: rather than having an array to track which cards are "out" of the deck, I'd simply have an array for the deck itself, and shuffle it by randomising the elements. Then to draw, I'd just pop off the first value. So drawing 2 cards would be as simple as popping 2 values. I think this ultimately works out cleaner, because it's impossible to confuse which cards are in the deck and which aren't: if it's not in the deck, it's been drawn.Drawing the first two cards, then drawing the next card if you choose to until you hit 21 or go over (aka hand bust). I would also need a mechanism for saving two individual cards if you hand split. And an automatic stop to the game if you draw a perfect hand at the start.
As for the poker draw, how do you suggest I run the calculations?
I suspect you are also using a very old plugin that changes how errors are displayed:require(...).Window.get(...).isDevToolsOpen is not a function
isDevToolsOpen
hasn't worked in NWJS for years.Thank you very much, I will try thatI suspect you are also using a very old plugin that changes how errors are displayed:isDevToolsOpen
hasn't worked in NWJS for years.
Try turning off all plugins, save your project to apply Plugin Manager changes, and test. If that helps, then make sure all your plugins are up-to-date.
Once that is fixed, I imagine you will get a more relevant error, probably a typo in one of your Script commands.