Hello!
I'd like to preface this by saying that I am a total newbie to scripting, in fact, I am making my very first plugin.
I saw someone talking about adapting the boardgame Clue to RPG Maker, and I thought that since the algorithm of Clue is quite simple, it would be a good plugin idea to practice with.
The plugin works fine, The 'hidden' cards are selected successfuly (randomly), and every suspect gets a set of three random cards from the deck. The player has to guess each of these cards and by process of elimination, guess the three hidden cards.
The problem I run into is that the script runs everytime the game is run, and only once. Meaning that when you run the game, the hidden cards and everyone's hand is selected, and it will remain the same whether you're playing a new game or a saved game. It also means that the saved game's cards change every time you re-run the game.
My first idea was to put the randomization in a plugin command, and run the command in an event that will only run once, but then the arrays containing the cards are said to not be defined. I'm not sure if the command is not running properly or what is the problem.
I tried to look it up in the docs but I couldn't find a solution,
any help will be welcome!
I'd like to preface this by saying that I am a total newbie to scripting, in fact, I am making my very first plugin.
I saw someone talking about adapting the boardgame Clue to RPG Maker, and I thought that since the algorithm of Clue is quite simple, it would be a good plugin idea to practice with.
The plugin works fine, The 'hidden' cards are selected successfuly (randomly), and every suspect gets a set of three random cards from the deck. The player has to guess each of these cards and by process of elimination, guess the three hidden cards.
The problem I run into is that the script runs everytime the game is run, and only once. Meaning that when you run the game, the hidden cards and everyone's hand is selected, and it will remain the same whether you're playing a new game or a saved game. It also means that the saved game's cards change every time you re-run the game.
My first idea was to put the randomization in a plugin command, and run the command in an event that will only run once, but then the arrays containing the cards are said to not be defined. I'm not sure if the command is not running properly or what is the problem.
I tried to look it up in the docs but I couldn't find a solution,
any help will be welcome!