• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Even More Fixes and Additions to Help-14's Following Pokemon Script

1,224
Posts
10
Years
Hey guys :)
Implemented everything so far and it works like it should.
Just wanted to ask if there is a way to make the following pokemon more like an event and not just a sprite. What i mean is that the people in my towns just walk over my pokemon :D
Ideas?

To fix that, find def passable? in Game_Map. Then right under this
Code:
for event in events.values
      if event.tile_id >= 0 and event != self_event and
         event.x == x and event.y == y and not event.through
        return false if @passages[event.tile_id] & bit != 0
        return false if @passages[event.tile_id] & 0x0f == 0x0f
        return true if @priorities[event.tile_id] == 0
      end
    end
add
Code:
    #remove comment to allow the player to pass through
    if !$game_temp.player_transferring && $game_player.pbHasDependentEvents? && $game_switches[Toggle_Following_Switch] && 
       self_event != $game_player
         dependent=pbGetDependency("Dependent")
         if dependent != nil && self_event != dependent
           if dependent.x==x && dependent.y==y
             return false
           end
         end
    end

This assumes your event is named "Dependent" , as the tutorial instructed you to. I commented out the part that lets you walk over it as your trainer, as I think this makes more sense. The only drawback is it could make you get stuck in some maps. So either remove the comment or design your maps accordingly. Or you could have an option that activates another switch to toggle it, then they can't get stuck.

Edit: Removed the commented part, because it makes you get stuck in doorways during map transfers.
Edit2: Fixed the follower's placement on map transistion (it wasn't previously able to retain the same position due to my addition)
Edit3: Attempt at slightly smoother map transitions. Needs more work elsewhere, but this should help a bit I think
 
Last edited:
13
Posts
9
Years
  • Age 34
  • Seen Nov 14, 2015
Thank you very much. It worked the way I wanted it. But now, if i leave a map my Pokemon is always first next to me on the new map. After that it starts following me.
 
1,224
Posts
10
Years
Fix for the pokemon event still having a grass animation even when the event is disabled and such. In PokemonField, there are two instances of
Code:
if pbGetTerrainTag(event,true)==PBTerrain::Grass  # Won't show if under bridge
      $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y)

replace them both with this
Code:
if pbGetTerrainTag(event,true)==PBTerrain::Grass  # Won't show if under bridge
    #pokemon follower fix?
    if event != $game_player
      followeranim=true
       events=$PokemonGlobal.dependentEvents
        for i in 0...events.length
          if events[i] && events[i][8]=="Dependent"
            if events[i][6] =="nil"
              followeranim=false
              break
            end
          end
        end
      $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y) if followeranim==true
    else
      $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y)
    end
 
119
Posts
10
Years
hi, i have an error when i remove all pokemon from my party then use pbToggleFollowingPokemon or $PokemonTemp.dependentEvents.remove_sprite(true)
to remove the sprite
you can see a gif of this happening below

http://gyazo.com/a949b4f6dffb20dd8538056abcdb5b91

here is the error code
---------------------------
Pokemon Neptune
---------------------------
Exception: RuntimeError

Message: Script error within event 5, map 33 (Pokémon Lab):

Exception: NoMethodError

Message: Section159:284:in `talk_to_pokemon'undefined method `hp' for nil:NilClass

***Full script:

$PokemonTemp.dependentEvents.talk_to_pokemon


Interpreter:243:in `pbExecuteScript'

(eval):1:in `pbExecuteScript'

Interpreter:1600:in `eval'

Interpreter:243:in `pbExecuteScript'

Interpreter:1600:in `command_355'

Interpreter:494:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'

Autosave:30:in `updateold'



Interpreter:276:in `pbExecuteScript'

Interpreter:1600:in `command_355'

Interpreter:494:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'

Autosave:30:in `updateold'

Autosave:28:in `loop'

Autosave:41:in `updateold'

Unreal Time:151:in `update'



This exception was logged in

C:\Users\Matthew\Saved Games/Pokemon Neptune/errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------

has anyone found a fix for this yet?
 
1,224
Posts
10
Years
has anyone found a fix for this yet?

Wherever you're calling pbToggleFollowingPokemon from, put it in a conditional

Code:
if $Trainer.party.length>0

pbToggleFollowingPokemon

end

Also, in a normal game you wouldn't be able to remove all your pokemon
 
119
Posts
10
Years
Wherever you're calling pbToggleFollowingPokemon from, put it in a conditional

Code:
if $Trainer.party.length>0

pbToggleFollowingPokemon

end

Also, in a normal game you wouldn't be able to remove all your pokemon

I actually made my own script to remove all pokemon from the party and store them into the pc. this is how i have no pokemon. after this it has the
Code:
if $Trainer.party.length>0

pbToggleFollowingPokemon

end
everything works as it should, up until i turn to where the pokemon use to be and i talk to it, thats when the error occurs.
this gif shows it crashing when i turn to talk to the "pokemon" http://gyazo.com/a949b4f6dffb20dd8538056abcdb5b91
this is the script i made, i used the idea that u used in a previous post but changed the code
Code:
class RemoveParty
end

def StoreParty # Stores Party In pc
  for i in 0...$Trainer.party.length
    pokemon = $Trainer.party[i]
    pkmn=$Trainer.party[i]  
    clonedpkmn=pkmn.clone
    clonedpkmn.iv=pkmn.iv.clone
    clonedpkmn.ev=pkmn.ev.clone
    $PokemonStorage.pbStoreCaught(clonedpkmn)
    $Trainer.party[i]=nil
  end
  if $Trainer.party.length>0
     pbToggleFollowingPokemon
  end
end

def RefreshParty
  $Trainer.party.compact!
end
 
