-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathEvent Queues.rb
111 lines (101 loc) · 3.93 KB
/
Event Queues.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#===============================================================================
# TheoAllen - Event Queues (Formerly named "Event Trigger There")
# Version : 1.0
# Contact : Discord @ Theo#3034
#===============================================================================
($imported ||= {})[:Theo_EventTriggerThere] = true
#===============================================================================
# Change Logs:
# ------------------------------------------------------------------------------
# 2019.01.21 - Translated
# 2013.11.23 - Finished
#===============================================================================
=begin
==================
*) Introduction :
------------------
This script will queue an event once the event that is currently running
is done.
For example if the currently running event ID is 2, and you want the next
event is 3 once the event 2 is done. It will be automatically without need
of the player input.
=====================
*) How to use :
---------------------
Put the script under material
Use this script to queue the events
$game_map.events_queue << event_id
If you use it like this
$game_map.events_queue << 1
$game_map.events_queue << 2
$game_map.events_queue << 3
The event will be executed in the order of 1,2,3 consecutively
===================
*) Terms of use ||
-------------------
Credit me, TheoAllen. You are free to edit this script by your own. As long
as you don't claim it's yours. For commercial purpose, don't forget to give me
a free copy of the game.
=end
#===============================================================================
# ** Game_Map
#===============================================================================
class Game_Map
#-----------------------------------------------------------------------------
# * Attributes reader
#-----------------------------------------------------------------------------
attr_reader :force_event
attr_reader :events_queue
#-----------------------------------------------------------------------------
# * Initialize
#-----------------------------------------------------------------------------
alias theo_event_there_init initialize
def initialize
@events_queue = []
@force_event = -1
theo_event_there_init
end
#-----------------------------------------------------------------------------
# * Next Event
#-----------------------------------------------------------------------------
def next_event
@force_event = @events_queue.shift || -1
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
alias theo_event_there_update update
def update(main = false)
theo_event_there_update(main)
if !@events_queue.empty? && @force_event == -1
next_event
end
end
end
#===============================================================================
# ** Game_Event
#===============================================================================
class Game_Event
#-----------------------------------------------------------------------------
# * Starting
#-----------------------------------------------------------------------------
alias theo_event_there_starting starting
def starting
theo_event_there_starting || $game_map.force_event == @event.id
end
end
#===============================================================================
# ** Game_Interpreter
#===============================================================================
class Game_Interpreter
#-----------------------------------------------------------------------------
# * Setup
#-----------------------------------------------------------------------------
alias theo_event_there_setup setup
def setup(*args)
theo_event_there_setup(*args)
if @event_id == $game_map.force_event
$game_map.next_event
end
end
end