#--------------------------------# # Dramatic Lightning Co Presents: # Bondage Movement System 1.2 #--------------------------------# # This script offers "movement" in the form of hopping or wiggling! # Use your action (Z/Space) button to hop around # You can place on almost anything, even events! # However, only works on states. # Additional credit to Galv as this was based on his Jump System. #--------------------------------# # Stuck actors will also be obstacles that you can interact with! # If you want to walk over them, turn STUCKSTOP to false. # Oh, and your party will attempt to escape on their own too! # You can also set DEATHSTOP to true if dead people don't move. # If set to false, STUCKKEEP will remove all stuck states on new maps. #--------------------------------# module DL module MOVE STUCKSTOP = true STUCKKEEP = false DEATHSTOP = false end module EventHop Regex = //i Regex2 = //i end end ($imported ||= {})["Galvs_Jump_Ability"] = true module Galv_Jump BUTTON = :C JUMP_SE = ["Jump2", 50, 120] NO_JUMP_REGIONS = [30] end module RPG class Event::Page def event_hop? @list.each {|cmd| if cmd.code == 108 && res = cmd.parameters[0].match(DL::EventHop::Regex) return true end } return false end end class BaseItem def hop? return self.note.match(DL::EventHop::Regex) return res end end class State def hop? return self.note.match(DL::EventHop::Regex) end def stuck? return self.note.match(DL::EventHop::Regex2) end end end class Game_BattlerBase def has_stuck? return true if actor? and @states.any? {|i| $data_states[i].stuck? } return false end def has_hop? if actor? return true if @states.any? {|i| $data_states[i].hop? } return true if armors.any? {|armor| armor.hop?} return true if self.class.hop? return true if actor.hop? end return false end end class Game_Actor < Game_Battler def update_state_stepper RPG::SE.new("Bow4", 60, 140 + rand(10)).play on_player_walk $game_player.update_encounter if rand(3) == 0 end end ################################ class Game_Character < Game_CharacterBase def collide_with_events?(x, y) $game_map.events_xy_nt(x, y).any? do |event| return event.normal_priority? || (self.is_a?(Game_Event) and event.priority_type == @priority_type) end end def abs_heal(target) return unless target.actor and target.actor.has_stuck? RPG::SE.new("Equip3", 80, 150).play target.randstep target.actor.remove_states_by_damage if rand(3) == 0 target.actor.update_state_stepper $game_player.update_encounter end end def randstep rand(2) == 0 ? @pattern = 0 : @pattern = 2 end def check_region @max_x = 0 @max_y = 0 bob = @direction case bob when 2 @max_y = @distance (@distance+1).times { |i| return @max_y = i if stopper?(@x, @y+i+1) } when 4 @max_x = -@distance (@distance+1).times { |i| return @max_x = -i if stopper?(@x-i-1, @y) } when 6 @max_x = @distance (@distance+1).times { |i| return @max_x = i if stopper?(@x+i+1, @y) } when 8 @max_y = -@distance (@distance+1).times { |i| return @max_y = -i if stopper?(@x, @y-i-1) } end end def stopper?(x,y) Galv_Jump::NO_JUMP_REGIONS.include?($game_map.region_id(x,y)) || !$game_map.stopper_event?(x,y) end def canpass?(x,y) bob2 = @direction x2 = $game_map.round_x_with_direction(x, bob2) y2 = $game_map.round_y_with_direction(y, bob2) bob = $game_map.blocking_event?(x,y) return bob end def check_distance @jump_x = 0 @jump_y = 0 ch = [] @can_jump = true bob = @direction case bob when 2 @jump_y = @distance @distance.times { |i| ch << @jump_y - i if canpass?(@x, @y + @jump_y - i) } ch.delete_if {|x| x > @max_y } @jump_y = ch.max if !ch.empty? when 4 @jump_x = -@distance @distance.times { |i| ch << @jump_x + i if canpass?(@x + @jump_x + i, @y) } ch.delete_if {|x| x < @max_x } @jump_x = ch.min if !ch.empty? when 6 @jump_x = @distance @distance.times { |i| ch << @jump_x - i if canpass?(@x + @jump_x - i, @y) } ch.delete_if {|x| x > @max_x } @jump_x = ch.max if !ch.empty? when 8 @jump_y = -@distance @distance.times { |i| ch << @jump_y + i if canpass?(@x, @y + @jump_y + i) } ch.delete_if {|x| x < @max_y } @jump_y = ch.min if !ch.empty? end if ch.empty? @jump_y = 0 @jump_x = 0 @can_jump = false end end end class Game_Player < Game_Character alias :dl_move_perform_transfer :perform_transfer def perform_transfer if transfer? and !DL::MOVE::STUCKKEEP if @new_map_id != $game_map.map_id $game_party.battle_members.each do |member| member.states.each do |state| member.remove_state(state.id) if state.stuck? end end end end dl_move_perform_transfer end def passable?(x, y, d) x2 = $game_map.round_x_with_direction(x, d) y2 = $game_map.round_y_with_direction(y, d) return false unless $game_map.valid?(x2, y2) return true if @through || debug_through? return false unless map_passable?(x, y, d) return false unless map_passable?(x2, y2, reverse_dir(d)) return false if collide_with_characters?(x2, y2) @followers.each do |follower| if follower.x == x2 and follower.y == y2 and follower.actor return false if DL::MOVE::STUCKSTOP and follower.actor and follower.actor.has_stuck? end end return true end def check_action_event return false if in_airship? check_event_trigger_here([0]) return true if $game_map.setup_starting_event abs_fight if DL::MOVE::STUCKSTOP check_event_trigger_there([0,1,2]) return true if $game_map.setup_starting_event end def abs_fight x2 = $game_map.round_x_with_direction(@x, @direction) y2 = $game_map.round_y_with_direction(@y, @direction) @followers.each do |follower| if follower.x == x2 and follower.y == y2 and follower.actor abs_heal(follower) end end end def stuck_state? return false if $game_party.members.empty? return true if $game_party.members[0].has_stuck? return false end def hop_state? return false if $game_party.members.empty? return true if $game_party.members[0].has_hop? return false end def collide?(x, y) !@through && (pos?(x, y)) || followers.collide?(x, y) end def move_by_input return if DL::MOVE::DEATHSTOP and actor.dead? return if jumping? @priority_type = 1 if !jumping? return if !movable? || $game_map.interpreter.running? if stuck_state? i = false i = true if Input.trigger?(2) or Input.trigger?(4) or Input.trigger?(6) or Input.trigger?(8) if i == true randstep actor.update_state_stepper end elsif hop_state? set_direction(Input.dir4) if Input.trigger?(Galv_Jump::BUTTON) i = Input.dir4 set_direction(i) do_jump if !$game_map.interpreter.running? && normal_walk? && !jumping? end else i = Input.dir4 move_straight(i) if Input.dir4 > 0 end end def move_straight(d, turn_ok = true) @move_succeed = passable?(@x, @y, d) if @move_succeed if hop_state? or stuck_state? set_direction(d) do_jump else @followers.move set_direction(d) @x = $game_map.round_x_with_direction(@x, d) @y = $game_map.round_y_with_direction(@y, d) @real_x = $game_map.x_with_direction(@x, reverse_dir(d)) @real_y = $game_map.y_with_direction(@y, reverse_dir(d)) end increase_steps elsif turn_ok set_direction(d) check_event_trigger_touch_front end end def do_jump @distance = 1 check_region check_distance bob = @direction @can_jump = false unless passable?(@x,@y,bob) if @can_jump increase_steps @followers.move RPG::SE.new(Galv_Jump::JUMP_SE[0], Galv_Jump::JUMP_SE[1], Galv_Jump::JUMP_SE[2]).play if hop_state? jump(@jump_x, @jump_y)# if hop_state? check_touch_event end end def jump(x_plus, y_plus) @priority_type = 1.5 super end end class Game_Follower < Game_Character alias :dl_mp_update :update def update dl_mp_update return unless actor and actor.has_stuck? @countdown = 2000 if @countdown == nil if @countdown > 0 @countdown -= rand(actor.luk) else actor.update_state_stepper randstep @countdown = 2000 end end def do_jump @distance = 1 check_region check_distance jump(@jump_x, @jump_y) if @can_jump end def leading_follower return unless @preceding_character return @preceding_character if @preceding_character.actor and !@preceding_character.actor.has_stuck? and !(DL::MOVE::DEATHSTOP and @preceding_character.actor.dead?) bob = @member_index - 1 until bob < 0 do return $game_player.followers[bob] if $game_player.followers[bob] != self and $game_player.followers[bob].actor and !$game_player.followers[bob].actor.has_stuck? and !(DL::MOVE::DEATHSTOP and $game_player.followers[bob].actor.dead?) bob -= 1 end return $game_player end def chase_preceding_character return if actor and DL::MOVE::DEATHSTOP and actor.dead? return if actor and actor.has_stuck? unless moving? bob = leading_follower sx = distance_x_from(bob.x) sy = distance_y_from(bob.y) if actor and actor.has_hop? randstep maxdis = 1 maxdis = 2 if sx == 0 or sy == 0 sx = sx > 0 ? [sx, maxdis].min : [sx, -maxdis].max sy = sy > 0 ? [sy, maxdis].min : [sy, -maxdis].max if !$game_map.passable?(self.x - sx, self.y - sy, self.direction) sx = sx > 0 ? [sx, 1].min : [sx, -1].max sy = sy > 0 ? [sy, 1].min : [sy, -1].max end jump(-sx, -sy) else if sx != 0 && sy != 0 and diagonal_passable?(@x,@y,sx > 0 ? 4 : 6, sy > 0 ? 8 : 2) move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2) elsif sx != 0 and passable?(@x, @y, sx > 0 ? 4 : 6) move_straight(sx > 0 ? 4 : 6) elsif sy != 0 and passable?(@x, @y, sy > 0 ? 8 : 2) move_straight(sy > 0 ? 8 : 2) end end end end end class Game_Event < Game_Character def hop_state? return true if @page and @page.event_hop? return false end def move_straight(d, turn_ok = true) @move_succeed = passable?(@x, @y, d) if @move_succeed set_direction(d) if hop_state? do_jump else @x = $game_map.round_x_with_direction(@x, d) @y = $game_map.round_y_with_direction(@y, d) @real_x = $game_map.x_with_direction(@x, reverse_dir(d)) @real_y = $game_map.y_with_direction(@y, reverse_dir(d)) end elsif turn_ok set_direction(d) check_event_trigger_touch_front end end def do_jump @distance = 1 check_region check_distance @can_jump = false unless passable?(@x,@y,@direction) jump(@jump_x, @jump_y) if @can_jump end def erase @erased = true @priority_type = 3 refresh end end class Game_Map def blocking_event?(x,y) events_xy(x,y).each { |e| return false if e.priority_type == 1 and !e.through} return true end def stopper_event?(x,y) events_xy(x,y).each { |e| next if e.list.nil? return false if e.list[0].code == 108 && e.list[0].parameters[0] == "" } return true end end