Enelvon

Common Event Queues

May 20th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.11 KB | None | 0 0
  1. #═╦═════════════════════════════════════════════════════════════════════════════
  2. # ║ § Common Event Queues (v1.2) by Enelvon              [License: CC BY-SA 3.0]
  3. # ║                                                            <RMVX Ace>
  4. #═╬═════════════════════════════════════════════════════════════════════════════
  5. # ║ § Change Log
  6. #─╫─────────────────────────────────────────────────────────────────────────────
  7. # ║ v1.0 (May 20th, 2013) - Script written.
  8. # ║ v1.1 (May 20th, 2013) - Fixed something I overlooked.
  9. # ║ v1.2 (June 5th, 2014) - Fixes accidental deletion - reported by Zalerinian
  10. # ║
  11. #═╬═════════════════════════════════════════════════════════════════════════════
  12. # ║ § Summary
  13. #─╫─────────────────────────────────────────────────────────────────────────────
  14. # ║ This script allows common events to be queued and run in order.
  15. # ║
  16. #═╬═════════════════════════════════════════════════════════════════════════════
  17. # ║ § Required Scripts
  18. #─╫─────────────────────────────────────────────────────────────────────────────
  19. # ║ None.
  20. # ║
  21. #═╬═════════════════════════════════════════════════════════════════════════════
  22. # ║ § Known Incompatibilities
  23. #─╫─────────────────────────────────────────────────────────────────────────────
  24. # ║ None.
  25. # ║
  26. #═╬═════════════════════════════════════════════════════════════════════════════
  27. # ║ § Installation
  28. #─╫─────────────────────────────────────────────────────────────────────────────
  29. # ║ Put this somewhere below Materials.
  30. # ║
  31. #═╬═════════════════════════════════════════════════════════════════════════════
  32. # ║ § Configuration
  33. #─╫─────────────────────────────────────────────────────────────────────────────
  34. # ║ None.
  35. # ║
  36. #═╬═════════════════════════════════════════════════════════════════════════════
  37. # ║ § Script Calls/Other
  38. #─╫─────────────────────────────────────────────────────────────────────────────
  39. # ║ Use this to add common events to the queue:
  40. # ║
  41. # ║     $game_temp.reserve_common_event(!ID!)
  42. # ║
  43. # ║ With !ID! being the ID of the common event in question. It's essentially
  44. # ║ the same as the old method, except that it now runs as a queue so multiple
  45. # ║ common events can be run in a row without issue, such as in Tsukihime's
  46. # ║ "Equip Events" script.
  47. # ║
  48. #═╬═════════════════════════════════════════════════════════════════════════════
  49. # ║ § Aliased Methods
  50. #─╫─────────────────────────────────────────────────────────────────────────────
  51. # ║ ● class Game_Temp
  52. # ║     initialize
  53. # ║
  54. #═╬═════════════════════════════════════════════════════════════════════════════
  55. # ║ § Redefined Methods
  56. #─╫─────────────────────────────────────────────────────────────────────────────
  57. # ║ ● class Game_Temp
  58. # ║     reserve_common_event
  59. # ║     common_event_reserved?
  60. # ║
  61. #═╬═════════════════════════════════════════════════════════════════════════════
  62. # ║ ▼ class Game_Temp
  63. #═╩═════════════════════════════════════════════════════════════════════════════
  64. class Game_Temp
  65.  
  66.   alias en_ceq_gt_i initialize
  67.   def initialize
  68.     en_ceq_gt_i
  69.     @common_event_queue = []
  70.   end
  71.  
  72.   def reserve_common_event(common_event_id)
  73.     @common_event_queue << common_event_id if common_event_id > 0
  74.   end
  75.  
  76.   def common_event_reserved?
  77.     @common_event_id = @common_event_queue[0]
  78.     @common_event_id != nil
  79.   end
  80. end
  81. #═╦═════════════════════════════════════════════════════════════════════════════
  82. # ║ ▲ class Game_Temp
  83. #═╩═════════════════════════════════════════════════════════════════════════════
Advertisement
Add Comment
Please, Sign In to add comment