25
Posts
13
Years
  • Seen Jul 15, 2016
I got a question... I want to make the follow script in sort way that just one pokemon follows you just like in pokemon yellow if you have pikachu in your party just pikachu will be able to follow you...please i need help with it
 

Allgamesdude

The Creator of the WIP game, Pokémon Cosmic. Looki
283
Posts
11
Years
I got a question... I want to make the follow script in sort way that just one pokemon follows you just like in pokemon yellow if you have pikachu in your party just pikachu will be able to follow you...please i need help with it

It would be the same thing. There's a few workarounds.

-Create it for all pokemon, but replace every sprite with a Pikachu Sprite. That way, every OW looks like Pikachu.

-Make a Dependant Trainer, but don't let it battle as one, just follow as one.

Thats all I can think of ATM. Ill post back if I think of anything else.
 
1,224
Posts
10
Years
I got a question... I want to make the follow script in sort way that just one pokemon follows you just like in pokemon yellow if you have pikachu in your party just pikachu will be able to follow you...please i need help with it

Firstly, you didn't ask a question.
Also, there's a lot of the logic in it you have to change, instead of checking if the first pokemon is fainted, you first have to check if you have a pikachu, and then check if that pikachu is fainted or not, etc.
 
25
Posts
13
Years
  • Seen Jul 15, 2016
Firstly, you didn't ask a question.
Also, there's a lot of the logic in it you have to change, instead of checking if the first pokemon is fainted, you first have to check if you have a pikachu, and then check if that pikachu is fainted or not, etc.

I'm kinda noob and new on this ehat is the code for cheling the pikachu and the other stuff?
 
1,224
Posts
10
Years
I'm kinda noob and new on this ehat is the code for cheling the pikachu and the other stuff?

Being new is fine, but I can't teach you how to code. I can only correct mistakes or give advice.

To start
Code:
pbHasSpecies?(:PIKACHU)
will return true or false, depending on whether you have a pikachu in your party.
You will probably need to check if you have an unfainted pikachu, not just a pikachu, so use this method instead

Code:
def pbHasUnfaintedSpecies?(species)
if species.is_a?(String) || species.is_a?(Symbol)
    species=getID(PBSpecies,species)
  end
  for pokemon in $Trainer.party
    next if pokemon.egg?
    return true if pokemon.species==species && pokemon.hp>0
  end
  return false
end
call it in the same fashion
 
423
Posts
13
Years
  • Age 37
  • Seen Aug 31, 2023
thx yh i figured that bit out bout 5 mins ago thx (just gotta convert my 3x4 sprites now :D)
 
3
Posts
10
Years
  • Age 26
  • Seen Nov 8, 2016
hello, my English is not very good and because it is I difficult to understand which version is better and which should use I refer to that of Help-14's and that of zingzags
please tell me which to use, there are two topics each one offering a script of pokemon follower and not you which it is the best election
 

~Angel~

Lead developer for Pokémon Millennium
281
Posts
14
Years
---------------------------
Pokemon Essentials
---------------------------
Script 'FollowingPokemon' line 958: NameError occurred.

uninitialized constant Events
---------------------------
OK
---------------------------

So, I've been trying to re-add Pokemon following into the newest essentials and I'm getting some weird error, not sure what it is or why it's being caused, but on line 958 is under the Events.onStepTakenFieldMovement+=proc{|sender,e| line, to be exact it's that exact line, I copied it right off of here, and don't know what it's doing right now. If anyone can help me, I'd appreciate it as I'm trying to get a form of demo/alpha/beta out for my game.
 
5
Posts
9
Years
  • Age 38
  • Seen Apr 13, 2015
Hey :D

I am still looking for these locations in the script:

- Where to Adjusts did the large Pokemon can not in houses?
- And where can I set how quickly the Pokemon moves while the player is stopped?

Thank you! :3


A second thing:
The Emotions will not play on some maps. Where can I change?
 
Last edited:
44
Posts
10
Years
  • Age 33
  • Seen Feb 4, 2017
Hey yall,
I'm having a lot of trouble trying to work this script out. I get this error message when I get the starter Pokémon.

Spoiler:
Exception: RuntimeError
Message: Script error within event 20, map 32 (Ender Town):
Exception: NameError
Message: (eval):2:in `pbExecuteScript'uninitialized constant Interpreter::Dependent
***Full script:
pbAddPokemon(PBSpecies::DEINO,5)
pbPokemonFollow(Dependent)

Interpreter:243:in `pbExecuteScript'
Interpreter:1600:in `eval'
Interpreter:243:in `pbExecuteScript'
Interpreter:1600:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'

Interpreter:276:in `pbExecuteScript'
Interpreter:1600:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'
Scene_Map:114:in `update'
Scene_Map:68:in `main'
Spoiler:


Can anyone help me? There's just this. I tried to solve it like Rayd12smitty said to, but it still doesn't work.
 
Last edited:

Ęℓαчиıı

Blizzagon used Arctic Claw!
394
Posts
13
Years
Hey yall,
I'm having a lot of trouble trying to work this script out. I get this error message when I get the starter Pokémon.
Can anyone help me? There's just this. I tried to solve it like Rayd12smitty said to, but it still doesn't work.

Hm, maybe try this?

pbAddPokemon(PBSpecies::DEINO,5)
pbPokemonFollow(1)

Also, I do have two questions if anyone could possible answer them. I've gotten the script to work out quite well but here is the problem. The overworlds move about two times faster then they should. The other is the actual walk cycle; they overlap the player. I'm linking a screenshot below as to what I mean. I don't want to go digging through the script and risk messing anything up, but I would love some help! My questions are simple. How can I adjust the overworld walking speed and how can I fix the overlapping?

oWs.png
 
Back
Top