Class: Game_Event
- Inherits:
-
Game_Character
- Object
- Game_Character
- Game_Event
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb
Overview
Describe an Event during the Map display process
Constant Summary collapse
- SURFING_TAG =
Tag inside an event that put it in the surfing state
'surf_'
- INVISIBLE_EVENT_NAME =
If named like this, this event is an invisible object
'OBJ_INVISIBLE'
- INVISIBLE_EVENT_TAG =
Tag that sets the event in an invisible state (not triggerd unless in front of it)
'invisible_'
- AUTO_CHARSET_TAG =
Tag that tells the event to always take the character_name of the first page when page change
'$'
- PARTICLE_OFF_TAG =
Tag that tells the event not to push particles when it moves
'[particle=off]'
- OFFSET_Y_TAG =
Tag that detect offset_screen_y
/\[offset_y=([0-9\-]+)\]/
- NO_SPRITE_TAG =
Tag that forbid the creation of a Sprite_Character for this event
'[sprite=off]'
- SYMBOL_ALIAS_TAG =
Tag that give the event an symbol alias
/\[alias=([a-z\-0-9\-_]+)\]/
- REFLECTION_TAG =
Tag enabling reflection
'[reflection=on]'
Constants inherited from Game_Character
Game_Character::EMPTY_MOVE_ROUTE, Game_Character::PARTICLES_METHODS, Game_Character::SAND_PARTICLE_NAME, Game_Character::SHADOW_DISABLED_UPDATE_VALUES, Game_Character::SNOW_PARTICLE_NAME, Game_Character::SlideTags, Game_Character::StairsTag, Game_Character::SurfLTag, Game_Character::SurfTag
Constants included from GameData::SystemTags
GameData::SystemTags::AcroBike, GameData::SystemTags::AcroBikeRL, GameData::SystemTags::AcroBikeUD, GameData::SystemTags::BridgeRL, GameData::SystemTags::BridgeUD, GameData::SystemTags::CrackedSoil, GameData::SystemTags::DeepSwamp, GameData::SystemTags::Empty, GameData::SystemTags::HeadButt, GameData::SystemTags::Hole, GameData::SystemTags::JumpD, GameData::SystemTags::JumpL, GameData::SystemTags::JumpR, GameData::SystemTags::JumpU, GameData::SystemTags::MachBike, GameData::SystemTags::RapidsD, GameData::SystemTags::RapidsL, GameData::SystemTags::RapidsR, GameData::SystemTags::RapidsU, GameData::SystemTags::Road, GameData::SystemTags::RocketD, GameData::SystemTags::RocketL, GameData::SystemTags::RocketR, GameData::SystemTags::RocketRD, GameData::SystemTags::RocketRL, GameData::SystemTags::RocketRR, GameData::SystemTags::RocketRU, GameData::SystemTags::RocketU, GameData::SystemTags::SlopesL, GameData::SystemTags::SlopesR, GameData::SystemTags::StairsD, GameData::SystemTags::StairsL, GameData::SystemTags::StairsR, GameData::SystemTags::StairsU, GameData::SystemTags::SwampBorder, GameData::SystemTags::TCave, GameData::SystemTags::TGrass, GameData::SystemTags::TIce, GameData::SystemTags::TMount, GameData::SystemTags::TPond, GameData::SystemTags::TSand, GameData::SystemTags::TSea, GameData::SystemTags::TSnow, GameData::SystemTags::TTallGrass, GameData::SystemTags::TUnderWater, GameData::SystemTags::TWetSand, GameData::SystemTags::WaterFall, GameData::SystemTags::ZTag
Instance Attribute Summary collapse
-
#erased ⇒ Boolean
readonly
If the event was erased (needs to be removed from the view).
-
#event ⇒ RPG::Event
readonly
The event data from the MAP.
-
#invisible_event ⇒ Boolean
readonly
If the event is an invisible event (should be in front of the event to trigger it when it doesn't have a character_name).
-
#list ⇒ Array<RPG::EventCommand>
readonly
List of commands that should be executed.
-
#original_id ⇒ Integer
readonly
Original id of the event.
-
#original_map ⇒ Integer
readonly
Original map id of the event.
-
#starting ⇒ Boolean
readonly
If the event wants to start.
-
#sym_alias ⇒ Symbol?
readonly
The symbol alias of the event.
-
#trigger ⇒ Integer?
readonly
Type of trigger for the event (0: Action key, 1: Player contact, 2: Event contact, 3: Autorun, 4: Parallel process).
Attributes inherited from Game_Character
#__bridge, #animation_id, #blend_type, #can_make_footprint, #character_hue, #character_name, #direction, #direction_fix, #follower, #id, #in_swamp, #is_pokemon, #move_route, #move_route_forcing, #move_route_index, #move_speed, #offset_screen_y, #offset_shadow_screen_y, #opacity, #particles_disabled, #path, #pattern, #real_x, #real_y, #reflection_enabled, #shadow_disabled, #sliding, #step_anime, #surfing, #through, #tile_id, #transparent, #x, #y, #z
Instance Method Summary collapse
-
#activated? ⇒ Boolean
Check if the character is activate.
-
#can_be_shown? ⇒ Boolean
Tell if the event can have a sprite or not.
-
#can_parallel_execute? ⇒ Boolean
Tell if the event can execute in parallel process or automatic process.
-
#check_event_trigger_auto
Check if the event starts automaticaly and start if so.
-
#check_event_trigger_touch(x, y)
Check if the event touch the player and start it if so.
-
#clear_starting
Sets @starting to false allowing the event to move with its default move route.
-
#erase
Remove the event from the map.
- #find_path(**kwargs)
-
#initialize(map_id, event) ⇒ Game_Event
constructor
Initialize the Game_Event with its map_id and its RPG::Event data.
-
#initialize_parse_name
Parse the event name in order to setup the event particularity.
-
#over_trigger? ⇒ Boolean
Tells if the Event cannot start.
-
#refresh
Refresh the event : check if an other page is valid and if so, refresh the graphics and command list.
-
#start
Starts the event if possible.
-
#update
Update the Game_Character and its internal Interpreter.
Methods inherited from Game_Character
#animate_from_charset, #bridge_down_check, #bridge_left_check, #bush_depth, #cancel_charset_animation, #contact?, #define_path, #detect_swamp, #each_front_tiles, #each_front_tiles_rect, #emotion, #event_passable_check?, #follower_check?, #follower_move, #follower_sliding?, #follower_tail, #force_move_route, #front_name_check, #front_system_tag, #front_system_tag_db_symbol, #front_terrain_tag, #front_tile, #front_tile_event, #front_tile_id, #increase_steps, #jump, #jump_bridge_check, #jumping?, #lock, #lock?, #look_this_event, #look_to, #movable?, #move_away_from_player, #move_backward, #move_down, #move_follower_to_character, #move_forward, #move_frequency=, #move_left, #move_lower_left, #move_lower_right, #move_random, #move_right, #move_toward, #move_toward_player, #move_type_path, #move_up, #move_upper_left, #move_upper_right, #movement_process_end, #moveto, #moving?, #next_event_follower, #original_move_speed, #particle_push, #particle_push_grass, #particle_push_pond, #particle_push_sand, #particle_push_snow, #particle_push_tall_grass, #particle_push_wetsand, #passable?, #passable_bridge_check?, #passage_surf_check?, #process_slope_y_modifier, #reset_follower, #reset_follower_move, #screen_x, #screen_y, #screen_z, #set_appearance, #set_follower, #set_surfing, #shadow_screen_x, #shadow_screen_y, #sliding?, #slope_check_left, #slope_check_right, #stair_move_left, #stair_move_right, #stop_path, #straighten, #surfing?, #system_tag, #system_tag_db_symbol, #terrain_tag, #turn_180, #turn_away_from_player, #turn_down, #turn_left, #turn_left_90, #turn_random, #turn_right, #turn_right_90, #turn_right_or_left_90, #turn_toward_character, #turn_toward_player, #turn_up, #unlock, #z_bridge_check
Methods included from GameData::SystemTags
Constructor Details
#initialize(map_id, event) ⇒ Game_Event
Initialize the Game_Event with its map_id and its RPG::Event data
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 42 def initialize(map_id, event) super() @map_id = map_id @event = event @id = @event.id @original_map = event.original_map || map_id @original_id = event.original_id || @id @erased = false @starting = false @through = true @can_parallel_execute = @original_map == map_id initialize_parse_name moveto(@event.x, @event.y) refresh end |
Instance Attribute Details
#erased ⇒ Boolean (readonly)
Returns if the event was erased (needs to be removed from the view).
32 33 34 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 32 def erased @erased end |
#event ⇒ RPG::Event (readonly)
Returns the event data from the MAP.
28 29 30 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 28 def event @event end |
#invisible_event ⇒ Boolean (readonly)
Returns if the event is an invisible event (should be in front of the event to trigger it when it doesn't have a character_name).
30 31 32 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 30 def invisible_event @invisible_event end |
#list ⇒ Array<RPG::EventCommand> (readonly)
Returns list of commands that should be executed.
24 25 26 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 24 def list @list end |
#original_id ⇒ Integer (readonly)
Returns Original id of the event.
34 35 36 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 34 def original_id @original_id end |
#original_map ⇒ Integer (readonly)
Returns Original map id of the event.
36 37 38 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 36 def original_map @original_map end |
#starting ⇒ Boolean (readonly)
Returns if the event wants to start.
26 27 28 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 26 def starting @starting end |
#sym_alias ⇒ Symbol? (readonly)
Returns The symbol alias of the event.
38 39 40 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 38 def sym_alias @sym_alias end |
#trigger ⇒ Integer? (readonly)
Returns Type of trigger for the event (0: Action key, 1: Player contact, 2: Event contact, 3: Autorun, 4: Parallel process).
22 23 24 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 22 def trigger @trigger end |
Instance Method Details
#activated? ⇒ Boolean
Check if the character is activate. Useful to make difference between event without active page and others.
160 161 162 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 160 def activated? return !@page.nil? end |
#can_be_shown? ⇒ Boolean
Tell if the event can have a sprite or not
77 78 79 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 77 def can_be_shown? return !@event.name.include?(NO_SPRITE_TAG) end |
#can_parallel_execute? ⇒ Boolean
Tell if the event can execute in parallel process or automatic process
72 73 74 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 72 def can_parallel_execute? return @can_parallel_execute end |
#check_event_trigger_auto
Check if the event starts automaticaly and start if so
138 139 140 141 142 143 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 138 def check_event_trigger_auto if @trigger == 2 && $game_player.contact?(@x, @y, @z) && !$game_temp.player_transferring start if !jumping? and over_trigger? end start if @trigger == 3 end |
#check_event_trigger_touch(x, y)
Check if the event touch the player and start it if so
131 132 133 134 135 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 131 def check_event_trigger_touch(x, y) return if $game_system.map_interpreter.running? return unless @trigger == 2 && $game_player.contact?(x, y, @z) # and x == $game_player.x and y == $game_player.y start unless jumping? && over_trigger? end |
#clear_starting
Sets @starting to false allowing the event to move with its default move route
82 83 84 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 82 def clear_starting @starting = false end |
#erase
Remove the event from the map
101 102 103 104 105 106 107 108 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 101 def erase @erased = true @x = -10 @y = -10 @opacity = 0 $game_map.event_erased = true refresh end |
#find_path(**kwargs)
154 155 156 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 154 def find_path(**kwargs) super(**kwargs) if Yuki::MapLinker.from_center_map?(self) end |
#initialize_parse_name
Parse the event name in order to setup the event particularity
59 60 61 62 63 64 65 66 67 68 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 59 def initialize_parse_name return unless (name = @event.name) @particles_disabled = name.include?(PARTICLE_OFF_TAG) || @event.name.include?(NO_SPRITE_TAG) @autocharset = name.include?(AUTO_CHARSET_TAG) name.sub(OFFSET_Y_TAG) { @offset_screen_y = $1.to_i } @surfing = name.include?(SURFING_TAG) @invisible_event = (name == INVISIBLE_EVENT_NAME || name.include?(INVISIBLE_EVENT_TAG)) name.sub(SYMBOL_ALIAS_TAG) { @sym_alias = $1.to_sym } @reflection_enabled = name.include?(REFLECTION_TAG) end |
#over_trigger? ⇒ Boolean
Tells if the Event cannot start
88 89 90 91 92 93 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 88 def over_trigger? return false if !@character_name.empty? && !@through || @invisible_event return false unless $game_map.passable?(@x, @y, 0) return true end |
#refresh
Refresh the event : check if an other page is valid and if so, refresh the graphics and command list
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 111 def refresh new_page = nil unless @erased @event.pages.reverse_each do |page| next unless page.condition.valid?(@original_map, @original_id) new_page = page break end end return if new_page == @page return unless refresh_page(new_page) && can_parallel_execute? @interpreter = Interpreter.new if @trigger == 4 check_event_trigger_auto end |
#start
Starts the event if possible
96 97 98 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 96 def start @starting = true unless @list.empty? end |
#update
Update the Game_Character and its internal Interpreter
146 147 148 149 150 151 152 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00200 Game_Event.rb', line 146 def update super check_event_trigger_auto return unless @interpreter @interpreter.setup(@list, @event.id) unless @interpreter.running? @interpreter.update end |