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 #
- #==============================================================================#
- #-------------------------------------------------------------------------------
- # * Caracteristicas
- #
- # - Sistema interactivo de Empuje
- # - Sistema interactivo de Levante
- # - Sistema interactivo de Caidas
- # - Sistema interactivo de Saltar
- # - Sistema interactivo de Rango de Vision
- #
- # El sistema de empuje te permite empujar eventos al lugar que quieras, tambien
- # permite eventos de blanco y que al colicionar suceda algo, los eventos pueden
- # colicionarse por si solos con los blancos si les das movimiento
- #
- # El sistema de levante te permite levantar eventos y llevartelos al lugar que
- # que quieras, una vez levantado los podes tirar y podes decirle al script
- # que haga algo cuanbdo lo tiras.
- #
- # El sistema de caidas te permite caer al vacio en tiles especificos, los segi-
- # dores y eventos pueden caer, eventos pueden hacer caer al jugador al vacio.
- # tambien podes hacer que al tirar une vento al vacio suceda algo.
- #
- # El sistema de saltar te permite saltar al apretar la tecla de accion que por
- # defecto es la tecla C, los segidores tambien santan.
- #
- # El sistema de rango de vision te permite activar eventos que esten a cierto
- # rango del jugador, se desactivan cuando el jugador sale del rango
- #-------------------------------------------------------------------------------
- #
- # Licensia:
- # Este script es para juegos no comerciales, si tu proposito es para juegos
- # comerciales favor de contactarme falmc99@gmail.com
- #-------------------------------------------------------------------------------
- module FalInt
- #-------------------------------------------------------------------------------
- # * Sistema de Empuje *
- #
- # Escribe las siguientes lineas en los comentarios de evento
- #
- # PUSHABLE - El evento se convierte en empujable
- # JUMPBACK - El evento salta atras si lo empujas contra una pared
- #
- # TARGET SELF SWITCH - Poner el interruptor local a activar cuando colicionan
- # ejemplo: TARGET SELF SWITCH A
- #
- # TARGET SWITCH - Poner el interruptor que quieres activar cuando
- # colicionan ejem: TARGET SWITCH 10
- #
- # TARGET VARIABLE - Poner id de variable que va sumar (+) cuando colicionan
- # ejemplo: TARGET VARIABLE 5
- #
- # * Nota:
- #
- # Interruptores y variables son activados cuando un PUSHABLE y TARGET colicionan
- # y son desactivados cuando no colicionan, cuando te transportas a otro mapa
- # esos interruptores y variables se resetean
- #
- # Es importante saber que esos eventos tomaran propiedades especiales como,
- # direcion fija siempre falsa y atravezable siempre off
- #
- # Por defecto el jugador puede colicionar con los TARGET y activarlo pero
- # puedes cambiar eso con el siguiente comando
- #
- # $game_player.allowto_push = value cambiar valor a true / false
- #
- # Sonido al empujar un evento
- PushSe = "Open1"
- # Sonido cuando colicionan
- PressTarget = "Switch2"
- # Sonido cuando no colicionan
- ReleaseTarget = "Switch1"
- #-------------------------------------------------------------------------------
- # * El Sistema de Levante *
- #
- # Escribe las siguientes lineas en los comentarios de evento
- #
- # PICK UP El evento se vuelve levantable cuando apretas la tecla
- #
- # THROW SELF SWITCH Poner interruptor local que se quiera activar cuando tiras
- # el evento ejem: THROW SELF SWITCH A
- #
- # Si no quieres activar ningun interruptor local dejalo asi
- #
- # Podes hacer un monton de cosas con este sistema, usa tu imaginacion
- #
- # Sonido al levantar un evento
- PickUpSe = "Shot1"
- # Sonido al tirar un evento
- ThrowSe = "Knock"
- #-------------------------------------------------------------------------------
- # * El sistema de caidas *
- #
- # Terreno donde el jugador y eventos caen
- FallTag = 6
- # Sonido cuando se esta cayendo
- FallSe = "Fall"
- # Segidores y eventos pueden caer tambien, pero los eventos no son tontos ellos
- # caen solo si el jugador los empuja y caen solo si son PUSHABLES
- #
- # Escribe las siguientes lineas en los comentarios de evento
- #
- # FALL SWITCH Poner id del interruptor a activar cuando un evento cae
- # ejemplo: FALL SWITCH 20
- #
- # FALL VARIABLE Poner id de variable que se va sumar (+) cuando un evento
- # cae ejemplo: FALL VARIABLE 6
- #
- # Si no quieres activar interruptor o variable dejalo asi en blanco
- # los eventos son borrados cuando caen
- #
- # El hp del jugador y sus segidores bajan cuando caen al vacio, por defecto
- # se pierde 100, pero podes cambiar ese valor con el siguiente comando
- #
- # $game_player.fallhp = valor Cambiar valor por el valor deceado
- # ejem: $game_player.fallhp = 200
- #
- # Eventos pueden empujar al jugador para hacerlo caer, escribir la siguiente
- # linea en los comentarios de vento: PUSH THE PLAYER el jugador sera empujado
- #-------------------------------------------------------------------------------
- # * El sistema de Saltar
- #
- # Llamar la siguiente linea de script para activar el salto
- #
- # $game_player.enable_jump = value Cambiar value por true / false
- # ejem: $game_player.enable_jump = true
- #
- # Los segidores saltan con el jugador, solo peuden saltar 2 tiles como maximo
- # se puede saltar solo al presionar la tecla de accion
- # Sonido al saltar
- JumpSe = "Jump1"
- #-------------------------------------------------------------------------------
- # * Sistema de Rango de Vision
- #
- # Escribe las siguientes lineas en los comentarios de evento
- #
- # SENSOR VISION RANGE POner el rango de vision en tiles que el evento va
- # tener ejem: SENSOR VISION RANGE 6
- #
- # La distancia es basada entre el jugador y el evento, mientras se esta en rango
- # el evento activa un interruptor local, y cuando se sale de rango lo desactiva
- #
- # Interruptor local que se activa cuando se esta en rango
- SensorSelfsw = "C"
- #-------------------------------------------------------------------------------
- # Telcla de accion
- 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