Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # #*****************# #
- # #*** By Falcao ***# * Interactive system 1.7 #
- # #*****************# This script allow you to interact with events #
- # game player, game characters and tarrain tiles #
- # RMVXACE The feeling of realism is inminent #
- # www.makerpalace.com Date: August 24 2012 #
- #==============================================================================#
- #-------------------------------------------------------------------------------
- # * Features
- #
- # - Interactive Push system
- # - Interactive Pick Up system
- # - Interactive Fall System
- # - Interactive Jump System
- # - Interactive Sensor Vision System
- #
- # The push system allow you to push events to your desire place, allow you to
- # press targets and easily tell them to do something when collide, events can
- # press targets by themself if you give them movement
- #
- # The pick up system allow you to pick up events and move it wherever you want
- # when you throw the event you can easily tell them to do something afther
- # throwed
- #
- # The fall system allow you to fall to espeficific tiles, events fall, fallowers
- # fall, events can make the player fall, also you can make something happen
- # when an event fall
- #
- # The Jump System allow you to jump by triggering the action key, followers
- # jump together with the player.
- #
- # The Sensor vision system allow you to activate any event within a vision range
- # between the player and the event, the event deactivate when out range
- #-------------------------------------------------------------------------------
- #
- # License:
- # For non-comercial games only, for comercial games contact me to the
- # following email address falmc99@gmail.com
- #-------------------------------------------------------------------------------
- module FalInt
- #-------------------------------------------------------------------------------
- # * Push system *
- #
- # Write the followings lines on a event command comment tag
- #
- # PUSHABLE - Event can be pushed wherever you want
- # JUMPBACK - event jump back if you pushed against an impasable tile
- #
- # TARGET SELF SWITCH - Put the self switch letter you want to activate
- # when collide ex: TARGET SELF SWITCH A
- #
- # TARGET SWITCH - Put the switch id you want to activate when collide
- # ex: TARGET SWITCH 10
- #
- # TARGET VARIABLE - Put the variable id you want to increase (+) when
- # collide ex: TARGET VARIABLE 5
- #
- # * Important info:
- #
- # Switches and variables are activated when PUSHED and TARGET collide and
- # they are deactivated when not colliding, when you tranfer to another map
- # switches and variables the target activated reset
- #
- # TARGET events are always through on, always priority below characters and
- # dont start with the action key
- # PUSHABLE events are always direction fix off and always through off
- #
- # By default Player can push events too but you can disable or enable that
- # anytime with the following command
- #
- # $game_player.allowto_push = value change value for true/false
- #
- # Sound played when the player push an event
- PushSe = "Open1"
- # Sound played when pressing a target
- PressTarget = "Switch2"
- # Sound played when realeasing the target
- ReleaseTarget = "Switch1"
- #-------------------------------------------------------------------------------
- # * Pick Up system *
- #
- # Write the followings lines on an event command comment tag
- #
- # PICK UP The event is picked up when the action keys is triggered
- #
- # THROW SELF SWITCH Put self switch letter you want to activate when you throw
- # the event ex: THROW SELF SWITCH A
- #
- # If you dont want self switch just leave it.
- #
- # You can do a lot of stuff when you throw an event, like desappear it, drop
- # something, use your imagination.
- #
- # Sound played when player pick up an event
- PickUpSe = "Shot1"
- # Sound played when player throw the event
- ThrowSe = "Knock"
- #-------------------------------------------------------------------------------
- # * Fall System *
- #
- # Terrain tag where the player and events fall
- FallTag = 6
- # Sound played when falling
- FallSe = "Fall"
- # Followers can fall too, events can fall too but events are no fools, they
- # only fall when player push them, so in order to make an event fall it must be
- # tagged PUSHABLE
- #
- # Write the followings lines on an event command comment tag
- #
- # FALL SWITCH Put the switch id you want to activate when event fall
- # ex: FALL SWITCH 20
- #
- # FALL VARIABLE Put the variable id you want to increase (+) when an
- # event fall ex: FALL VARIABLE 6
- #
- # If you dont want to activate switch or variable just leave it blank
- # Event is erased when they fall
- #
- # Player and followers decrease hp when they fall, default amount of hp to loose
- # is 100, but you can change that value anytime with the following command
- #
- #
- # $game_player.fallhp = value Change value for desire hp to loose
- # ex: $game_player.fallhp = 200
- #
- # Events can push the player in order to make him fall, write the following line
- # on event command comment tag: PUSH THE PLAYER the player will be jumped away
- # from the event.
- #-------------------------------------------------------------------------------
- # * Jump System
- #
- # Call the following line to activate the jump system
- #
- # $game_player.enable_jump = value Change value for true / false
- # ex: $game_player.enable_jump = true
- #
- # Player and followers jump together, they can jump only two tiles while
- # moving, if the are standing jump only at the same place, press the action key
- # to jump
- # Sound played when jumping
- JumpSe = "Jump1"
- #-------------------------------------------------------------------------------
- # * Sensor Vision System
- #
- # Write the followings lines on an event command comment tag
- #
- # SENSOR VISION RANGE Put vision range in tiles you want the event to have
- # ex: SENSOR VISION RANGE 6
- #
- # The distance is based in tiles between the game player and the event, when the
- # player is within the vision range a self switch is activated and it is
- # deactivated when the player is out of range
- #
- # Self switch that is activated when the player is whithin the range
- SensorSelfsw = "C"
- #-------------------------------------------------------------------------------
- # Action key, this key toggle pick up events, throw events and jump
- ActionKey = :C
- end
- #-------------------------------------------------------------------------------
- # * Falcao Interactive System version 1.7
- #
- # Game character base: new methods, variables and public instance variables
- class Game_CharacterBase
- attr_accessor :through
- attr_accessor :priority_type
- attr_accessor :opacity
- attr_accessor :move_speed
- attr_accessor :zoom_x
- attr_accessor :zoom_y
- attr_accessor :pushed
- attr_accessor :direction_fix
- attr_accessor :x
- attr_accessor :y
- attr_accessor :picked
- attr_accessor :throwed
- attr_accessor :force_move
- attr_accessor :obfalling
- attr_accessor :direction
- attr_accessor :pushable_busy
- attr_accessor :inrange
- attr_accessor :fallbyjump
- alias falcao_intsystem_base_ini initialize
- def initialize
- falcao_intsystem_base_ini
- @zoom_x = 1.0
- @zoom_y = 1.0
- @pushed = false
- @picked = false
- @throwed = false
- @obfalling = 0
- end
- # Pasable jump: distance measured in tiles, ignore fall terrian tiles
- def jump_passable?(distance, ignore_events=false)
- dir = @direction
- return false if !ignore_events and collide_with_characters?(
- @x + ajustxy(self)[0] * distance, @y + ajustxy(self)[1] * distance)
- return true if self.is_a?(Game_Player) and
- $game_map.terrain_tag(@x + ajustxy(self)[0] * distance,
- @y + ajustxy(self)[1] * distance) == FalInt::FallTag
- return true if self.is_a?(Game_Event) and self.check_com("PUSHABLE") and
- $game_map.terrain_tag(@x + ajustxy(self)[0] * distance,
- @y + ajustxy(self)[1] * distance) == FalInt::FallTag
- return true if map_passable?(@x, @y + distance, dir) and dir == 2
- return true if map_passable?(@x - distance, @y, dir) and dir == 4
- return true if map_passable?(@x + distance, @y, dir) and dir == 6
- return true if map_passable?(@x, @y - distance, dir) and dir == 8
- return false
- end
- # Start jump: power measured in tiles
- def start_jump(power)
- player = self.is_a?(Game_Player)
- if player
- RPG::SE.new(FalInt::JumpSe,80).play
- self.followers.reverse_each do |f|
- break if Input.dir4 == 0
- f.move_toward_player ; f.move_toward_player ; f.move_toward_player
- f.jump(0, power) if @direction == 2
- f.jump(- power, 0) if @direction == 4
- f.jump(power, 0) if @direction == 6
- f.jump(0, - power) if @direction == 8
- end
- end
- jump(0, power) if player ? Input.dir4 == 2 : @direction == 2
- jump(- power, 0) if player ? Input.dir4 == 4 : @direction == 4
- jump(power, 0) if player ? Input.dir4 == 6 : @direction == 6
- jump(0, - power) if player ? Input.dir4 == 8 : @direction == 8
- jump(0, 0) if Input.dir4 == 0 and player
- end
- # Jump back: power measured in tiles
- def jump_back(power=1)
- @direction_fix = true
- jump(0, - power) if @direction == 2
- jump(power, 0) if @direction == 4
- jump(- power, 0) if @direction == 6
- jump(0, power) if @direction == 8
- @direction_fix = false
- end
- # Jump forward: power measured in tiles
- def jump_forward(power=1)
- jump(0, power) if @direction == 2
- jump(- power, 0) if @direction == 4
- jump(power, 0) if @direction == 6
- jump(0, - power) if @direction == 8
- end
- # Ajust x y: object direction if nil take Input only for player
- def ajustxy(d=nil)
- push_x, push_y = 0, 1 if d.nil? ? Input.dir4 == 2 : d.direction == 2
- push_x, push_y = - 1, 0 if d.nil? ? Input.dir4 == 4 : d.direction == 4
- push_x, push_y = 1, 0 if d.nil? ? Input.dir4 == 6 : d.direction == 6
- push_x, push_y = 0, - 1 if d.nil? ? Input.dir4 == 8 : d.direction == 8
- return [push_x, push_y] if d != nil
- push_x, push_y = 0, 0 if Input.dir4 == 0
- return [push_x, push_y]
- end
- end
- # Game Player
- class Game_Player < Game_Character
- include FalInt
- attr_accessor :pushable
- attr_accessor :fallhp
- attr_accessor :allowto_push
- attr_accessor :enable_jump
- attr_accessor :working_at
- attr_accessor :icontrol
- # aliasing
- alias falcao_intsystem_ini initialize
- alias falcao_intsystem_update update
- alias falcao_intsystem_get_on_vehicle get_on_vehicle
- alias falcao_intsystem_get_off_vehicle get_off_vehicle
- alias falcao_intsystem_move_by_input move_by_input
- alias falcao_intsystem_start_map_event start_map_event
- alias falcao_intsystem_perform_transfer perform_transfer
- def initialize
- falcao_intsystem_ini
- @pushable = []
- @eve_fall = []
- @fallhp = 100
- @player_busy = false
- @jump_delay = 0
- @allowto_push = true
- @enable_jump = false
- @pickup_delay = 0
- @standing_pushing = false
- @working_at = {}
- @icontrol = 0
- end
- def update
- falcao_intsystem_update
- update_intsystem
- end
- def update_intsystem
- update_push_events
- update_falling
- update_pick_up
- update_sensor_system
- perform_jump if Input.trigger?(ActionKey) and
- !$game_map.interpreter.running? and @enable_jump
- @jump_delay -= 1 if @jump_delay > 0
- @icontrol -= 1 if @icontrol > 0
- end
- #---------------------------------------------------------------------------
- # * Push System
- #---------------------------------------------------------------------------
- # Player push event object
- def player_push(event)
- event.turn_away_from_player
- event.jump_back if event.check_com("JUMPBACK") and
- event.pushable_busy.nil? and not event.jump_passable?(1, true)
- if event.passable?(event.x, event.y, @direction) and !event.moving?
- unless event.x == @x and event.y == @y
- event.move_away_from_player
- RPG::SE.new(PushSe,80).play
- end
- end
- end
- # Push the target
- def press_target(event, sound=true)
- RPG::SE.new(PressTarget,80).play if sound
- self_sw = event.check_selfsw("TARGET SELF SWITCH")
- if self_sw != nil
- $game_self_switches[[$game_map.map_id, event.id, self_sw]] = true
- end
- switch = event.check_var("TARGET SWITCH")
- $game_switches[switch] = true if switch != 0
- variable = event.check_var("TARGET VARIABLE")
- $game_variables[variable] += 1 if variable != 0
- event.pushed = true
- event.refresh
- end
- # Release the target
- def release_target(event, sound=true)
- RPG::SE.new(ReleaseTarget, 80).play if sound
- self_sw = event.check_selfsw("TARGET SELF SWITCH")
- if self_sw != nil
- $game_self_switches[[$game_map.map_id, event.id, self_sw]] = false
- end
- switch = event.check_var("TARGET SWITCH")
- $game_switches[switch] = false if switch != 0
- variable = event.check_var("TARGET VARIABLE")
- $game_variables[variable] -= 1 if variable != 0
- event.pushed = false
- event.refresh
- end
- # Get float info necesary to release a target
- def afloatxy(object)
- push_x, push_y = 0, - 0.5 if object.direction == 2 # down
- push_x, push_y = 0.5, 0 if object.direction == 4 # left
- push_x, push_y = - 0.5, 0 if object.direction == 6 # right
- push_x, push_y = 0, 0.5 if object.direction == 8 # up
- return [push_x, push_y]
- end
- # Update push events
- def update_push_events
- return if @vehicle_getting_on || in_boat? || in_ship? || in_airship?
- for event in $game_map.events.values
- if event.check_com("PUSHABLE") and !self.moving?
- event.direction_fix = false if event.direction_fix
- if event.x == @x + ajustxy[0] and event.y == @y + ajustxy[1]
- player_push(event)
- end
- end
- if event.check_selfsw("TARGET SELF SWITCH") != nil
- event.through = true if not event.through
- event.priority_type = 0 if event.priority_type != 0
- # Player push targets
- if @allowto_push
- if event.real_x == @real_x and event.real_y == @real_y and
- not event.pushed
- press_target(event, @icontrol == 0)
- @standing_pushing = true
- elsif event.pushed
- if event.real_x == @real_x + afloatxy(self)[0] and
- event.real_y == @real_y + afloatxy(self)[1]
- release_target(event)
- @standing_pushing = false
- end
- end
- end
- @pushable.each do |ev|
- ev.through = false if ev.through
- # release a pushed target if the player pick up the object
- if ev.check_com("PICK UP")
- @working_at.delete(ev.id) if !ev.pushable_busy.nil? and
- ev.x == @x + ajustxy(self)[0] and ev.y == @y + ajustxy(self)[1] and
- Input.trigger?(ActionKey)
- if event.pushed and event.x == @x + ajustxy(self)[0] and event.y ==
- @y + ajustxy(self)[1] and Input.trigger?(ActionKey)
- release_target(event)
- break
- end
- end
- # events pushing and releasing conditions
- if event.real_x == ev.real_x and event.real_y == ev.real_y and
- not event.pushed and not ev.picked and not ev.throwed
- press_target(event, @icontrol == 0) ; ev.pushable_busy = true
- @working_at[ev.id] = [ev.x, ev.y]
- elsif event.pushed
- break if event.real_x == ev.real_x and event.real_y == ev.real_y
- if event.real_x == ev.real_x + afloatxy(ev)[0] and
- event.real_y == ev.real_y + afloatxy(ev)[1] and not ev.picked
- release_target(event) ; ev.pushable_busy = nil
- @working_at.delete(ev.id)
- end
- end
- end
- end
- end
- end
- #---------------------------------------------------------------------------
- # * Pick up System
- #---------------------------------------------------------------------------
- def update_pick_up
- return if @vehicle_getting_on || in_boat? || in_ship? || in_airship?
- @pickup_delay -= 1 if @pickup_delay > 0
- return if @pickup_delay > 0
- for event in $game_map.events.values
- event.x = @x if event.picked
- event.y = @y if event.picked
- if event.throwed # if throwed do this
- if event.force_move != nil and event.jump_passable?(1, true)
- event.start_jump(1)
- event.force_move = nil
- end
- unless event.jumping?
- RPG::SE.new(ThrowSe,80).play
- self_sw = event.check_selfsw("THROW SELF SWITCH")
- if self_sw != nil
- $game_self_switches[[$game_map.map_id, event.id, self_sw]] = true
- event.refresh
- event.direction = event.page.graphic.direction
- changing = true
- end
- @player_busy = event.throwed = false
- event.jump(0, 0) if changing.nil?
- changing = nil
- end
- end
- if event.check_com("PICK UP")
- event.priority_type = 1 if event.priority_type == 0
- event.direction_fix = false if event.direction_fix
- # Throw object
- if Input.trigger?(ActionKey) and event.picked and
- !$game_map.interpreter.running?
- event.move_speed = @lastesp
- if event.jump_passable?(4) ; event.start_jump(4)
- elsif event.jump_passable?(3) ; event.start_jump(3)
- elsif event.jump_passable?(2) ; event.start_jump(2)
- else ; event.force_move = true
- end
- event.picked = false
- event.move_type = @lasmovetype
- event.throwed = true
- end
- # Pick up object
- if Input.trigger?(ActionKey) and event.x == @x + ajustxy(self)[0] and
- event.y == @y + ajustxy(self)[1] and !event.picked and
- not self.moving? and not @player_busy
- RPG::SE.new(PickUpSe, 80).play
- @lasmovetype = event.move_type
- event.move_type = 0
- @lastesp = event.move_speed
- event.move_speed = 6
- @player_busy = event.picked = true
- @pickup_delay = 5
- end
- end
- end
- end
- #---------------------------------------------------------------------------
- # * Fall System
- #---------------------------------------------------------------------------
- # events start falling
- def start_falling(event)
- event.obfalling = 1
- event.move_speed = 4.5
- event.through = true
- event.fallbyjump.nil? ? event.move_away_from_player : event.fallbyjump = nil
- RPG::SE.new(FallSe,80).play
- @eve_fall.push(event) unless @eve_fall.include?(event)
- @eve_fall = @eve_fall.uniq
- @player_busy = event.picked = false if event.picked
- end
- # Player start falling
- def player_start_falling
- $game_map.events.values.each do |event|
- if event.picked and not event.check_com("PUSHABLE")
- start_falling(event)
- end
- end
- self.through = true
- set_direction(Input.dir4) if Input.dir4 != 0
- self.move_forward if @fallbyjump.nil?
- RPG::SE.new(FallSe,80).play
- @last_speed = self.move_speed
- self.move_speed = 5
- @obfalling = 100
- end
- def update_falling
- return if @vehicle_getting_on || in_boat? || in_ship? || in_airship?
- # Events fall
- for event in $game_map.events.values
- if event.check_com("PUSHABLE")
- @pushable.push(event) unless @pushable.include?(event)
- if $game_map.terrain_tag(event.real_x + ajustxy[0],
- event.real_y + ajustxy[1]) == FallTag and
- event.real_x == @real_x + ajustxy[0] and
- event.real_y == @real_y + ajustxy[1] and event.obfalling == 0
- start_falling(event) unless event.moving? and self.moving?
- elsif $game_map.terrain_tag(event.real_x, event.real_y) == FallTag and
- event.obfalling == 0
- unless event.moving?
- event.fallbyjump = true
- start_falling(event)
- end
- end
- end
- # Events push the player away
- if event.check_com("PUSH THE PLAYER")
- event.direction_fix = false if event.direction_fix
- if @jump_delay == 0 and @real_x == event.real_x + ajustxy(event)[0] and
- @real_y == event.real_y + ajustxy(event)[1] and @obfalling == 0
- @direction = event.direction
- move_forward
- followers.gather
- if jump_passable?(1, ignore_events = true)
- @lastpxy = [@x, @y]
- jump_forward(1) ; @jump_delay = 20
- end
- end
- end
- end
- # event falling effect
- @eve_fall.each do |ev|
- if ev.obfalling > 0
- ev.zoom_x -= 0.06
- ev.zoom_y -= 0.06
- if ev.zoom_x <= 0.06 and !ev.erased
- switch = ev.check_var("FALL SWITCH")
- $game_switches[switch] = true if switch != 0
- variable = ev.check_var("FALL VARIABLE")
- $game_variables[variable] += 1 if variable != 0
- event.refresh if switch != 0 || variable != 0
- ev.erase
- @eve_fall.delete_if { |e| e == ev }
- event.obfalling = 0
- end
- end
- end
- # followes fall with the player
- self.followers.reverse_each do |f|
- if @obfalling > 0
- f.zoom_x = @zoom_x
- f.zoom_y = @zoom_y
- f.move_toward_player ; f.move_toward_player ; f.move_toward_player
- end
- end
- # Player fall
- if $game_map.terrain_tag(@real_x, @real_y) == FallTag and
- @obfalling == 0 and not moving? and not jumping?
- @fallbyjump = true
- player_start_falling
- elsif $game_map.terrain_tag(@real_x + ajustxy[0], @real_y + ajustxy[1]) ==
- FallTag and @obfalling == 0 and !self.moving?
- player_start_falling
- end
- if @obfalling > 0
- @obfalling -= 1
- if @obfalling > 30 and @obfalling < 100
- self.zoom_x -= 0.06; self.zoom_y -= 0.06
- end
- if @obfalling == 40
- @fallbyjump.nil? ? self.move_backward : moveto(@lastpxy[0],
- @lastpxy[1]) rescue nil
- @fallbyjump = nil
- end
- if @obfalling == 30
- self.zoom_x = 1.0
- self.zoom_y = 1.0
- self.through = false
- $game_party.members.each do |actor|
- actor.hp -= @fallhp
- end
- end
- self.opacity = (self.opacity + 70) % 160 + 60 if @obfalling < 40
- self.opacity = 255 if @obfalling == 0
- self.move_speed = @last_speed if @obfalling == 0
- end
- end
- #---------------------------------------------------------------------------
- # * Jump System
- #---------------------------------------------------------------------------
- def perform_jump
- return if @standing_pushing || self.jumping? || @obfalling > 0 ||
- in_airship? || @vehicle_getting_on || in_boat? || in_ship? ||
- @jump_delay > 0 || @player_busy
- $game_map.events.values.each do |event|
- if event.pushed
- return if event.x == @x and event.y == @y
- if event.x == @x + ajustxy(self)[0] and event.y == @y + ajustxy(self)[1]
- return
- end
- end
- end
- @lastpxy = [@x, @y]
- if jump_passable?(2) ; start_jump(2)
- elsif jump_passable?(1) ; start_jump(1)
- else ; start_jump(0)
- end
- @jump_delay = 16
- end
- #---------------------------------------------------------------------------
- # * Sensor Vision System
- #---------------------------------------------------------------------------
- def sensor_area?(parent, target, size)
- distance = (parent.x - target.x).abs + (parent.y - target.y).abs
- enable = (distance <= size-1)
- return true if enable
- return false
- end
- def update_sensor_system
- $game_map.events.values.each do |event|
- range = event.check_var("SENSOR VISION RANGE")
- if range != 0
- if sensor_area?(self, event, range)
- data = [$game_map.map_id, event.id, SensorSelfsw]
- if event.inrange.nil? and !$game_self_switches[[data[0], data[1],
- data[2]]]
- $game_self_switches[[data[0], data[1], data[2]]] = true
- event.inrange = true
- end
- elsif event.inrange != nil
- data = [$game_map.map_id, event.id, SensorSelfsw]
- if $game_self_switches[[data[0], data[1], data[2]]]
- $game_self_switches[[data[0], data[1], data[2]]] = false
- event.inrange = nil
- end
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # * Flow control
- #-----------------------------------------------------------------------------
- def get_on_vehicle
- return if @player_busy
- falcao_intsystem_get_on_vehicle
- end
- def get_off_vehicle
- return if $game_map.terrain_tag(@x, @y) == FallTag
- falcao_intsystem_get_off_vehicle
- end
- def move_by_input
- return if @obfalling > 0
- falcao_intsystem_move_by_input
- end
- def start_map_event(x, y, triggers, normal)
- $game_map.events_xy(x, y).each do |ev|
- return if ev.check_selfsw("TARGET SELF SWITCH") != nil
- end
- falcao_intsystem_start_map_event(x, y, triggers, normal)
- end
- # refresh all the system if the map is not the same
- def perform_transfer
- if $game_map.map_id != @new_map_id
- refresh_falcao_int_system
- @working_at = {}
- end
- falcao_intsystem_perform_transfer
- end
- # Execute refresh
- def refresh_falcao_int_system
- @pushable = @eve_fall = []
- @player_busy = @standing_pushing = false
- for event in $game_map.events.values
- event.throwed = false if event.throwed
- if event.picked
- event.move_speed = @lastesp
- event.move_type = @lasmovetype
- event.picked = false
- end
- event.pushable_busy = nil if event.pushable_busy != nil
- release_target(event, sound = false) if event.pushed
- end
- end
- end
- # Game Event: Commands comments definition
- class Game_Event < Game_Character
- attr_reader :erased
- attr_reader :page
- attr_accessor :move_type
- def check_com(comment)
- return false if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0].include?(comment)
- return true
- end
- end
- end
- return false
- end
- def check_var(comment)
- return 0 if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0] =~ /#{comment}[ ]?(\d+)?/
- return $1.to_i
- end
- end
- end
- return 0
- end
- def check_selfsw(comment)
- return nil if @list.nil? or @list.size <= 0
- for item in @list
- next unless item.code == 108 or item.code == 408
- if item.parameters[0] =~ /#{comment} (.*)/
- return $1.to_s
- end
- end
- return nil
- end
- end
- # Sprite character
- class Sprite_Character < Sprite_Base
- alias falcao123_zoom_update update
- def update
- falcao123_zoom_update
- if @zoom_x != @character.zoom_x or
- @zoom_y != @character.zoom_y
- @zoom_x = @character.zoom_x
- @zoom_y = @character.zoom_y
- self.zoom_x = @character.zoom_x
- self.zoom_y = @character.zoom_y
- end
- end
- # Adjust a picked event to the game player
- alias falcao_intsystem_update_position update_position
- def update_position
- falcao_intsystem_update_position
- if @character.picked
- self.x = $game_player.screen_x
- self.y = $game_player.screen_y - 16
- @character.direction = $game_player.direction
- end
- end
- end
- class << DataManager
- # Refresh the system if saving
- alias falcao_intsystem_save_game save_game unless $@
- def DataManager.save_game(index)
- $game_player.refresh_falcao_int_system
- $game_player.icontrol = 10
- falcao_intsystem_save_game(index)
- end
- # Tell the system to repositioning the working events, if game is updated
- alias falcao_intsystem_mapreload reload_map_if_updated unless $@
- def DataManager.reload_map_if_updated
- if $game_system.version_id != $data_system.version_id
- $game_player.icontrol = 10
- end
- falcao_intsystem_mapreload
- end
- end
- # Add to array all pushable events
- class Game_Map
- alias falcao_intsystem_setup_events setup_events
- def setup_events(*args, &block)
- falcao_intsystem_setup_events(*args, &block)
- @events.values.each do |event|
- $game_player.pushable.push(event) if event.check_com("PUSHABLE")
- # Execute event repositioning
- if $game_player.icontrol > 0
- $game_player.working_at.each do |id , value|
- event.moveto(value[0], value[1]) if id == event.id
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement