[XP(/VX)] Swap places with events by running into them, how?

Started by Terv, February 14, 2013, 06:57:29 pm

Previous topic - Next topic

Terv

Hey :hi:

I'm using a script called MP Party Follow which makes your party members follow you as events and arranges these in a "natural" way around you.
However this inevitably leads to them blocking your way in narrow passages. The solution suggested by the script's author is to make these critical maps broader which is goofy, and setting the party members to through looks cheesy.

A possible solution I came up with is to be able to swap one's place with an event's place by running/pushing yourself into the party member for more than 1 second (so that you don't accidentally swap when planning to talk to them).

Like so:



How would one implement such a feature? Please note that I can't use Player Touch as trigger as Action Button is needed in order to be able to talk to your buds.

Thanks in advance!

LiTTleDRAgo


Terv

Of course, however the script is just the reason I want to implement this feature. There's no real bug nor is it directly connected to the script itself.


http://cdn.tikky.tk/MP%20Party%20Follow-Interaction%20Demo.zip

LiTTleDRAgo

class Game_Character
  alias_method :drg567_passable, :passable?
  def passable?(*args)
    n = [args[0] + (args[2] == 6 ? 1 : args[2] == 4 ? -1 : 0),
         args[1] + (args[2] == 2 ? 1 : args[2] == 8 ? -1 : 0)]
    r = drg567_passable(*args)
    a,b = [], [$game_player.x,$game_player.y] == n && @character_name != ''
    $data_actors.each {|i| a << i.name if !i.nil?}
    if self == $game_player
      $game_map.events.values.each{|e|r=true if[e.x,e.y]==n&&a.include?(e.name)}
    else
      r = true if b && a.include?(self.name)
    end
    return r
  end
end

class Game_Event
 
  def update
    [mp_autofollow_update,(0...$data_actors.size-1).each {|i|
      next unless $data_actors[i + 1].name == self.name
      return if moving? || !$game_switches[SW_ACTOR_IN_PARTY[i]]
      move_route = RPG::MoveRoute.new
      [move_route.repeat = false, move_route.skippable = true]
      if distance_from($game_player) > DISTANCE_TOLERANCES[i]
        move_route.list[0].code = 10
      elsif distance_from($game_player) == 0
        move_route.list[0].code = 12
      else
        move_route.list[0].code = 25
      end
      force_move_route(move_route)
      @move_route_forcing = false }]
  end
end


place it below MP Party Follow

Terv

Now that's epic, thanks! :haha: you even improved the original code.
And I managed to modify it myself so that you need to push 1 sec before you swap places, sweet  :nod: