Tips & Tricks: Reoccuring event


Let's say you want the player to gain 1 gold every 10 seconds of gameplay, an extra prize for every 10th win of a battle, or simply a revamp of the random encounters with your own twist like maybe random encounter shops instead of battles.

Well, here how you can do that. I will show the example with 1 gold every 10 seconds of gameplay and explain the other methods. But do get creative. :)

  1. You are going to need the Delay Switches and Variable Plugin.
     
     
  2. On the map you want to start the loop on, you will need an initializing event. Like this crystal here.

    ◆Plugin Command:sirL_MP_All_Plugins, Set Switch Delay
    :Plugin Command:Type of Delay = 5 :Plugin Command:Delay Amount = 10 :Plugin Command:Switch = 1 :Plugin Command:Operation = true
    ◆Erase Event


    This example is using 10 Play Time Seconds to flip switch 1 to true. However, you can use Battle Count, Win Count, Escape Count, Save Count, Frame Count, Play Time Seconds, or Steps. 
      
     
  3. Now you create the common event.

    ◆Control Switches:#0001 Every 10 seconds = OFF
    ◆Text:None, None, Window, Bottom :Text:You have earned 1 gold piece due to just existing\.\^
    ◆Change Gold:+ 1
    ◆Plugin Command:sirL_MP_All_Plugins, Set Switch Delay :Plugin Command:Type of Delay = 5 :Plugin Command:Delay Amount = 10 :Plugin Command:Switch = 1 :Plugin Command:Operation = true


    As you can see the common event is on Parallel (this is to make it run faster than autorun as parallel don't need to wait for the next available time to run). But unlike just making an On switch do this, we are using the delay switch we made in the initial event. So by default, it will be off until the first 10 seconds hit, then it will be on. The first line turns off that switch so that there is no chance on multiple calls. Then the middle is rewarding the player with one 1 gold piece for existing for 10 seconds.  
      
     
  4. But the real magic is at the end, by flipping that switch to true again after another 10 Play Time Seconds. With that, it will loop back again to this function only after those 10 seconds have passed. 

Hopefully, this trick has given you some ideas. 

Leave a comment on the Plugin Generator if you have any questions or concerns