• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Eventing Question] Defining a Mining Game Randomly

I also want to make it so that way the Mining Game events generates randomly around the map on specific tiles in my games. If anyone can help, so plz do so.
 
You can get it doing the following:

  • Create a Mining Game event with two pages. First page must have a Local switch conditional, for instance Self Switch "A". In that page, the event contains the Mining Game and switch on a Self Switch "B", when mining game finishes. The second page is empty and has a Self Switch Conditional "B".
  • Copy that event and put on over tiles where you desire.
  • Create another Event that fires automatically. In that event, create a script to declare an array variable where it contains all Event_Ids of mining game events. Then, use a rand function to generate N random array indexes, and use these indexes to access the array to extract event id. Finally, activate self switch of the event id got randomly.

    Sample:
    Code:
    nMax = 7;
    listEventIds = [ 8, 12, 13, 14, 20, 30, 31] # Mining game's Event IDs
    nEvent = 0;
    
    loop do
    [INDENT]randomIndex = rand(nMax);[/INDENT][INDENT]randomEventId = listEventIds[randomIndex]; # Got random event id, e.g. 12![/INDENT][INDENT]pbSetSelfSwitch(randomEventId,"A",true); # Event id 12 now has Self Switch "A" enabled[/INDENT][INDENT]nEvent += 1;[/INDENT][INDENT]break if nEvent == nMax[/INDENT]end
    pbSetEventTime

    The event wihch fires automatically, must trigger only once (in a day, every 6 hours, etc.). With pbSetEventTime, this event will only execute once time.
  • Create an empty second page with Self Switch conditional "A".
  • Remember to disable this pbSetEventTime with a third page. That 3rd page must have enabled Self Switch conditional "A". In addition, this page will disable all Self Switches (as "A" Self Switch as "B" ones) of all Event Id (no matter if the event was hidden). Turn Self Switch "A" off and execute setTempSwitchOn("A").
 
The event wihch fires automatically, must trigger only once (in a day, every 6 hours, etc.). With pbSetEventTime, this event will only execute once time.

Sorry for the late thanks and question, but what happens if there are no more events with self switch "a" on? Is another script required to check?
 
Sorry for the late thanks and question, but what happens if there are no more events with self switch "a" on? Is another script required to check?

In this case, there are no more events available until next six hours, twelve hours, a day... Depends on you. If you don't wait until that, you can use a variable which stores how many active events are left, instead of using a period of time. When this counter it's zero, that event will be actived again and will execute another script. Thus, the event will turn off all mining tile events' self-switches. Then, some events will be turn on randomly! Remember to substract this counter by one in every mining tile event. Hope this help you! Cheers!
 
Last edited:
In this case, there are no more events available until next six hours, twelve hours, a day... Depends on you. If you don't wait until that, you can use a variable which stores how many active events are left, instead of using a period of time. When this counter it's zero, that event will be actived again and will execute another script. Thus, the event will turn off all mining tile events' self-switches. Then, some events will be turn on randomly! Remember to substract this counter by one in every mining tile event. Hope this help you! Cheers!

Thanks a lot, very much appreciated!
 
Back
Top