• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Following Pokemon EX

Resource Following Pokemon EX 2.2.3

Wooper#1

Rookie
Member
Joined
Feb 15, 2024
Posts
5
Hello, made an account just to ask this question, I've been messing around with this and have been wondering if its possible to make it so different Pokémon trigger different common events (or just anything that functions similar to them) when interacting with them. I thought it would be fun to have different images of the Pokémon appear on screen when you interact with them similar to the Pikachu sprites in yellow. Thanks
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
674
Well, I don't know about the events, but looking at the code, FollowingPkmn.get_pokemon seems to return the current pokemon follower. If you check the species of the pokemon it returns, you may be able to change the sprite based on the species. It will require a lot of conditional checks, though.
 

Wooper#1

Rookie
Member
Joined
Feb 15, 2024
Posts
5
Thanks for the reply, as much as running a lot of conditional checks isn't too ideal, it seems like the only solution I'll be able to use for now, I'm just happy that it'll work. I'll give it a go.
 

Wooper#1

Rookie
Member
Joined
Feb 15, 2024
Posts
5
Sorry to ask again, I tried using FollowingPkmn.get_pokemon as suggested above but my knowledge of how scripts work in RPG Maker XP isn't good enough to make it not return an error.

Using Wooper as an example I tried using "FollowingPkmn.get_pokemon = WOOPER", "FollowingPkmn.get_pokemon = 194" and "FollowingPkmn.get_pokemon(:WOOPER)" as conditions in a conditional branch, and all of them returned errors and force closed the playtest.

I know I'm definitely doing something wrong and probably just didn't read somewhere on the overview page that could solve my problem, but I can't seem to find anything so thought I'd try asking again, thanks.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
674
There are multiple reasons why these codes aren't working. First, a single = means that you are setting the value as the one on the right, not comparing values. So to check if the value is the one on the right, you have to use == (or != if you don't want it to match). Second, FollowingPkmn.get_pokemon contains an array of values so it will always return false with this comparison. What you need to do is this:
Ruby:
Expand Collapse Copy
pkmn = FollowingPkmn.get_pokemon
if pkmn.species == :WOOPER  #This is the conditional branch
#Add the code here
end
You'll have to use the script section of the conditional branch to put the condition although I don't know if it'll work. If it doesn't try this instead (or try directly):
Ruby:
Expand Collapse Copy
pkmn = FollowingPkmn.get_pokemon
$game_variables[1] = pkmn.species
if pbGet(1) == :WOOPER  #This is the conditional branch
#Add the code here
end
Or $game_variables[1] instead of pbGet(1).
 

Wooper#1

Rookie
Member
Joined
Feb 15, 2024
Posts
5
Thanks for the response again, I probably should've realized that == would be comparing and = would be setting, tbh I get a feeling that this small feature in a fan-game I'll most likely never release is too advanced for a beginner like me, but with all this help you've given I'd feel worse giving up now, but at the same time don't feel inclined to help if it's inconvenience.

anyway, back to more of me not understanding Ruby, because I couldn't figure out how to call common events from the script command (and google didn't seem to want to help) I thought I'd copy and paste the code you posted without any changes just to test it out, and I must have missed something because every variation I try returns the same error:

