I'm trying to run random events that only trigger once using a combination of a RNG and a switch for the event.
e.g.
Label = Random Event
Generate Random number 1-25
If random number = 1
if common event 1 = on
run common event 1
switch common event 1 off
else
Jump to Label - Random Event
If random number = 2
if common event 2 = on
run common event 2
switch common event 2 off
else
Jump to Label - Random Event
And so on...
The problem I'm running into is that the RNG can sometimes take an incredibly long time to generate a number for the event that hasn't been switched off yet.
It seems like there should be an easier and more elegant way to accomplish this
I've read about arrays but I'm not sure how to use them yet. Can these events be stored in an array? Can I select an event from the array, and then remove the event from the array once it's been activated so that it never activates again and I don't run in to this problem with the RNG?
Sorry if this is kind of an easy question, I'm still very new to coding and I don't know JavaScript or any other coding languages.
Any advice or help is appreciated.
e.g.
Label = Random Event
Generate Random number 1-25
If random number = 1
if common event 1 = on
run common event 1
switch common event 1 off
else
Jump to Label - Random Event
If random number = 2
if common event 2 = on
run common event 2
switch common event 2 off
else
Jump to Label - Random Event
And so on...
The problem I'm running into is that the RNG can sometimes take an incredibly long time to generate a number for the event that hasn't been switched off yet.
It seems like there should be an easier and more elegant way to accomplish this
I've read about arrays but I'm not sure how to use them yet. Can these events be stored in an array? Can I select an event from the array, and then remove the event from the array once it's been activated so that it never activates again and I don't run in to this problem with the RNG?
Sorry if this is kind of an easy question, I'm still very new to coding and I don't know JavaScript or any other coding languages.
Any advice or help is appreciated.