Class: Game_CommonEvent

Inherits:
Object show all
Defined in:
scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb

Overview

Describe a common event during the game processing

Constant Summary collapse

WILD_BATTLE =

Returns ID of the wild battle start common event.

Returns:

  • (Integer)

    ID of the wild battle start common event

1
APPEARANCE =

Returns ID of the appearence common event.

Returns:

  • (Integer)

    ID of the appearence common event

2
FOLLOWER_SPEECH =

Returns ID of the follower speech common event.

Returns:

  • (Integer)

    ID of the follower speech common event

5
HOLE_FALLING =

Returns ID of the falling from hole common event.

Returns:

  • (Integer)

    ID of the falling from hole common event

8
SURF_ENTER =

Returns ID of the enter surf common event.

Returns:

  • (Integer)

    ID of the enter surf common event

9
SURF_LEAVE =

Returns ID of the leaving surf common event.

Returns:

  • (Integer)

    ID of the leaving surf common event

10
HEADBUTT =

Returns ID of the headbutt common event.

Returns:

  • (Integer)

    ID of the headbutt common event

20
WATERFALL =

Returns ID of the waterfall common event.

Returns:

  • (Integer)

    ID of the waterfall common event

26
DIVE =

Returns ID of the dive common event.

Returns:

  • (Integer)

    ID of the dive common event

29

Instance Method Summary collapse

Constructor Details

#initialize(common_event_id) ⇒ Game_CommonEvent

Initialize the Game_CommonEvent

Parameters:

  • common_event_id (Integer)

    id of the common event in the database



23
24
25
26
27
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 23

def initialize(common_event_id)
  @common_event_id = common_event_id
  @interpreter = nil
  refresh
end

Instance Method Details

#list

List of commands of the common event



41
42
43
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 41

def list
  return $data_common_events[@common_event_id].list
end

#name

Name of the common event



29
30
31
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 29

def name
  return $data_common_events[@common_event_id].name
end

#refresh

Refresh the common event. If it triggers automatically, an internal Interpreter is generated



45
46
47
48
49
50
51
52
53
54
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 45

def refresh
  # 必要なら並列処理用インタプリタを作成
  if self.trigger == 2 and $game_switches[self.switch_id] == true
    if @interpreter == nil
      @interpreter = Interpreter.new
    end
  else
    @interpreter = nil
  end
end

#switch_id

id of the switch that triggers the common event



37
38
39
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 37

def switch_id
  return $data_common_events[@common_event_id].switch_id
end

#trigger

trigger condition of the common event



33
34
35
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 33

def trigger
  return $data_common_events[@common_event_id].trigger
end

#update

Update the common event, if there's an internal Interpreter, it's being updated



56
57
58
59
60
61
62
63
64
65
66
# File 'scripts/00600 Script_RMXP/01300 Game_CommonEvent.rb', line 56

def update
  # 並列処理が有効の場合
  if @interpreter != nil
    # 実行中でなければセットアップ
    unless @interpreter.running?
      @interpreter.setup(self.list, 0)
    end
    # インタプリタを更新
    @interpreter.update
  end
end