Exception: NameError
Message: undefined local variable or method `branch' for #<Interpreter @event_id: 5>
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
674
You aren't supposed to copy it all. The code should look like one of those examples:
1708123523056.png
1708123533960.png
1708123542939.png


To get to the script thing to put the code (the gray text), it here:
1708123594075.png

And the conditional branch is there:
1708123639946.png

And here where you put the condition for the conditional branch:
1708123681429.png
 

Wooper#1

Rookie
Member
Joined
Feb 15, 2024
Posts
5
YESSS! Thank you so much, it worked. sorry to make you have to show exact examples, I misunderstood the conditional branch note in the original code sample, thinking it meant the if else in the script command was the branch. The example images you sent, as well as everything else, have helped me a lot. thanks again
 

Willix

Novice
Member
Joined
Feb 7, 2024
Posts
42
Hello, I have the 21.1 port of this plugin but I assume I can ask here bc it's basically the same. Features say that it supports smart animation at pokecenters if nurse joy event is properly set, but I upgraded my game from a previous essentials version and also have modified nurse event, so I'd like to know what 'properly set' means?
 

Thunder

Novice
Member
Joined
Jul 2, 2019
Posts
44
Hello. I noticed that I was getting an issue where events with the same event ID would be erased on the map immediately after setting up the Following Pokemon event.

Example:
I set up the Following Pokemon event on Map A.
Map A (Map ID: 1)
Event ID 3 = FollowingPkmn

I would then transfer to Map B

Map B (Map ID: 2)
Event ID 3 = Some other event

I noticed that Event ID 3 disappeared after the transfer. I had to enter Map C (Map ID: 3) then enter Map B (Map ID: 2) to get the erased event to appear.

I figured something was wrong with the plugin as it wasn't supposed to do this. I looked into Event Sprint.rb and found the following:

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == event.current_map_id
  }

See the issue with event.original_map_id == event.current_map_id ? I believe that when the EventHandler was triggered, event.current_map_id is using map id where the EventHandler was triggered instead of the map the player is transferring to. This causes the event with the same ID on another map to be erased.

Map A (1)
event.original_map_id = 1
event.current_map_id = ??? (I didn't check. It's probably 1 or nil.)
Map A (1) to Map B (2)
event.original_map_id = 1
event.current_map_id = 1 (This erases the event on Map B (2).)
Map B (2) to Map C (3)
event.original_map_id = 1
event.current_map_id = 2

The workaround/solution to this issue was to change

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == event.current_map_id
  }

to

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == map.events[event.event_id]&.map_id
  }

and

Ruby:
Expand Collapse Copy
  #-----------------------------------------------------------------------------
  # Updating the refresh method to allow clearing of base event in all maps,
  # add reflections and prevent crash when base map/event is deleted
  #-----------------------------------------------------------------------------
  alias __followingpkmn__refresh refresh unless method_defined?(:__followingpkmn__refresh)
  def refresh(*args)
    ret = __followingpkmn__refresh(*args)
    return ret if !FollowingPkmn.can_check?
    event = FollowingPkmn.get_event
    @sprites.each do |spr|
      next if !FollowingPkmn.get_data&.following_pkmn?
      spr.set_reflection(@viewport, event)
    end
    data = FollowingPkmn.get_data
    $map_factory.maps.each { |map|
      map&.events&.[](data.event_id)&.erase if data && data.original_map_id == data.current_map_id
    }
    FollowingPkmn.refresh(false)
  end

to

Ruby:
Expand Collapse Copy
  #-----------------------------------------------------------------------------
  # Updating the refresh method to allow clearing of base event in all maps,
  # add reflections and prevent crash when base map/event is deleted
  #-----------------------------------------------------------------------------
  alias __followingpkmn__refresh refresh unless method_defined?(:__followingpkmn__refresh)
  def refresh(*args)
    ret = __followingpkmn__refresh(*args)
    return ret if !FollowingPkmn.can_check?
    event = FollowingPkmn.get_event
    @sprites.each do |spr|
      next if !FollowingPkmn.get_data&.following_pkmn?
      spr.set_reflection(@viewport, event)
    end
    data = FollowingPkmn.get_data
    $map_factory.maps.each { |map|
      map&.events&.[](data.event_id)&.erase if data && data.original_map_id == map&.events&.[](data.event_id)&.map_id
    }
    FollowingPkmn.refresh(false)
  end

After doing the above, the event on Map B was no longer getting erased. It works for now, but I don't know if any issues will result from this quick fix.
 

notminiac

Novice
Member
Joined
Feb 24, 2024
Posts
18
Hello. I noticed that I was getting an issue where events with the same event ID would be erased on the map immediately after setting up the Following Pokemon event.

Example:
I set up the Following Pokemon event on Map A.


I would then transfer to Map B



I noticed that Event ID 3 disappeared after the transfer. I had to enter Map C (Map ID: 3) then enter Map B (Map ID: 2) to get the erased event to appear.

I figured something was wrong with the plugin as it wasn't supposed to do this. I looked into Event Sprint.rb and found the following:

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == event.current_map_id
  }

See the issue with event.original_map_id == event.current_map_id ? I believe that when the EventHandler was triggered, event.current_map_id is using map id where the EventHandler was triggered instead of the map the player is transferring to. This causes the event with the same ID on another map to be erased.



The workaround/solution to this issue was to change

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == event.current_map_id
  }

to

Ruby:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Refresh Following Pokemon sprites whenever the map is refreshed
#-------------------------------------------------------------------------------
EventHandlers.add(:on_enter_map, :erase_following_pkmn, proc { |_old_map_id|
  event = FollowingPkmn.get_data
  next if !event
  FollowingPkmn.refresh(false)
  $map_factory.maps.each { |map|
    map.events[event.event_id]&.erase if event.original_map_id == map.events[event.event_id]&.map_id
  }

and

Ruby:
Expand Collapse Copy
  #-----------------------------------------------------------------------------
  # Updating the refresh method to allow clearing of base event in all maps,
  # add reflections and prevent crash when base map/event is deleted
  #-----------------------------------------------------------------------------
  alias __followingpkmn__refresh refresh unless method_defined?(:__followingpkmn__refresh)
  def refresh(*args)
    ret = __followingpkmn__refresh(*args)
    return ret if !FollowingPkmn.can_check?
    event = FollowingPkmn.get_event
    @sprites.each do |spr|
      next if !FollowingPkmn.get_data&.following_pkmn?
      spr.set_reflection(@viewport, event)
    end
    data = FollowingPkmn.get_data
    $map_factory.maps.each { |map|
      map&.events&.[](data.event_id)&.erase if data && data.original_map_id == data.current_map_id
    }
    FollowingPkmn.refresh(false)
  end

to

Ruby:
Expand Collapse Copy
  #-----------------------------------------------------------------------------
  # Updating the refresh method to allow clearing of base event in all maps,
  # add reflections and prevent crash when base map/event is deleted
  #-----------------------------------------------------------------------------
  alias __followingpkmn__refresh refresh unless method_defined?(:__followingpkmn__refresh)
  def refresh(*args)
    ret = __followingpkmn__refresh(*args)
    return ret if !FollowingPkmn.can_check?
    event = FollowingPkmn.get_event
    @sprites.each do |spr|
      next if !FollowingPkmn.get_data&.following_pkmn?
      spr.set_reflection(@viewport, event)
    end
    data = FollowingPkmn.get_data
    $map_factory.maps.each { |map|
      map&.events&.[](data.event_id)&.erase if data && data.original_map_id == map&.events&.[](data.event_id)&.map_id
    }
    FollowingPkmn.refresh(false)
  end

After doing the above, the event on Map B was no longer getting erased. It works for now, but I don't know if any issues will result from this quick fix.

This works as a wonderful quickfix as I was getting the same error with the plugin, thought I was the only one. If you manage to find a bug caused by the edit in the code, please update with a new comment! Looking forward for this plugin's development.
 

Baertierchen

Working on Pokémon Unchained and Pokémon Stardust
Member
Joined
Dec 6, 2023
Posts
18
Sooo.. is there a way to fix the lag that occurs when transitioning from one map to another? And the missing animation for the following pokemon jumping down ledges?
Also you can really screw up the game when you're toggling the following pokemon during cutscenes, is there a way to prevent the player from pressing the toggle button or deactivating the effect?

Any help would be much appreciated!
 

Baertierchen

Working on Pokémon Unchained and Pokémon Stardust
Member
Joined
Dec 6, 2023
Posts
18
Sooo now that the thread is back, I would like to repeat my question, but an important piece of info I forgot to mention is that I'm using the workaround for the 21.1 version.
 

NoNoNever

Dev from Pokémon Illusion, Pokémon Arcadia
Member
Joined
Dec 11, 2018
Posts
77
Sooo now that the thread is back, I would like to repeat my question, but an important piece of info I forgot to mention is that I'm using the workaround for the 21.1 version.
i have not yet been able to find the reason why there is a short lag when entering a new map, in 2 out of 10 games the error is not although all files are the same (i don't understand it either)


i will answer your other question soon, i still have to test a few things
 

NoNoNever

Dev from Pokémon Illusion, Pokémon Arcadia
Member
Joined
Dec 11, 2018
Posts
77

NoNoNever

Dev from Pokémon Illusion, Pokémon Arcadia
Member
Joined
Dec 11, 2018
Posts
77
Sooo now that the thread is back, I would like to repeat my question, but an important piece of info I forgot to mention is that I'm using the workaround for the 21.1 version.
  • In Plugins/Following Pokemon EX/Configuration open 000_Config.rb
    • NOTE: A .rb file is just a glorified .txt file and can easily be opened with any text editor like Notepad.

      Line 17

Ruby:
Expand Collapse Copy
FOLLOWER_COMMON_EVENT        => ID of the Common event that plays when you speak to the Following Pokemon. Normally, this common event should contain the script command [ICODE]FollowingPkmn.talk[/ICODE].
                                Set this to nil if you don't have a common event for your Following Pokemon or, or don't know what common events are. The Following Pokemon will still be able to talk to you.
                                without a common event defined.


ANIMATION_COME_OUT           => Animation ID for the "Come out of Pokeball" Animation for Following Pokemon.
ANIMATION_COME_IN            => Animation ID for the "Go into Pokeball" Animation for Following Pokemon.
ANIMATION_EMOTE_HAPPY        => Animation ID for the "Happy" Animation for Following Pokemon.
ANIMATION_EMOTE_ELIPSES      => Animation ID for the "..." Animation for Following Pokemon.
ANIMATION_EMOTE_ANGRY        => Animation ID for the "Mad" Animation for Following Pokemon.
ANIMATION_EMOTE_POISON       => Animation ID for the "Poisoned" Animation for Following Pokemon.
ANIMATION_EMOTE_MUSIC        => Animation ID for the "Music Note" Animation for Following Pokemon.
ANIMATION_EMOTE_HEART        => Animation ID for the "Heart" Animation for Following Pokemon.



TOGGLE_FOLLOWER_KEY          => The key that the player can press to toggle Following Pokemon. Set this to nil to disable this feature.
SHOW_TOGGLE_IN_OPTIONS       => Show the option to toggle Following Pokemon in the Options screen.

CYCLE_PARTY_KEY              => The key that the player can press to cycle through their party. Set this to nil to disable this feature.

APPLY_STATUS_TONES           => Tint the Following Pokemon sprite if it has a status condition
TONE_BURN                    => Array of numbers corresponding to the RGB values of the Burn Tint
TONE_POISON                  => Array of numbers corresponding to the RGB values of the Poison Tint
TONE_PARALYSIS               => Array of numbers corresponding to the RGB values of the Paralysis Tint
TONE_FROZEN                  => Array of numbers corresponding to the RGB values of the Frozen Tint
TONE_SLEEP                   => Array of numbers corresponding to the RGB values of the Sleep Tint

FRIENDSHIP_TIME_TAKEN        => Time Taken for Following Pokemon to increase Friendship when first in party (in seconds).
ITEM_TIME_TAKEN              => Time Taken for Following Pokemon to find an item when first in party (in seconds).

ALWAYS_ANIMATE               => Whether the Follower always stays in its move cycle (like in HGSS) or not.

ALWAYS_FACE_PLAYER           => Whether the Following Pokemon always faces the player, or not like in HGSS.

IMPASSABLE_FOLLOWER          => Whether other events can pass through Following Pokemon or no.

SLIDE_INTO_BATTLE            => Whether Following Pokemon slides into battle instead of being sent in a Pokeball. (This doesn't affect EBDX, read the EBDX documentation to change this feature in EBDX)

SHOW_POKECENTER_ANIMATION    => Show the Ball Opening and Closing animation when Nurse Joy takes your Pokeballs at the Pokecenter. This will only work if the Nurse Joy event is properly set up.

LEVITATING_FOLLOWERS         => List of Pokemon that levitate and will always appear behind the player when surfing. (Doesn't include any flying or water types because those are handled automatically)

SURFING_FOLLOWERS_EXCEPTIONS => List of Pokemon that will not appear behind the player when surfing, regardless of whether they are flying type, have levitate or are mentioned in the SURFING_FOLLOWERS.
 

Baertierchen

Working on Pokémon Unchained and Pokémon Stardust
Member
Joined
Dec 6, 2023
Posts
18
  • In Plugins/Following Pokemon EX/Configuration open 000_Config.rb
    • NOTE: A .rb file is just a glorified .txt file and can easily be opened with any text editor like Notepad.

      Line 17

Ruby:
Expand Collapse Copy
FOLLOWER_COMMON_EVENT        => ID of the Common event that plays when you speak to the Following Pokemon. Normally, this common event should contain the script command [ICODE]FollowingPkmn.talk[/ICODE].
                                Set this to nil if you don't have a common event for your Following Pokemon or, or don't know what common events are. The Following Pokemon will still be able to talk to you.
                                without a common event defined.


ANIMATION_COME_OUT           => Animation ID for the "Come out of Pokeball" Animation for Following Pokemon.
ANIMATION_COME_IN            => Animation ID for the "Go into Pokeball" Animation for Following Pokemon.
ANIMATION_EMOTE_HAPPY        => Animation ID for the "Happy" Animation for Following Pokemon.
ANIMATION_EMOTE_ELIPSES      => Animation ID for the "..." Animation for Following Pokemon.
ANIMATION_EMOTE_ANGRY        => Animation ID for the "Mad" Animation for Following Pokemon.
ANIMATION_EMOTE_POISON       => Animation ID for the "Poisoned" Animation for Following Pokemon.
ANIMATION_EMOTE_MUSIC        => Animation ID for the "Music Note" Animation for Following Pokemon.
ANIMATION_EMOTE_HEART        => Animation ID for the "Heart" Animation for Following Pokemon.



TOGGLE_FOLLOWER_KEY          => The key that the player can press to toggle Following Pokemon. Set this to nil to disable this feature.
SHOW_TOGGLE_IN_OPTIONS       => Show the option to toggle Following Pokemon in the Options screen.

CYCLE_PARTY_KEY              => The key that the player can press to cycle through their party. Set this to nil to disable this feature.

APPLY_STATUS_TONES           => Tint the Following Pokemon sprite if it has a status condition
TONE_BURN                    => Array of numbers corresponding to the RGB values of the Burn Tint
TONE_POISON                  => Array of numbers corresponding to the RGB values of the Poison Tint
TONE_PARALYSIS               => Array of numbers corresponding to the RGB values of the Paralysis Tint
TONE_FROZEN                  => Array of numbers corresponding to the RGB values of the Frozen Tint
TONE_SLEEP                   => Array of numbers corresponding to the RGB values of the Sleep Tint

FRIENDSHIP_TIME_TAKEN        => Time Taken for Following Pokemon to increase Friendship when first in party (in seconds).
ITEM_TIME_TAKEN              => Time Taken for Following Pokemon to find an item when first in party (in seconds).

ALWAYS_ANIMATE               => Whether the Follower always stays in its move cycle (like in HGSS) or not.

ALWAYS_FACE_PLAYER           => Whether the Following Pokemon always faces the player, or not like in HGSS.

IMPASSABLE_FOLLOWER          => Whether other events can pass through Following Pokemon or no.

SLIDE_INTO_BATTLE            => Whether Following Pokemon slides into battle instead of being sent in a Pokeball. (This doesn't affect EBDX, read the EBDX documentation to change this feature in EBDX)

SHOW_POKECENTER_ANIMATION    => Show the Ball Opening and Closing animation when Nurse Joy takes your Pokeballs at the Pokecenter. This will only work if the Nurse Joy event is properly set up.

LEVITATING_FOLLOWERS         => List of Pokemon that levitate and will always appear behind the player when surfing. (Doesn't include any flying or water types because those are handled automatically)

SURFING_FOLLOWERS_EXCEPTIONS => List of Pokemon that will not appear behind the player when surfing, regardless of whether they are flying type, have levitate or are mentioned in the SURFING_FOLLOWERS.
Ah nice! But I don't actually want to make it non toggleable, I just want to prevent it temporarily for longer events, so you can toggle it on/off again when the event is done. Would it be possible to turn this into some kind of command that's usable in the event? I've only managed to do it via a workaround so far, I used "FollowingPkmn.stop_following" which completely disables following Pokemon, but that's not ideal in many ways.
 

NoNoNever

Dev from Pokémon Illusion, Pokémon Arcadia
Member
Joined
Dec 11, 2018
Posts
77
Ah nice! But I don't actually want to make it non toggleable, I just want to prevent it temporarily for longer events, so you can toggle it on/off again when the event is done. Would it be possible to turn this into some kind of command that's usable in the event? I've only managed to do it via a workaround so far, I used "FollowingPkmn.stop_following" which completely disables following Pokemon, but that's not ideal in many ways.
Ruby:
Expand Collapse Copy
FollowingPkmn.toggle
# The main command used to toggle the Following Pokemon.
# forced => Set this to false if you want to force the Following Pokemon to turn off and true if you want Following Pokemon to turn on. Set this to nil if you don't want to forcefully toggle the Pokemon.
# anim   => Set this to true if you want to play the Pokeball Animation when the Following Pokemon is toggled, and false if you don't.

Examples:
FollowingPkmn.toggle
FollowingPkmn.toggle(nil,true)
FollowingPkmn.toggle(true,false)
 

Baertierchen

Working on Pokémon Unchained and Pokémon Stardust
Member
Joined
Dec 6, 2023
Posts
18
Ruby:
Expand Collapse Copy
FollowingPkmn.toggle
# The main command used to toggle the Following Pokemon.
# forced => Set this to false if you want to force the Following Pokemon to turn off and true if you want Following Pokemon to turn on. Set this to nil if you don't want to forcefully toggle the Pokemon.
# anim   => Set this to true if you want to play the Pokeball Animation when the Following Pokemon is toggled, and false if you don't.

Examples:
FollowingPkmn.toggle
FollowingPkmn.toggle(nil,true)
FollowingPkmn.toggle(true,false)
I appreciate it, but this just toggles the Pokemon on and off, but doesn't prevent the player from toggling it manually as I understand it.
Is there a similar command that shuts down the ability to manually toggle for a while? Because when using just this one, the player is still able to just press "A" and toggle it on again during a cutscene which screws all of the moveroutes sadly.
 
Back
Top