• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] partner trainer who teleports at random (20.1)

  • 13
    Posts
    2
    Years
    • Seen Sep 17, 2022
    Hi, I use Kotaro's Deep Marsh Tiles script and the partner trainer when you free yourself from the mud teleports randomly. I thought I'd have it not count the walk when you sunk in the mud but I still know very little about ruby. Is there any possible solution?
    Video: (broken link removed)

    I have identified the scripts that should be modified:
    Game_Follow
    Code:
    class Game_Follower < Game_Event
      attr_writer :map
      def initialize(event_data)
        # Create RPG::Event to base self on
        rpg_event = RPG::Event.new(event_data.x, event_data.y)
        rpg_event.id = event_data.event_id
        rpg_event.name = event_data.event_name
        if event_data.common_event_id
          # Must setup common event list here and now
          common_event = Game_CommonEvent.new(event_data.common_event_id)
          rpg_event.pages[0].list = common_event.list
        end
        # Create self
        super(event_data.original_map_id, rpg_event, $map_factory.getMap(event_data.current_map_id))
        # Modify self
        self.character_name = event_data.character_name
        self.character_hue  = event_data.character_hue
        case event_data.direction
        when 2 then turn_down
        when 4 then turn_left
        when 6 then turn_right
        when 8 then turn_up
        end
      end
    #=============================================================================
    
      def move_through(direction)
        old_through = @through
        @through = true
        case direction
        when 2 then move_down
        when 4 then move_left
        when 6 then move_right
        when 8 then move_up
        end
        @through = old_through
      end
    
      def move_fancy(direction)
        delta_x = (direction == 6) ? 1 : (direction == 4) ? -1 : 0
        delta_y = (direction == 2) ? 1 : (direction == 8) ? -1 : 0
        new_x = self.x + delta_x
        new_y = self.y + delta_y
        # Move if new position is the player's, or the new position is passable,
        # or self's current position is not passable
        if ($game_player.x == new_x && $game_player.y == new_y) ||
           location_passable?(new_x, new_y, 10 - direction) ||
           !location_passable?(self.x, self.y, direction)
          move_through(direction)
        end
      end
    end
    Deep Marsh Tiles by Kitoro
    Code:
    def pbStuckTile(event=nil)
      event = $game_player if !event
      return if !event
      $PokemonGlobal.stuck=true
      event.straighten
      event.calculate_bush_depth
      olddir=event.direction
      dir=olddir
      turntimes=0
      loop do
        break if turntimes>=Deep_Marsh_Tiles::MARSHTILES_TURN_TIMES
        Graphics.update
        Input.update
        pbUpdateSceneMap
        key=Input.dir4
        dir=key if key>0
        if dir!=olddir
          case dir
            when 2 then $game_player.turn_down
            when 4 then $game_player.turn_left
            when 6 then $game_player.turn_right
            when 8 then $game_player.turn_up
          end
          olddir=dir
          turntimes+=1
        end
      end
      event.center(event.x,event.y)
      event.straighten
      $PokemonGlobal.stuck=false
      $PokemonGlobal.mudfree=true
      event.jump(0,0)
      pbSEPlay(Deep_Marsh_Tiles::MARSHTILES_JUMP_SOUND)
      20.times do
        Graphics.update
        Input.update
        pbUpdateSceneMap
      end
      $PokemonGlobal.mudfree=false
    end

    The solution I have been thinking about is that when you get up from the mud there is a condition that does not cause the npc follow to move. Unfortunately I am not able to define it not knowing where to touch
     
    Back
    Top